Switching 8 LEDs on and off via one output

Hi,

I’m trying to do something relatively simple but am new to the arduino (just finished working through the starter book & kit).

For my first project I need to hook up 16 buttons and send messages to a flash app when they’re pushed. Got that working no prob (using analogue and digital inputs), but what I also need to handle is turning on/off the lights for 8 of the buttons when the flash app tells me to.

So here’s my questions if anyone has the time to answer nub stuff :wink:

I need to power a total of 16 LEDs (backlit buttons), but I need to be able to turn 8 of them on and off from the arduino (not individually, just all 8 on, all 8 off, so I only need one output form the board). How do I power all of these lights so that I can interrupt the current to 8 of them from my arduiono?

I’m using a Duemilanove w/ Atmega328.

P.S. I’m a software guy who’s just starting to play around with embedded elec, and loving the Arduino.

Thanks!

How would you do this manually? You'd just connect all 8 long legs together, and all 8 short legs together. Then, connect the short legs to a resistor, and connect the other end of the resistor to the negative side of a battery. Connect the long legs to the positive side of the battery. They all light up.

Change the long leg connection to a digital pin, and the resistor connection to ground, and set the pin HIGH.

Presto, you'll fry the Arduino.

The analog pin on the Arduino is not going to be able to deliver enough current to light all 8 LEDs.

you need to supply the led's with their own power, and connect all the cathodes together

run the cathodes into the collector of a NPN transistor, run the emitter to ground

connect a 1k resistor from the arduino to the base of the transistor, and then you can turn on or off the connection to ground via software

kinda like this

Perfect, thanks for the quick replies.

How would you do this manually? You’d just connect all 8 long legs together, and all 8 short legs together. Then, connect the short legs to a resistor, and connect the other end of the resistor to the negative side of a battery. Connect the long legs to the positive side of the battery. They all light up.

Change the long leg connection to a digital pin, and the resistor connection to ground, and set the pin HIGH.

Presto, you’ll fry the Arduino.

The analog pin on the Arduino is not going to be able to deliver enough current to light all 8 LEDs.

I could be reading that wrong, but that seems like a really unhelpful answer. You basically told the OP how to fry their Arduino, and then in “fine print” (the bit after your explanation) told him not to do it ::)…

OP asked how to do it. I explained how to do it. Then, I explained why OP should not do it.

What he needed to do, instead, I know in theory, but not part numbers, etc. I do not know.

I suppose I could have simply not posted anything.

It's cool. I'm pretty much sorted now. Never intended on following the fry your board advice ;)