I have a modelmaking "village" with some houses. I want to put LEDs in them and light them like this:
- 16 LEDs to be controlled individually (with two 7HC595s) (houses)
- 10 LEDs to be on or off at the same time (maybe with a transistor?) (street lights)
If all LEDs are on, they draw about 26 * 40mA = 1A while the Arduino only provides 400mA.
How can I power the LEDs?
By using an external power supply to power the LEDs and arduino or by powering the LEDs and shift registers with a seprate supply. Join the grounds but not the plus.
Here's a wallwart that will work nicely for that.
Most LEDs have a continuous on limit of 20mA, not 40. Check your spec.
74HC595 also has a limit of 70mA thru the device.
You're better off withTPIC6B595 to sink current from the LEDs.
TPIC6B595N, 82 cents at avnet.com
I DON'T THINK YOU WOULD EVEN REALLY NEED A SHIFT REGISTER IF YOU WANT TO CONTROL ALL THOSE LEDS. The Arduino has more than 20 pins (i think most have a bigger number than that), which are enough for your individually controlled 16 LED's and another pin to control all the street lights at the same time.Which makes it only 17 out of 20 pins used.
Yes, but if using an Arduino you run into the problem of total current draw limit thru the part as well. External high-current capable shift registers take care of that. Need something off board for the transistors any, so add 2 more chips and make life easier electrically.
Only Mega’s have more than 20 IO. Way less to add two 82 cent shift registers vs whatever an mega costs.
As Crossroads suggests, if you use 3 TPIC6B595s, not only do you cut down on wiring ( only 3 wires to the Arduino board ) but you could also use 4 wires and dim them with pulse width modulating the blanking pins of the TPICs ( notG pin ).
We don't know the age of your " village" but it would leave spare pins for sequenced traffic lights, shop windows etc ?
And as Grumpy Mike suggests, if you use a seperate power supply, once you have it running you can put a 24 pin socket, a 5 volts regulator, a few caps and a resistor, and you have an embedded micro, to free your Arduino board....
"put a 24 pin socket"
well, maybe a 28 pin socket if you want to capture all of the leads
I would like to do this using just the parts I already have.
I tested the 7HC595 with 8 LEDs on at a time and it worked.
Since they are very cheap, it wouldnt hurt if one breaks.
So the problem would be the power supply.
I have found these wallwarts:
I guess the 1A one is the best. This is a USB cellphone charger so it would require me to solder a wire on a usb cable.
1A would seem to be plenty for 21 LEDs.
"well, maybe a 28 pin socket if you want to capture all of the leads smiley-wink"
I dont use Vref , MOSI, MISO, or SCK
OK lets be honest , this is good wine on the wifes' birthday:-)
Personally I would not bother with the shift registers or external power. The cheapest way would be multiplex the LEDs - you just need 12 pins for 36 LEDs. You can switch em fast in arduino as long as arduino doesn't need any other thinking time. This way your using max 6 leds @ 40mA (240mA) at one time so your power will be fine, its just whether or not they will be bright enough for you.
Good luck and let us know how it all works out!
Disclaimer: Clearly I know next to nothing about electronics!