Hello,
I am planning a train signal system that uses 42 separate LEDs. Unfortunately they have a common + and use ground as control. Since the Arduino only can give + on the board how can I solve this problem?
Thanks
Hello,
I am planning a train signal system that uses 42 separate LEDs. Unfortunately they have a common + and use ground as control. Since the Arduino only can give + on the board how can I solve this problem?
Thanks
Hi,
No Problem. "Anything can be inverted".
Are most of the units the 3-led versions shown in your example? So, only 1 of 3 on at a time? If so, one resistor per group (probably 220 ohms is good to run from +5V).
An Arduino MEGA can do 54 separate I/O's and can probably run all those LEDs. It would be good to provide a separate 5V supply to the LEDs so the Arduino is only sinking current towards ground.
See: (Mega QuickRef)
And, to keep from going insane with wires and pins see MEGA Sensor Shield and Wires and Cables.
Since the Arduino only can give + on the board
?
What, that is the first I know about this. Could it be you are wrong.
Well yes of course you are. Controlling anything by making an output low is called "current sinking" and in most of the world outside Arduino it is the most common method of control.
So put 5V on the anode and the cathodes to 3 digital pins. When the pins are high there will be no potential difference and the leds will be off; make pin low and led goes on.
terryking228:
Hi,
No Problem. "Anything can be inverted".Are most of the units the 3-led versions shown in your example? So, only 1 of 3 on at a time? If so, one resistor per group (probably 220 ohms is good to run from +5V).
An Arduino MEGA can do 54 separate I/O's and can probably run all those LEDs. It would be good to provide a separate 5V supply to the LEDs so the Arduino is only sinking current towards ground.
See: (Mega QuickRef)
And, to keep from going insane with wires and pins see MEGA Sensor Shield and Wires and Cables.
Yes, they will only shine one at a time so t will be 14 lit at once. I was thinking of getting a mega. Only have a basic starter kit now so not enough outputs yet. I am very new at this.
But does this mean that the mega doesn't give enough electricity to supply all lights?
does this mean that the mega doesn't give enough electricity to supply all lights?
A little Math:
42 LEDS ,but only 14 on at a time.
Typical LED with 220 ohm resistor: LED has a voltage drop of "About" 2.0 volts at 15mA (0.015 A)
The resistor determines the current: I=E/R so 3.0 volts across the resistor means I = 3.0 / 220 or 0.014 amps (14mA).
14 ,* 0.014 = 0.196 A or about 200 mA so No Problem.
Details of pin current limitations HERE if you want to wade thru it...
And.. yes, different color LEDs have different voltage drops but this is close enough, I think..
But you DO want to SUPPLY the 5V from a separate wall wart type power supply, so the Mega is only SINKING current to ground. That way the Mega itself is the only thing powered from USB or from the external power input (9V 1A power supply for that is good)..
terryking228:
But you DO want to SUPPLY the 5V from a separate wall wart type power supply, so the Mega is only SINKING current to ground. That way the Mega itself is the only thing powered from USB or from the external power input (9V 1A power supply for that is good)..
Ok, I think I understand now. Didn't imagine that the LED's would come close to the comfort zone of the arduino. Thanks for the help!
sandpatch:
Didn't imagine that the LED's would come close to the comfort zone of the arduino.
The current through an LED depends on the series resistor, not the LED. Once it's conducting, ie got more than its minimum voltage, and LED's pretty much a short circuit.
The test circuit you posted, shown here for convenience, shows a 1k resistor rather than the 220 mentioned in this thread. You should try it with one of those: it may well be bright enough for your purposes, and use 1/4 of the current. (It's not as if a human driver needed to see the signal from 100s of meters away, after all.)
You could multiplex one I/O pin to get multiple outputs. A bit more complicated but it will reduce the amount of pins required
You could multiplex one I/O pin to get multiple outputs.
Only if you have no idea what you are doing. That tutorial is stupid, it is not practical and wastes computer resources. It is not something that should be done in practice. If you want to do that then you need an addressable latch like a 74LS259. That way the output stays fixed once set and there in no need for constant refreshing so the LEDs are brighter.