Arduino MEGA and multiple LED diodes with a 12V supply

Hello everyone,

I’m working on a Halloween project and wanted to run it by you wonderful people before I get started.

I want to power 20+ LED diodes that will be placed in pairs to look like red glowing eyes throughout my yard. I am writing a program that will randomly make the lights go out and turn back on immediately to look as if the eyes are blinking. The LEDs I ordered have a resistor hard wired and they say the diodes are “12V” whatever that means. They didn’t specify the ohm rating though.

My power supply I am using is 12V for landscape wiring. I was planning on using a regulator to change it to 5V to run the arduino. I wanted to know if the Arduino can handle using all of the digital pins to power these LEDs.

If they are 12V LEDs, they likely have a resistor in series to limit the current when a 12V supply is used.

Say the LEDs had a Vf of 2.5V (you can measure the voltage across the LED leads when it is turned on).
Further, assume a current flow of 20mA.
Then the resistor is likely to be (12V - 2.5V)/.02A = 475 ohm 470 is a typical standard value.

Then with 5V, the current would be (5V - 2.5)/470 ohm = 5.3mA, and the LED would be a lot dimmer. You’d have to do a test and see if that was still bright enough at night. Could very well be, modern LEDs can be quite bright at well under their max rated current.
But, you could safely run 10 pairs from 20 IO pins on a 328P board as the total current would be 100mA.

A Mega can handle up to 800mA, so 20+ eyes would be okay also.

If you attempt to power the LEDs from 12V and sink current, then when the output turns off and the IO pin sees 12V, the pin will blow and kill the processor. Don’t do that.

jared944:
I wanted to know if the Arduino can handle using all of the digital pins to power these LEDs.

Depends.

“12volt LEDs” could mean that there is already a resistor inside the package/wiring.
Post a weblink to be sure.

You could try if the brightness is enough when the LEDs are powered with 5volt instead of 12.
Then you can control/power them directly from the Arduino pins,
and power the Arduino from a 5volt cellphone charger, connected to the USB socket.

If not, then you must use a 12volt supply for the LEDs, and transistors for each “pair of eyes”.

Study the “BlinkWithoutDelay” example that comes with the IDE.
Leo…

Wawa:
"12volt LEDs" could mean that there is already a resistor inside the package/wiring.
Post a weblink to be sure.

:astonished:

jared944:
The LEDs I ordered have a resistor hard wired and they say the diodes are “12V” whatever that means.

Presumably there is something about those LEDs that makes them more useful to you than just using standard inexpensive LEDs and powering them from 5 V with the appropriate (150 Ohm) resistor.

But if you just used the basic LEDs without the resistor, you can drive any number up to 64 in a matrix from 5 V with only one resistor to determine the current with a MAX7219 driver which also provides 16 step brightness control (to the whole array together). And you do not need a Mega 2560 as a Nano provides the necessary three control lines perfectly well.

If you wish to power your 12 V LEDs with their built-in resistors, a TPIC6B595 will drive eight at once and a number of these chips can again be easily driven by three lines from a Nano.

Thanks for the great replies.

Yeah, there is a resistor already wired in. Here is the product link:

I got the package and the resistor seems to be green/brown/black/black/brown which seems to be 510 ohms?

I plugged them into the mega and ran a simple LED script. It seems like they will be bright enough to run off of the 5 volts which would be really nice. I’m going to test them tonight when it’s dark outside.