Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Question on what it can do
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Question on what it can do

by Atrum on Thu Jun 19, 2008 1:00 am

So I'm basically new to electronics, I know some things but not much. Im going to get the Audrino once adafruit is opened again.

I wanna know if it can power several LEDs so I can make changing mood lights in my room. How many can it support? Because If I use Red, Blue and green thats already three and if I'd make maybe 7 of these pods it would be 21 already.
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by trialex on Thu Jun 19, 2008 4:48 am

There are two issues you need to consider

[1] The arduino itself can only power a certain amount of LEDs (or anything else) before you run the risk of damage. When you start to approach the limit, you start using transistors. Transistors act like an electronic switch - with you send a signal to turn the LED on, the transistor turns on a separate circuit. Do some reading of this: http://todbot.com/blog/wp-content/uploads/2007/11/bionic_arduino_class3.pdf (page 20 in particular if you've got a short attention span)

[2] You can control up to 21 separate outputs directly using the arduino pins. If you want more, there are ICs you can use that will extend the amount of outputs. Obviously this increases the complexity. Do some reading of this: http://www.arduino.cc/en/Tutorial/LEDDriver and this:http://www.arduino.cc/en/Tutorial/ShiftOut
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

by mtbf0 on Thu Jun 19, 2008 6:16 am

trialex wrote:[2] You can control up to 21 separate outputs directly using the arduino pins. If you want more, there are ICs you can use that will extend the amount of outputs. Obviously this increases the complexity. Do some reading of this: http://www.arduino.cc/en/Tutorial/LEDDriver and this:http://www.arduino.cc/en/Tutorial/ShiftOut


20, actually. the mega168, the microcontroller on which the arduino is based, has 23 i/o lines, but one is needed for reset and two others are used to connect the resonator. also you probably ought to be careful what you attach to the USART lines.

you can get away with removing the resonator, but this will require a little tweaking.

of course, if you want all 7 modules to show the same color, you don't really need 21 i/o lines.
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

by Atrum on Thu Jun 19, 2008 1:28 pm

mtbf0 wrote:
trialex wrote:if course, if you want all 7 modules to show the same color, you don't really need 21 i/o lines.


I thought about that when I was about to fall asleep last night, Id just run each pod the same so it would basically be 3 LEDs and have them run parallel so I don't need a ridiculous amount of voltage. Once I have the whole concept up and running I'll post what exactly I'm doing.
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by tyggerjai on Thu Jun 19, 2008 9:58 pm

Some things to consider:

Shift registers. A serial-to-parallel shift register like the 74HC595 can greatly increase the number of LEDs you can control. I'm running a 4-digit 7-segment LED timer with an additional RGB LED, for a total of 31 "logical" LEDS from an Arduino with 4 shift registers, and I still have a pin left for a button. In fact, it only takes 9 pins to control those 31 LEDs, and that's only because I'm using cheap shift registers with no daisy-chain ability. Daisy chaining them will give you a massive increase.

MAX7219/7221 chips. Mine hasn't arrived yet, but as I understand it these are basically daisy-chained shift registers in a single chip, controlling up to 64 LEDs with only 3 Arduino pins. Pricey, compared to 8 shift registers, but that's the eternal tradeoff.

Multiplexing: Less useful with RGB LEDs, since they're common cathode/anode, but for lots of single LEDS you can shift register both the cathode and the anode. By switching between banks of LEDs (uh, I haven't had coffee yet, so I know this isn't clear, but bear with me), you can use basically a POV technique to make it look like you're running 32 LEDs simultaneously, when in fact you're only running 16 at a time. I had a little 7x7(== 49 LEDS) LED matrix running off the arduino doing animations. It used most of the pins, but now that I know a little more about shift registers, I think I could reduce the pin count a lot.

So in short, yes, your issues are not so much how many LEDs the Arduino can control, but how many LEDs the Arduino can source/sink current for before you have to look at transistors or alternative power supplies.

I really should get around to posting code and tutorials for those, I guess.

jai.
.
tyggerjai
 
Posts: 35
Joined: Mon May 26, 2008 7:47 am

by Atrum on Fri Jun 20, 2008 3:52 pm

