Go Down

Topic: Awesome LED Thing (Read 4894 times) previous topic - next topic

bilbo

Mar 03, 2010, 12:42 am Last Edit: Mar 03, 2010, 12:45 am by bilbo Reason: 1
Hi all!
I am making an arduino project where i have 36 leds mounted in concentric circles on foamboard, two per arduino pin (see schematic). I am designing something where the user selects one led, and then all the led's directly surrounding it turn on, and then all the leds around all of those turn on...and so forth...
My question is, how does my schematic and my pseudocode look?
Thanks!
Code: [Select]

while(i<36,i++)
void ledOn(led)
pinwrite(led, HIGH);
ledOn(led+1)
ledOn(led-1)
ledOn(led+10)
ledOn(led-10)


westfw

The schematic as drawn will not give you the ability to light only a single LED.  And the LEDs will get dimmer as you light more of them (since the total current is fixed by the single resistor. (although you could probably change this given a suitable multiplexing scheme.))

1.5K is pretty high for an LED current-limiting resistor.

Having two LEDs in series may not work with newer green/blue/white LEDs; they tend to want 3V+ each.

The code so far is VERY "pseudo."  It's hard to say much about it.  You don't have any place that turns the LEDs off...


bilbo

Ok, so to reply to all of your questions, i intend to light each two leds connected in series at a time, will this setup function that way? If i remove the 1.5k resistor and replace it with an 100ohm resistor at each arduino pin, i believe this would work better. Am I correct?

As for the code, I do not wish to turn the leds off, the will turn on until the entire grid is full, at which point the program will move on out of the loop. I do not know much about recursive functions on the arduino, will this work?

Thanks so much!

retrolefty

#3
Mar 03, 2010, 01:23 am Last Edit: Mar 03, 2010, 01:25 am by retrolefty Reason: 1
Couple of problems with the schematic. The use of just one current limiting resistor of 1.5K means when you turn on just one of the output pins only 1ma of current will flow through the two series LEDs and will be very dim (assuming standard red leds here). And it will continue to dim even more as you turn on additional output pins. There should be no resistor on the shared cathode side of all the LEDs, just wired them straight to ground. Then a 100 ohm resistor should be wired from every output pin to it's two series connected LED, allowing the standard 20ma of current to flow through each LED string.

That leads to the second problem. While each digital output pin can supply up to 40ma without damage, there is also a total current consumption limit for the combined current drawn from all pins of 200ma. If the 100 ohm resistor limits current to 20 ma to each output pin, your 18 outputs will be supplying 20maX18 = 360ma, over the 200ma total if you turn on all the output pins.

So better to make all the 100ohm resistors 200 ohms to limit each output pin to 10ma and that will keep the total consumption to 180ma if all are turned on. The brightness of LEDs at 10ma is really not that less then when running them at 20ma.

Good luck

Lefty

bilbo

But wouldn't it actually only be giving 5ma per led? Would this make it too dim? Does this mean i will have to make them externally powered and controlled w/ transistors?

RanTalbott

Quote
But wouldn't it actually only be giving 5ma per led? Would this make it too dim?


This will depend heavily on what LEDs you use.  Some will be okay with 5mA,  some will not.

You may want to make friends with the ULN2003:  7 transistors in a DIP package,  cheap to buy and easy to use.  If your LED strings all wind up need the same resistor value,  you can also simplify your building by using DIP resistor packs.

When picking your resistor values,  note that the output of the ULN2003 will actually be at about .7V,  not ground,  when sinking 20mA from your LEDs.

retrolefty

#6
Mar 03, 2010, 02:47 am Last Edit: Mar 03, 2010, 02:49 am by retrolefty Reason: 1
Quote
But wouldn't it actually only be giving 5ma per led? Would this make it too dim? Does this mean i will have to make them externally powered and controlled w/ transistors?


No, you would have 10ma flowing through each pair of series connected LEDs. The law of current flow in a series circuit is that it's the same anywhere in the circuit. If 10ma flows through one of the LEDs, the same current is also following through the other.

10ma will be plenty bright, esp with the new bright LEDs avalible today.

Adding switching transistors or IC drivers and using external +5vdc would allow you to drive all the LEDs at 20ma with the proper sized resistors, but I don't think it would justify the added cost and space required if you are just limiting the number of LEDs to what you are showing on your drawing.

Lefty

bilbo

Youre right! Wow, i had a "should've had a v8" moment there!  ;D

As for the physical construction, i was thinking of placing these leds in foamboard with the back covered in tin foil. Then, i bend all the led ground legs so that they are attatched to the tin foil, and then alligator clip the corner of the foil to GND. What do you think?

Also, can anyone reccomend some code for what i am trying to accomplish?
Thanks so much!

retrolefty

Quote
As for the physical construction, i was thinking of placing these leds in foamboard with the back covered in tin foil. Then, i bend all the led ground legs so that they are attatched to the tin foil, and then alligator clip the corner of the foil to GND. What do you think?


That would never work. Tin foil is aluminum which forms a oxide and can't be soldered to reliably. It would not be reliable electrically or mechanically. If you can get some thin copper sheet that would be much better as you could make a good solder connection.

As far as coding, that's really a little hard as only you know the pattern and timing you are trying to obtain. Why don't you first just write a simple sketch that turns on and off all the LED's when you press a push button on or off. That way you can test out all your LEDs for functionality and brightness and then later work on more complex program.

Lefty

bilbo

You don't think that would work? I have had good experience with the conductivity of aluminum foil in the past. i actually just went and tested it with my homemade o-scope (arduino of course) and the conductivity is fairly stable. In the interest of time and temporary-ness, i am trying to avoid soldering.

retrolefty

Quote
i am trying to avoid soldering.


Well doesn't hurt to experiment, but I would still recommend soldering with wire or to copper foil.

Lefty

Grumpy_Mike

Quote
and the conductivity is fairly stable


Yes but over the course of say a month the foil will become less reliable.
Remember the "instruments" that "kraft work" used, all covered in foil. This had to be refreshed for each gig they played.

Learn to love solder.

saw0

I also would solder, i don't think foil will be reliable at all. But that's up to you ;)

/offtopic

Quote
Remember the "instruments" that "kraft work" used, all covered in foil. This had to be refreshed for each gig they played.


they are called "kraftwerk", which is german for "powerplant" ;) gotta love em :D


Grumpy_Mike

Quote
they are called "kraftwerk"


Yes spelling isn't my strong point.
My son got to run one member of the group to Manchester airport about three years ago. He was helping out as part of Manchester's Future Sonic festival. This year it is branching out and being called Future Everything.

bilbo

Alright everyone! Thank you so much for all of your advice, it worked perfectly for my purposes!

Go Up