What resistor to use for the LED in this switch?

I want to illuminate an LED built into a switch with the Photon’s digital I/O but I do not know what resistor to use with the LED.

The switch in question is the 3 volt version of this one:

Any suggestions?

Welcome to the community.

Without knowing the forward bias of the LED - a 10mA source from the Photon pin gives 300 ohms - so say 330 ohms as a standard value. Someone will probably suggest a more exact value but that should work fine.

I can’t find the datasheet, the site is in a different language. Since it comes for different voltages, my guess is that the resistor is already built in. The 3V version should work fine at 3.3V, but you have to check how much current it will draw. You can safely get 10mA from an I/O pin, depending on which Particle device you want to use.

I used a 270 ohm resistor and it worked great. Thanks for the help!

I’m planning on using 8 switches on a photon. How would you determine how much current the LED will draw?

@mjpalm21, if you use 8 switches, each with a resistor limiting current to 10mA, then that makes a total of 80mA draw. Depending on what other hardware you have drawing current from the 3V3 pin, you may want to consider adding a separate3.3v LDO powered from the Vin pin. This assumes you are lighting all switches all the time and not driving those LEDs via GPIO pins.

Since I can’t find a datasheet, a basic multimeter will do.

1 Like

I will be driving the LEDs with the GPIO pins. Basically the switches will be used as inputs and the LEDs will be used to indicate that the switch is on/off.

The Photon’s data sheet indicates that each GPIO can do 25mA - so I’m thinking it would be fine driving the LEDs…

@mjpalm21, I am confused.
You plan to drive the I/O to turn on the LED? Then, what reads the switch state? The same I/O pin or a different one? I wouldn’t short the I/O pin with the switch while it is high.

You could wire it such that the I/O does not drive any current.
image
When the switch is closed, the LED is on and the I/O will read zero.
When the switch is open the LED is off and the I/O will read 1.
If you switch the position of the LED and the switch, you get the opposite states.
You might need a resistor (100k) in parallel with the LED to guarantee some leakage current.

1 Like

I agree that it almost certainly includes the the appropriate resistor for each of those listed supply voltages. If it were me, I would try the 3V version: first with no resistor, and then add whatever resistance is needed to get the currrent down to 10 mA.

1 Like

You have to take heed to what @peekay123 is saying. There is more to it than just looking at the current output of a pin in the data sheet. In a situation where one is driving more that typical logic currents to drive things (I.E. relays, leds, and such) you need to make sure your not going over the package total current rating.

The Photon has a spec named “Iio total”, which is 120ma MAX. As an example, if 5 I/O pins are driving 25ma, your exceeding the package total current capability’s. Just keep this in mind for how many things you drive with I/O pins.

2 Likes

I’m using momentary switches to toggle the switch state. The LED indicates the current state which can be changed via the momentary switch or software via timers etc…

1 Like

Yep, it does have an internal resistor. I hooked it up directly between 3v3 and ground and it measures just 3.2 mA.