# LEDs with Baby O

Hi.

I would like to connect three LEDs to the Baby O, using the same IO-port. The LEDs have Vf=2V and If=30mA. I guess that means I can not connect three of them in series with 5V input. I would have to connect them in parallel, right?

I am not sure how to calculate the size of the resistor in series with the parallel LEDs, but this is what I think:
-The voltage drop across three LEDs in parallel will be the same as for one LED (2V).
-The forward current will have to be three times If (3*30mA = 90mA).
-The voltage drop across the resistor will be Vcc-Vf=5V-2V=3V
-The appropriate resistor will be R = U/I = 3V/90mA = 33ohm

Do you think this would work? Please tell me if my calculations are wrong. I am also unsure if the IO-pin can supply that much current. Would it be better to connect the LEDs between Vcc and the IO-pin, and make the pin low to activate the LEDs?

Hello,

90 mA is definitely too much for the I/O pin. It’s also not good to put LEDs in parallel without individual resistors since one of the LEDS will hog the current (they won’t all have a drop of exactly 2V at 30 mA).

I’m not sure how you’re getting your target current, but the Vf, If pair are just one data point on a curve. The LEDs will just be dimmer with less current and brighter with more (and have a shorter life with more). The LEDs on the PCB have 1k resistors on them, and they are decently bright, so you can do with much less current.

If you do really need the brightness, you can get the best efficiency with two LEDs in series in parallel with the third LED. It could be tricky to get the brightnesses even, but you’d eliminate a third of your power consumption.

You might also consider using a small transistor or MOSFET to get the current you need. Even small ones can handle hundreds of mA easily, and you could also tie the chain of LEDs to your VIN (not Vcc), which might be high enough to allow all LEDs to be in one series chain.

- Jan

Thanks for the reply.

Using a transistor and VIN is a great idea. I have a 7,2V VIN, so it should be able to handle all the three LEDs in series.

Just for future reference, do you know how much current the Vcc and the IO-pins can handle?

The regulator is good for up to 100 mA, and the absolute max for the AVR I/O pin is 40 mA. There’s all kinds of other maximums and minimums and other factors. For instance, the voltage you get out the pin will drop (or rise if you’re sinking current) as the current goes up. And, everything power-related is affected by heating issues, so your exact limits will depend on your complete system. You should check the datasheets for details.

- Jan