Running 9 SMD LEDs from Arduino Uno via 9 pins - feasibility


I am not new to Arduino but I do about one project a year and always seem to forget certain basic things. I am starting out on a simple project and need to check that I have thought it through correctly.

I want to do something really simple - to have 8 SMD LEDs (with a forward current of 20mA and a voltage of 3.6V) all flashing on and off together, controlled by an Arduino Uno,

i.e. pins 3-12 HIGH delay(800),
pins 3-12 LOW delay(800) repeat.

Ideally the project would work either powered by a lithium battery or by the standard 9V power supply.

The battery version is intended only to work for a couple of hours - until the battery runs out.
In the long term, the project would be powered by the standard 9V power and would be able to run 8 hours a day for three months without the LEDs dying.

To my simple brain it seems like I can do this by simply connecting each of pin 3 - 12 to a resistor, then to the positive pin of the LED, then from the negative pin of the LED to the GND and control the ON/OFF state by coding the pins to be HIGH or LOW.

But this seems too simple...
Am I on the right lines? Or should I rethink this?

If I am on the right lines, as I want around 3V on the LED, I want to have 2V on the resistor.
So 2/0.02 = 100, which means I want a 100ohm resistor for each LED, right?


I am not new to Arduino but I do not use it regularly. I want to check that I have thought this project through correctly before I start in on it. Please advise...

I want to have 9 white SMD LEDs (forward current 20mA voltage 3.6V) all on and then all off, in a loop, powered by an Arduino Uno either using standard 9V power supply or using a Lithium battery as the power supply.

pins 3-12 HIGH delay (1000)
pins 3-12 LOW delay (1000)

I think this is quite simple to do - which is why I am writing this post. It seems too simple.......

I think I connect each LED to a pin on the Arduino via a resistor, and I connect each negative side of the LED to the ground. Then I control ON/OFF with HIGH/LOW.
Is that correct? Or have I missed out something vital?

I want the 9V power supply version to run for 8 hours a day for 3 months without the LEDs failing.

If I am correct, I think the value of the resistor should be 100 ohms
(I used the calculation Resistor = (5 - 3) / 0.02), where 5 is the power coming off the pin, 3 a sensible value for the LED, and 0.02 the current of the LED.
Is that correct?


Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:

Here's a link to the circuit diagram - It's super basic 9 SMD LEDs from Arduino UNO - Album on Imgur

(5 - 3.6)/.02 = 70Ω

100Ω will work.

Modern LEDs are very bright at 20mA.

 for( byte x = 3; x <13; x++)
    digitalWrite(x, HIGH);


for( byte x = 3; x <13; x++)
    digitalWrite(x, LOW);

Thanks larryd.

Here is the data sheet for the LEDs:

I haven't started the wiring yet as I want to know if I've thought it through properly before putting solder to contact.

Do not cross post.

Threads merged... carry on.

“ I want to know if I've thought it through properly before putting solder to contact.”

This is very rare, congratulations! +1

Note, you can wire a simple LED cct. as connected to Arduino pins D13 or D8.

OR as Arduino pins D8 and D7.

Cool, thanks! I see. (nice diagram)

And either way 5V will flow through each pin, won't it?

I can't quite believe it is that simple.

It is that simple.

In one case current goes: from 5v, though the LED, then ‘into’ the Arduino pin.

In the other case current goes: ‘out of’ the Arduino pin, through the LED, then to GND (0V).

Threads merged.

If all 8 LEDs flash together, it would be a waste to use 8 Arduino pins. One Arduino pin and a basic transistor would be better. But if this is all the circuit does, using an Arduino would be a waste. Just use a 555 timer. No coding required.

Ideally the project would work either powered by a lithium battery or by the standard 9V power supply.

Whatever you may mean by "standard 9V power supply", this is a very bad way to power an Arduino (UNO, Nano, Pro Mini ...).

At 9 V, the 180 mA of the LEDs - if they were all on at once although you suggest they will not be - plus 30 or 40 mA of the chips might barely be able to be provided by the on-board regulator, but you should avoid it for any real project using parts additional to the Arduino board itself.

The proper way to supply the Arduino is to use 5 V, reasonably regulated. The USB jack is a convenient place to feed it, but wiring to the "5V" pin is more direct. A "power bank" (as for charging phones) is a very practical approach to battery power for a few hours.

Regulation is not entirely important. As long as the voltage does not fluctuate rapidly, a supply between 4 and 5.5 V should not cause problems, certainly for your purpose.

A total of 180 mA is a lot for the Arduino to supply, the absolute maximum rating for the ATmega328p chip is 200 mA. You may want to consider an external driver for those LEDs, such as the TPIC6B595 shift register, to lower the load on the MCU itself.

For power supply, consider using 3x AA batteries, connected to the 5V pin, bypassing the regulator. For much improved battery life use a Pro Mini.

Ohms law and I don't seem to get along well with LED's - every time I did the math the current draw was not quite as advertised - so for fine tuning I always use a multi-meter to double check things. Your proposal with all LED's on would be close to the limit of the total draw for the UNO so I would double check the draw.

...the absolute maximum rating for the ATmega328p chip is 200 mA...

I believe that is the port / VCC+GND limit. If it is then the total limit is 400 mA (three ports; two VCC+GND pairs).

From memory, ATmega328p port limit is 100mA and package limit is 200mA
(the Mega has a package limit of 400mA).

Vf of white LEDs is about 3.3volt, which leaves 1.7volt for the 100 ohm resistor (17mA).
9 LEDs = 153mA, and safe when spread across two ports (diagram in post#4).

The OP will probably find the LEDs will be bright enough at 10mA each.

It all depends on what you are using the LEDs for.
I usually run my SMD indicator LEDs at 200uA (10k CL resistor).
Still bright enough to see.

20mA (or whatever is in the datasheet) is the absolute max current for a reasonable lifespan. Not wise to go near it.
About 10mA (220ohm CL resistor) is indeed more than enough for an SMD LED.