Okay well this is the main idea for a pod (unit that houses LEDs) and it basically just runs 4 pin flat cable (is that whats its called I've had no luck searching) between an box that houses four buttons to control each LED. They turn one off and on so you can change colors and the last one just puts it in rainbow mode switching back and forth. The buttons are on a seperate circuit from the LEDs so I don't need as much cable. Then from the main box it goes to the pod where it just turns them all on in parallel.

I don't want to use RBG LEDs just because I feel it will be simpler on my part.

Another question, if I had 7 Pods totaling 21 LEDs running in parallel would it draw alot of current, I guess it depends on the LED but would it be nessesary to use an external power source.

oh and here is a sketch of the pod, as you can see I have no Schematic skills.

Image
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by tyggerjai on Fri Jun 20, 2008 9:44 pm

It's generally called "ribbon cable". It's handy for this application because for prototyping (and even for the final thing) you can use IDC connectors as mini breadboards to plug the LEDs into.

So the buttons are on the "main" box, with the Arduino? If you're using an Arduino, you could get away with one single button that just tells the Arduino to move to the next mode - that saves you some pins. Otherwise, if you replace the buttons with a rotary switch, you can lose the Arduino entirely - I've built something very similar to this just using potentiometers to control the levels of Red, Green and Blue, and a basic circuit using a 555 timer and decade counter to flash through the colors. But the Arduino is probably easier, and much less soldering :)

If the buttons are on the main box, and all the pods are doing the same thing, is there a reason it needs to be parallel? You can bump the whole thing down to 4 pins if you wire the LEDs in series and use one button.

Personally I find RGB LEDs easier - less soldering, fewer components to worry about. But your mileage may vary on that.

Finally, 21 LEDs * ~30mA =~ 630 mA. I have, to be honest, no idea what the arduino can source, but I'd certainly be looking at transistors for that.

jai.
.
tyggerjai
 
Posts: 35
Joined: Mon May 26, 2008 7:47 am

by Atrum on Sat Jun 21, 2008 12:27 am

Thanks for the Ribbon cable name.

I want four buttons to control each LED so I can create other colors like purple, yellow and so on.

If im running it in parallel Im already only using four pins and lower voltage, serial would be the same thing but higher voltages.
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by tyggerjai on Sat Jun 21, 2008 12:56 am

Atrum wrote:I want four buttons to control each LED so I can create other colors like purple, yellow and so on.

Right. I'd use potentiometers, myself, so that you can adjust the blend, rather than just having the colors on or off. You can do cute things with potentiometers and the analog pins on the Arduino, or just put the pot on the power to the pods.

If im running it in parallel Im already only using four pins and lower voltage, serial would be the same thing but higher voltages.


Right, I see. I thought you meant each pod independently run from the arduino. In that case, yeah, the Arduino will certainly do what you want - is, in fact, overkill. But overkill is good, leaves you room to expand in the future.

Fortunately, the ladyada arduino starter pack tutorials have an excellent run-through on controlling RGB LEDs with the Arduino, so you can dive right in - http://www.ladyada.net/learn/arduino/lesson3.html

jai.
.
tyggerjai
 
Posts: 35
Joined: Mon May 26, 2008 7:47 am

by mtbf0 on Sat Jun 21, 2008 8:22 am

Atrum wrote:I want four buttons to control each LED so I can create other colors like purple, yellow and so on.


let me know if you ever manage to make brown.
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

by Atrum on Sat Jun 21, 2008 5:39 pm

You could if you had more then 3 LEDs per pod, you need all of thoughts colors to make brown but if you turn all of them on it would make white. If I had a pot in there it would be alot easier.
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by Atrum on Mon Jun 23, 2008 2:44 pm

Does anyone know the maximum mAh output per pin of the Arduino is?

If its under 200 mA then would I need an external power source with a transistor to run the LEDs.

Oh BTW he LEDs I want to get are from superbrightleds.com the green and blue run the same voltage (3.3) and mA (30) while red only takes 2.0 volts and 30 mA. I already know I need different resistors for the BG and R channels but would I need different Transistors.

Also seeing as I have $20 to Amazon can anyone recommend a nice beginning electronics book.
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

by trialex on Mon Jun 23, 2008 7:52 pm

Atrum wrote:Does anyone know the maximum mAh output per pin of the Arduino is?


Yep, the data sheet for the AtMega168 does!

From memory it's 40mA per PIN, and 200mA for a PORT (i.e. the sum of the eight pins that make up the port, you can't output 40mA on all pins at the same time).

So 200mA per pin is out.
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

by Atrum on Tue Jun 24, 2008 12:24 am

Okay so I'll definitely need to use a transistor, question is though would I need to use a transistor per Channel or LED. Could I just hook up the Transistor to the pin and have it take its power from the +5 rail on the side.

Anyone know any decent electronic books?
Atrum
 
Posts: 13
Joined: Thu Jun 19, 2008 12:52 am

Please be positive and constructive with your questions and comments.