- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
LED Bar Graph -- with the MAX7219
So far we've managed to drive an LED bar graph with ten port pins, and then got the wiring down to four pins in the previous exercise. How about three?
I've always gotten a kick out of doing non-standard things with chips, things the manufacturer never really had in mind. Here's a simple example of that perverse bent.
The MAX7219 was designed primarily to drive 7-segment displays. In fact, it does a great job of handling an eight-digit array of 7-segment LED devices. What's cool is that all of the beefy current drivers are included (no need for buffers or Darlington transistors) and that the multiplexing is handled internally. Best of all, the MAX7219 can be put through its paces via a paltry three control lines.
Thinking about all this the other day, it occurred to me: the chip could in fact rather elegantly be used to drive a ten-element LED bar graph. Just consider the bar graph unit to to be divided into two five-segment portions. The bottom five bars are magically multiplexed with the top five bars. Slick! And only three control lines needed. Moreover, if you really wanted, this could be extended to forty bars (eight 5-segment displays, if you will). Here's the schematic:
Let me emphasize the advantages here. First off, bar graphs can be current hungry, but the MAX7219 has plenty of oomph to supply the juice. Then, that chip also takes care of all the multiplexing, freeing up the PIC for more profitable enterprises. Finally, only three port lines from the PIC are required for all this activity. I urge you to look over the source code and see just how simple the software actually is.
Click to get the source code.
Click to get the schematic PDF.
Next Project: LED Bar Graph -- One Line