Using a weird surplus LED bar graph

The photo I posted in my previous post of a home made project box for a future QRP transceiver project showed what looked like a bar graph meter above the LCD frequency readout.  Most of the common LED bar graph displays have 10 vertical rectangle segments and can be driven by a the popular LM3914 series chips.  These parts can handle such displays directly and are available in linear, log, and VU processing versions of the signal to display.  They can also be expanded by cascading additional drivers and displays to up to 100 segments of common anode displays.

Buried in my junkbox were several Toshiba GL-112T9 LED displays that I got for a few bucks at a past ham flea market.  These are 12 segment displays with horizontal rectangular segments.  There are four green, four yellow and four red segments.  They are not common anode displays however.  Two of the green LEDs and two of the red LEDs are wired in series with a connection to both ends and the common middle.  The four yellow LEDs are wired in two series connected groups.  The end result is that the display has only 20 pins instead of the 24 that would otherwise be required.  Needless to say that this makes it incompatible with the LM3914 drivers.

The obvious solution to the problem (if I wanted to use these bargain bar graph displays) was to make a custom driver using a micro controller such as the Arduino.  I designed such a driver using an atmega16 chip in a 40 pin dip package.  This part is overkill, the required code will fit in only 4K of flash and only 13 I/O lines are required (one being an analog input), so an atmega48 would work fine.  However, I already had several of the atmega16’s in the junkbox, so that’s what I used.

BargraphHere you can see the result.  There are 12 current limiting resistors, and 4 diodes.  The micro controller lights from 1 to 12 of the LED’s depending on the voltage input to the A/D converter.  When both of a pair of series connected diodes are to be driven, only one of the two lines are pulled low.  The common line to the two LEDs is driven through a diode to prevent back flow from the micro controller which outputs a high level (5v) when a segment is off (the anodes of the display all go to +5 volts).

Here is a link to the code:  Bargraph (Github).
The code is licensed under the GPL v3.0, so you can make free use of it for your own projects under the terms of that license.  If you want to port it to a smaller AVR controller the only thing that will possibly need to be done is to modify the some of the register and/or bit names as Atmel has moved things around from the older atmega16 to the atmega48, atmega88, atmega168, and atmega328 processors (the ones used in the Arduino).

To keep things quiet (from an RF point of view) the processor is put to sleep while the A/D converter is running.  The converter is put into the auto-run mode, so it does not have to be restarted after finishing each conversion.  The A/D converter interrupts the CPU after each conversion, which wakes the CPU up from sleep.  At this point the result of the A/D reading is converted into a bar graph display, and the correct LED’s are driven.  The CPU then goes back to sleep, waiting for the next display cycle.
I used the atmega16’s built in 1 mhz RC clock, it’s more than fast enough for this application, the slower speed clock makes less rf noise, and it eliminates the cost of a crystal.

The nice thing about this approach is that I can modify the processing of the input signal to display in linear voltage, “S” units, Log or Vu scales.  There are unused I/O pins so I can even have the processor switch display modes on the fly by adding code to monitor the extra pins, using them as a function switch.  Right now the display is purely linear.  The LED’s light up from green, to yellow, to red, but you could wire the bar graph up in the other direction if you think that makes more sense for your application.

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s