So very confused... Help please?

Ok, so im a code guy normally, this is my first venture into hardware / electronics, and i basically couldn't be more confused.

I'm looking to wire up 13 row of 6 LED in parallel so all 6 in the row come on when i send command to the pin on a Duemilanove. I'm also looking to have two push buttons for control / input. I dont seem to be getting anywhere with this.

If anyone is feeling bored or particularly helpful, some idea of how to wire this up would be greatly appreciated!

Start with a drawing and post that and then we can comment on it, otherwise it's hard to start from a blank page.

Lefty

Is along the lines of what i was thinking so far? No idea on the switches..

~Shepy

Good drawing. First you can't wire LEDs like that in parallel as they won't share current evenly. What you will need is a resistor in series with every LED, 500 ohm should work ok, limiting current to under 20ma through each LED or so and you then can eliminate that one resistor you have shown.

Next six LEDs drawing 20ma each is 120ma of current which is more then the 40ma max you can safely draw from an Arduino output pin, so each Arduion output pin will need to wire to say a 500 ohm resistor and then to the base on a NPN transistor, the emitter wires to ground and the collector wires to the 6 led common cathode connection. A 2N2222 transistor is a common one that should work OK. So you will need 12 transistors, one for each row to be driven.

Switch inputs are pretty simple. Program the Arduino I/O pin to be a input pin and enable the software pull-up option. Then wire a normally open switch from the Iinput pin and ground. In your software a zero input value will mean the switch is actively being pressed and a one will mean it's off.

By the way you can use the analog input pins as digital pins by referring to them as digital pins 14 through 19, so they can be used for your switches.

Also note that because you are using the Vin pin for the LED power (9vdc you have in your drawing) the LEDs won't operate if and when you are powering your board with only the USB connector. It's OK to have both external power (9vdc) and USB plugged in at the same time, but just wanted you to be aware that the LEDs won't light if the external power, 9vdc, is removed.

Also note that if you plan on turning on all 12 rows at any one time you would be drawing more current then the external power circuit is designed to handle. Six or seven rows at one time or less should be OK though.

That enough to get you started?

Lefty

To add to what Lefty said:

Good drawing. You are using the Arduino pins to power the LED's. They can drive LED's, but can also be used as switches. So you can power your LED's from some other source, and control them (switch them on and off) using the Arduino pins. This way you need very little current from the Arduino - just enough to signal.

In rigging up a layout with the number of LED's you have, my preference would be to use this method. Fortunately, there is a device to do this, a TIP 120 Darlington array, which is basically a switch. Lots of places sell them, including Jameco (www.jameco.com) for $0.35 each, part number 32993.

Here is a page on how they work: http://ctheds.wordpress.com/2007/10/30/tip-120/ (I just googled it - there may be better ones out there). It also links to some sample code.

Some other thoughts/guidelines: - I don't like to wire diodes in parallel like you have in your drawing. They behave annoyingly. - You can also get darlingtons as arrays, with lots of them (4, 8, or more) in a DIP package. I think the part number is ULNxxxx. - Darlingtons work up to 60v, so can drive lots of stuff, not just LED's. They are very useful. - You need a current limiting resistor on EACH LED, not just one on the end.

I was planning on using the giant LED which Maplin sell, which is comprised of 6xLED in a diffused housing, hence needing the 6 per row. But i've since found this:

http://www.rapidonline.com/productinfo.aspx?tier1URL=Electronic-Components&tier2URL=Optoelectronics&tier3URL=LED-Clusters&tier4URL=High-intensity-20mm-LED&moduleno=64875&kw=20mm+led#techspec

Can i use the 2pin version of those, each with a resistor, and just wire from a digital pin -> 1K resistor -> LED -> Ground. as each only draws 30ma in the 2pin configuration ? With 13 of those wired up ?

Can i use the 2pin version of those, each with a resistor, and just wire from a digital pin -> 1K resistor -> LED -> Ground. as each only draws 30ma in the 2pin configuration ? With 13 of those wired up ?

Note as wired as you only get 5vdc output high voltage from a Arduino digital output pin and the spec sheet for that LED shows that the typical forward voltage drop across the LED is 6vdc (Vf in spec sheet).

However if you turn the LEDs polarity around and wire the common power to the Arduino Vin pin then it can be made to work. Resistors value would have to be recalculated to be (Vin - Vf) / .030, so (9-6/.030) 100 ohms assuming your Vin voltage is 9vdc.

That make sense?

So if i understand it correctly, it should be like this, with 100ohm resistors:

So if i understand it correctly, it should be like this, with 100ohm resistors:

I think you still might need transistor switches between the Arduino output pins and each LED assembly. As shown when a digital output pin is LOW the proper current will flow and the LED will light. But when the digital output pin is high then there will be 5vdc on one side of an LED and 9vdc on the other side, no current should flow as that is below the 6vdc forward voltage drop of the LED (9-5=4) but I’m not sure it would be safe if somehow 9vdc was seen by an output pin. I would want first to breadboard it to test it but it could work OK and not risk any damage to an Arduino output pin wired like that.

Anyone else think this would work OK as drawn? I think it might be OK.

Lefty

You definitely need the drive transistors - amongst other things, the ESD protection diodes on the pins will forward-bias, and draw current - maybe not enough to light/fully light the LEDs, but enough to damage the parts, AND to drive the pin above VCC, likely damaging the part/MCU. When driving almost anything more than a single LED, best to buffer. reply and/or email me if you need a diagram.

Ok, so if i understand using the TIP120s correctly, its going to be like this:

That will work for sure. Due to the inversion of the transistors, with this setup a HIGH on a digital output will turn on the LEDs and a LOW will turn them off.

Good luck

Lefty

Ok, should be final question on it then i can get parts ordered / build / code it.

Will a 6xAA adapter be able to power both LED and board, as i dont want to have to have this plugged into a computer / usb lead permanently ?

Thanks for all your help though everyone, you've been tremendous, would have probably given up without even trying without it !

Yep, will work. Minor nit: you could increase the 1K resistors to 10K, easily (worst-case design), or likely 100K, as the current gain of the transistors is specified at 1000 - reduce the current drain (and heat) on the IO's.

Note these TIP120's are WAY WAY overkill for this purpose - they're more for 5A (5000mA) designs, and these LED's only need 20 - 25mA. Simple 2n3704's (TO-92 package) are more than sufficient - 500mA max current, DC gain of 100, so the base/drive resistors would be more like 15K. smaller, lighter, easier, cheaper,etc., etc.

Tracy Hall Lead Dreamer Dreams and Logic

Yeah, the pack will drive it - 13 LED strings x 25mA each, plus the Arduino for another 20mA, so about 350mA total - but note that the AA’s have a capacity of about 2200mAH (milliamp-hours), so they’ll run about 6 hours max - but will dim considerably by the end of life - more like 3 hours useful.

Tracy Hall
Lead Dreamer
Dreams and Logic

Ok, in that case, can anyone recommend a UK supplied power pack to drive this lot instead of the 6xAA adapter?

Will this one be ok:

2.5mm plug, 9v, centre positive, 1200ma

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=180377703915&indexURL=#ebayphotohosting

~Shepy