LED bar driver

Hi all I want to driver a pair of 20 block LEDs, each on a different analog task hopefully from the same arduino. Is a Max7221 suitable to drive each block?

Andy

Depends on how the block is wired internally. MAX7219/7221 expect to have groups of 8 LEDs with a common cathode per group, and the anodes from each group connected (As, Bs, Cs, etc) in common.

Do you have a link or a part number?

I intended to use Kingbright's DC-10SGWA stacked one over the other. One pair to do voltage up to 14v DC and the other pair current (DC) for my 4 wheeled crate. The current by voltage across a 0.01ohm shunt in a 12.5v(norm) 60A(max), that should give me 0.6v max across the shunt. The voltage take between a pair of 1Mohm resistors. LM3914's are the other option but I don't know how to make the arduino output in the 0-5v range or if PWM can accomplish that.

Andy

Is that similar to one of these? http://www.kingbrightusa.com/category.asp?catalog_name=LED&category_name=KCBar+Graph+Array&Page=1&orderby=

Yes, DC10EWA, 3rd one down

Ok, 10 discrete LEDs. Using 2, 20 discrete LEDs. Connect them up in groups of 8 with a common cathode, treat them as 3 digits with MAX7219. Bits of digit0 drive the first 8, digit1 the 2nd 8, digit2 the last 4.

Hi Andy.

For each block of 20 leds, do you want one led to light up indicating the reading? Or a line of leds? In other words if the reading is 75% of maximum, do you want just led #15 to light, or leds 1 to 15? If the answer is just one led, there is an easier way and you will not need the max7219/21. If the answer is 15 leds, it can still be done with a few transistors instead of the max7219/21, but it may be easier with the max7219/21.

Paul

PaulRB: Hi Andy.

For each block of 20 leds, do you want one led to light up indicating the reading? Or a line of leds? In other words if the reading is 75% of maximum, do you want just led #15 to light, or leds 1 to 15? If the answer is just one led, there is an easier way and you will not need the max7219/21. If the answer is 15 leds, it can still be done with a few transistors instead of the max7219/21, but it may be easier with the max7219/21.

Paul

Actually it appears space is going to limit me to only 1 block each side :(. I think 8 leds will give an easier read than a moving dot. The voltage will have to read only 10 to 15volt range

Andy

You could also consider using a 16x2 lcd display. These are cheap, easy to connect to Arduino and can display numbers as well as a bar graph. For example

http://www.electronicsblog.net/arduino-lcd-horizontal-progress-bar-using-custom-characters/

I'm trying to avoid LCD's or digital numbers as they look very out of place. A bar looks fine. Andy

Well, its your project. But I’m intrigued - why do lcds and digits look out of place but leds don’t?

If you are down to 2 x 10 led bars, max7219 seems overkill. I would drive directly with 10 digital outputs to drive the anodes of both bars, (via 10 ~330R series resistors) plus 2 digital outputs to drive 2 npn transistors (eg. Bc337, with ~4K7 base resistors) for the common cathodes.

As for measuring your voltage and current, use the Arduino’ internal voltage reference (1.024V on Uno but 2.048V on Lenonardo for example). You can directly measure the voltage across the shunt, and for the voltage, use a divider made from a 10K and 510R which should bring your 12V down to around 0.6V also.

Bob/anyone else, please critique by suggestions/schematic!

So let the Arduino multiplex the LEDs as a rising bar. That works too, as long as all the IO is available.
Could do it a 4 groups of 5 also, use 9 pins.

If pins are at a premium, it could be as low as 5 (see below).

But that’s getting a bit complicated for a beginner, and we don’t know if the other pins are needed for anything! Hence the original, simpler-to-understand-and-code version before.

Hi guys, I'm going to back track a bit and say that with some butchery I can indeed fit 20 segments high. But i think folks would appreciate 10 and 20 segment options. I guess i just don't like the look of LCD's.

Andy

OK, here’s 4 x 10 leds using 7 Arduino outputs.

Gonn have to explain the multiplexing going on there if you don’t mind.

…and with max7219/21

CrossRoads: Gonn have to explain the multiplexing going on there if you don't mind.

Charlieplexing ;)

I'm not seriously suggesting Andy chooses that design. With that many LEDs, max7219/21 would be easier. But I just wanted to show its possible.

The LEDs are organised into 7 groups of 6 (except that last group that has only 4). Each group's common anode is energised when one of the 7 Arduino outputs is set to OUTPUT/HIGH, switching on the NPN (which is wired as an emitter-follower so needs no base resistor). The cathodes of the group are wired to the other 6 Arduino outputs (via current limiting resistor). If these other 6 outputs are OUTPUT/LOW, the LED lights up. If they are INPUT, the LED does not light.

Multiplexing is achieved by setting each of the 7 Arduino outputs to OUTPUT/HIGH in turn for a short period, in each case having set up the other 6 as either OUTPUT/LOW or INPUT. Hence 1:7 multiplex ratio.

Andy, if you go with your original plan of using a max7219/21, you could replace the Arduino with an attiny85!

Thanks guys Starting work on the code, pcb and display surround. I will update as i progress.

Andy