If I common the pos 5 volt pin on an Arduino Uno screw shield to a bus terminal block via a resistance, and connect twelve LEDs to the pos bus and neg pins on the Arduino, will that suffice for all LEDs that light randomely, or should I use twelve resistors on the neg leads?
Short answer: No it will not. You will need individual resistors for each LED.
And to be honest, I’m not sure arduino uno supports that much current. (20ma*12 = 360 ma * 5V = 1.8 Watts) I think you might need a transistor driver circuit from a separate 5V source. The base would connect to the neg terminal on the arduino and the emmiter would go to ground outside the arduino.
Yes, fully loading all pins will exceed the chip’s maximim rating of 200ma. The maximum current for the whole chip is 200ma, that’s all active pins plus the internal systems themselves, so you can’t load even 10 pins to maximum.
not if you put them in series. Not sure there’s enough voltage. Assuming LEDs are from the same batch, they should have the same brightness since the same current is passing thru each. And, less power is used for the same number of LEDs.
More details are required about what you’re trying to do. What LEDs are these, do you have the datasheets? Do you want them to be individually controlled? And how bright do they need to be? Personally I run most LEDs on my layout between 3 and 10 mA, depending on the application. They look silly if they’re too bright.
The LED brightness on a tester is ok at 0.5 or 1ma for oil lamps and candles. Am I able to regulate the current on the Arduino? Or is it better to use the 3.5 volt output of the Arduino?
edit: Good lord I wrote a lot of text that didn’t actually answer your question. To get around 0.5 to 1 mA on a standard little LED, use a resistor of around 4k ohm on a 5V supply or 1.7k ohm on a 3.3V supply. But it depends on the LED voltage drop, as discussed below, which should be in the LED datasheet or you can measure it pretty easily.
You can’t regulate current with the Arduino, you just have to figure out the correct resistor to allow current you want through the LED. It’s a fairly easy calculation if you know the voltage drop of your LED.
The standard Arduinos have a 5V power pin and a 3.3V power pin. All of the digital outputs on Arduino Unos, Megas, and most others operate on 5V. I like to use 5V for all LEDs and logic circuitry, because some LEDs have a voltage drop of 3.7V, meaning they cant properly be operated on anything less. You can always drop your voltage and current down with resistors but you can’t readily boost it up.
When using LEDs it’s important to understand how they work. They do not behave like ohmic devices like incandescent bulbs, resistors, etc. An LED has an (approximately) constant voltage drop. For the common little red/yellow/green LEDs, this is around 2V. If you have 5V on the anode you will have 3V on the cathode. Doesn’t matter how much current runs through the LED (unless it is so much that it burns it out and the whole circuit stops working).
LEDs are given a voltage drop and a max current. You must give them a resistor that limits the current running through the LED. Example: Your red LED has a voltage drop of 2.1V. It has a max current of 20mA and you want to supply that. You’re using a 5V Arduino output. So:
The LED drops 2.1V from the 5V. The resistor is the only other element between the Arduino and ground; thus the resistor must drop 2.9V. The question is, what resistance will make 20mA run through the circuit?
Thanks speedybee and all for the helpful responses. It seems that twelve LEDs may stretch the chip a little, so I’ll wire three structures with the street lamps circuit that stays on constantly, and nine on the chip for random lighting. That should work.
No problem! If you want to operate high currents through all the Arduino pins you can do so with a transistor such as the popular PN2222A.
It basically acts like a switch that can carry much more current than an Arduino pin. Where your LED circuit would connect to ground you can instead connect it to the transistor collector. The transistor emitter connects to ground. At this point, the switch is off, the transistor will not let current through, and your LEDs are dark. Then, when a voltage is applied to the transistor base, the switch is on and the LEDs are lit.
This is useful because the transistor requires very little current to activate the switch but it can carry a lot of current through it. So your Arduino digital pin can go through 4k resistor and then to the transistor base. This limits the Arduino pin current around one little mA and you can have as much as you want (up to 600mA on the PN2222A) flowing through the transistor.
The details of transistor chemistry are kinda complicated but using them is easy. Basically, to use a transistor as a switch, there are two rules:
Emitter must be wired to ground, and whatever load you’re trying to control gets attached to the collector. You can’t have the any load like LEDs or resistors or whatever between emitter and ground.
It’ll work fine only for simple on/off loads such as LEDs and resistors. Things that behave not simply such as solenoids and motors won’t work quite like a simple on/off switch and need additional planning. http://amasci.com/amateur/transis.html if you want a nice intro to transistors! but it can be heavy stuff