PDA

View Full Version : One of 33 LED output Indicator



SOTASOTA
- 3rd December 2012, 23:53
I have 7 relays configured in binary fasion. They then represent 0-128 in digital.

I want to scan/read the state of the relays continuously light up a single LED to indicate the relative position on a 33 LED bargraph.

Example 1:

1) The relays that are ON represent say digital value of 128.
2) Light up only the 16th LED on the bargraph. This represents 100% of the output.

Example 2:

1) The relays that are ON represent say digital value of 64.
2) Light up only the 33rd LED on the bargraph. This represents approximately 50% of the output.

Example 3:

1) The relays that are ON represent say digital value of 5.
2) Light up only the 1st LED on the bargraph. This represents approximately 4% of the output.

Would like to use 16F628a or another better choice?

Since only one LED is lit, the current draw is limited to 10mA when turning ON any of the 33 LEDs.

Any suggestions?

Thanks for you help!
Russ :)

Ioannis
- 4th December 2012, 10:06
Since 628 has not enough outputs, maybe a serial to parallel chip will help you. Say a 5 x 4094 (total 40 outputs).

You feed serially the data to the SIPO (serial in - parallel out) and directly drive your LEDs.

As for the software I see no other solution that Lookup table. Maybe others come up with another idea.

Ioannis

HenrikOlsson
- 4th December 2012, 11:17
Shiftregisters are probaby the easiest/quickest way. There are dedicated constant current LED driver chips with serial input available (like the classic MAX7219 or perhaps TLC59282 (just one that I found now)). Or you might want to look into Charlieplexing. I think you might have just enough pins on the '628 to do it.

Sidenote: For 7 bits the range i 0-127, not 0-128.

/Henrik.

Mike, K8LH
- 4th December 2012, 16:07
I agree with Henrik. You could Charlieplex 30 LEDs using six pins or up to 42 LEDs using seven pins. Or add a 74HC595 or a driver IC and multiplex the LEDs. Here's a multiplexed example for 32 LEDs that only requires five pins using my MacMux interface method (below).

Happy Holidays and cheerful regards, Mike

SOTASOTA
- 4th December 2012, 20:47
Thanks for all your replies!! I think my best bet is a serial programmable chip like the MAX7219 or even the AMS AS1116 (http://www.ams.com/eng/Products/Lighting-Management/LED-Driver-ICs/AS1116)

The AMS AS1116 is much less expensive than the MAX7219/7221.

OK, now I have never programmed these types of IC's. These ICs use an "SPI" interface?

Any coding examples for this for turning ON/OFF any one of the 64 LEDs?

Thanks!!
Russ :)

mackrackit
- 5th December 2012, 01:36
You could go old school
http://www.picbasic.co.uk/forum/showthread.php?t=10200&highlight=smart+star

SOTASOTA
- 5th December 2012, 17:26
I know zip about using ShiftOut and cascading 74HC595 shift registers. I do not understand how to program a cascaded 74HC595's.
Even looking at that code:
http://www.picbasic.co.uk/forum/show...ght=smart+star
I do not really understand what is going on line-by-line.

Any primers or tutorials on this?? I think using 74HC595 shift registersn would solve my issues.
Help!
Thanks!!