Go Down

Topic: Controlling/Strobing 60 LED'S (Read 4 times) previous topic - next topic

Silent

I just ordered my Arduino Uno last night and a ProtoShield kit from Sparkfun. I'm somewhat new to electronics, I have a very basic understanding of things.

I want to use my Arduino Uno to control 60 LED's two sets of 30 LED's, which may be divided up even more technically I suppose using resistors and whatnot.
What all do I need to be able to do this? These are the LED's I probably am going to use: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=170684504389

Essentially, I'm trying to do this, but with my own patterns and whatnot: http://www.youtube.com/watch?v=9IaH4rT9yUc

johnwasser

Do you know what voltage you are going to use to drive them?

You can put LED's in series as long as the sum of the voltage drops (Forward Voltage) is less than the power supply voltage.  Since these seem to have about a 3V drop you can't put them in series if you are driving them with 5V but can put 3 in series if you drive them with 12V.

Each set of series LED's needs a current limiting resistor.  You figure out the resistance by taking the supply voltage, subtracting the  voltage drop of the LED (sum of the voltage drops if LED's are in series) and dividing that voltage by the current (20 mA in your case) to get ohms.

5V - 3V = 2V,  2V / 0.020 A = 100 Ohms
12V - (3V+3V+3V) = 3V,  3V / 0.020 A = 150 Ohms
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Silent

How would I be able to drive them with 12 with an Arduino? I had someone else mention using a TLC5940 chip.

johnwasser

The TLC5940 is a chip that lets you individually control the brightness of 16 LED's.  If you are treating them as groups of 30, like in the video, there is no need for individual brightness control.

You can use the Arduino's 5V outputs to control 12v with an NPN transistor or N-channel MOSFET.  The transistor acts as a switch between the 12v circuit and ground.

With a 12V supply you could wire the LED's in series in sets of three.  Then you connect a 150 Ohm resistor to one end of each set (doesn't matter if it's at the + end or the - end).  Connect the + (anode) end of all 20 sets (60 LED's) to the +12V supply.  Hook the - (cathode) end of 10 sets to the Collector of each of the two transistors (or Source of eavh of two MOSFETS).  Connect the Emitter of both transistors (Drain of MOSFETS) to the 12V Ground and the Arduino Ground.  Connect the Arduino output pins through resistors to the Base of each transistor (or directly to the Gate of the MOSFETS).

MOSFETS are easy and can handle a lot of current but be sure to use a "Logic Level" MOSFET which turns on fully at 5V (most are designed to turn on fully only when you connect 10v to the Gate).
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Silent

Would this be the appropriate MOSFET to use? http://www.sparkfun.com/products/10213

johnwasser

I'm pretty sure that will be more than adequate.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Silent

How would I get the 12 volts? In the end this will be powered by a 12 volt cigarette plugin in the car. Is there something to use to split the power before it feeds into the arduino or how exactly would that work?

marklar

You can get a 1.2 amp 5v USB car charger.  I just used 4 of those to run 70 RGBs and it works fine. 

It is important that you don't just use any 5v charger, find one with at least 1200ma (1.2 amps) or use multiples.

I used old USB cables and splice into the red / black wires.  It is important to NOT assume the colors are correct, I see the black and red reversed at times so be sure to test.  Also the chargers are sensitive to reverse polarity .. so assure you now the 12v +/- before you plug that in as well. 

Silent

Okay, I designed a schematic in Eagle. This is my first schematic I've ever drawn so it probably looks pretty crappy. Does this look correct?


Silent

Also the LED's I already have at home are a bit different, using the formula you gave me I got 60 ohm's but I don't see any 60 ohm resistors at Radio Shack.

12V - (3.4V+3.4V+3.4V) = 1.8V,  1.8V / 0.030 A = 60 ohms http://www.ebay.com/itm/100pcs-5mm-8000mcd-Blue-Ultra-Bright-LED-Light-Lamp-DIY-/160652113499?pt=LH_DefaultDomain_0&hash=item25679cb65b

marklar

If you are going to run this directly from your auto 12v you should consider using some type of regulating device such as the 5v type due to the fact that 12v in your lighter is not normally a perfectly regulated 12v (to say the least - see below). 

http://en.wikipedia.org/wiki/Cigarette_lighter_receptacle
Quote
A second problem is that nominally "Twelve-Volt" power in cars fluctuates widely. The actual voltage will be approximately 12.5 volts when dormant, (less when cold) approximately 14.5 volts when the engine and the alternator/generator are operating, (more when cold) and may briefly drop as low as 5-6 volts during engine start.[7] DC/DC converters will usually compensate for these small fluctuations.[citation needed]


For that reason I would suggest just going with the new standard - which is 5v for iPods and such .. this also works perfect for powering the arduino.  Then just use the correct resistor for 5v - 1 per LED.  If you don't go with 5v, I would still suggest using a dc/dc regulator  your 12v auto power.

Silent

Okay, I should be good for using a 12V DC 1800mA wall adapter for testing, but for the final project I need a car adapter with a built in DC regulator. Any idea if my schematic is correct?

dc42

Your schematic shows an NPN transistor, not a mosfet. The connections you need to the mosfet are:

Source to ground
Gate to the Arduino output pin through a 150 ohm resistor
Drain to the led/resistor networks

Do you intend that the leds will be mostly operating when the car engine is running? If so, a separate voltage regulator is overkill, because the car regulator will do a good job anyway (although the LEDs may dim a little when the engine is idling). The voltage will be about 13.5 volts. The Arduino can be driven from the 13.5v through the barrel jack, provided you are not drawing much current from the +5v line.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Silent

#13
Sep 23, 2011, 09:20 pm Last Edit: Sep 23, 2011, 09:35 pm by Silent Reason: 1
I decided to start with something a bit smaller first. So instead of 60 LED's, only having a total of 12 LED's with their own resistors where I can use 5V from arduino.  Check out this schematic and see if it's correct. Using these LED's: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=160652113499 I came up with these calculations 5V - (3.4V) = 1.6V,  1.6V / 0.030 A = 53.33 ohms, so I think I would use a resistor close to 53 ohms, correct?


dc42

Your calculation for the resistor value is correct if you want to run the LEDs at maximum current, although it doesn't allow for any voltage drop at the Arduino pin. However, the absolute maximum current that you may source or sink from an Arduino pin is 40mA, and it is better to limit the continuous current to 20mA. So you can drive at most one of those LEDs directly per output pin. There is also a total limit of 200mA for the chip as a whole. To drive more LEDs, you need a transistor or mosfet.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up