Subscribe to EDN
RSS
Reprints/License
Print
Email

Microcontroller drives logarithmic/linear dot/bar 20-LED display

Do-it-yourself analog-to-LM3914 display driver offers user programmability.

Dhananjay V Gadre and Anurag Chugh, Netaji Subhas Institute of Technology, New Delhi, India; Edited by Brad Thompson and Fran Granville -- EDN, January 18, 2007

This application required more flexibility than the LM3914 offers, and it uses a circuit based on an Atmel AVR-family ATTiny13 microcontroller, which features 1 kbyte of program memory; a four-channel, 10-bit ADC; and six general-purpose I/O pins. Altering the circuit's firmware allows linear or logarithmic scaling of the 0 to 5V input-voltage range.

The circuit in Figure 1 continuously displays the input voltage in 20 levels. When closed, switch S1 freezes the displayed reading at its then-current level. Five of the microcontroller's six I/O pins control all 20 LEDs and the switch. Configured as an ADC-input channel, the remaining I/O pin receives the analog-input voltage. The microcontroller uses Charlieplexing, a method of using I/O lines to drive as many as N×(N–1) LEDs, to drive 20 LEDs with only five I/O pins (references 2 through 4).

The firmware is written in C and compiled using AVR-GCC, a freeware C compiler and assembler available in Windows and Linux versions. It uses the Tiny13's internal 10-bit ADC operating in free-running, interrupt-driven mode to convert the analog-input voltage into a digital number. Upon completion of each conversion, the ADC generates an interrupt that a subroutine reads; the interrupt stores the ADC's converted output in a shared variable.

To provide a flicker-free display, an internal timer generates a 1875-Hz interrupt derived from the 9.6-MHz system clock to drive the multiplexed LEDs at a rate exceeding 90 Hz. Dividing the ADC count by a constant yields a linear display of the input voltage. A look-up table scales the ADC count to produce a logarithmic display. Figure 2 shows the logarithmic-conversion curve that defines the look-up table's values. Versions of the ATTiny13's control programs for linear and logarithmic scales are available for downloading from this Design Idea. You can modify the source code to display only a particular subrange of the input voltage of 0 to 5V. For example, you can specify a linear-display range spanning 1 to 3V or a logarithmic scale for input voltages of 2 to 3V.


References
  1. LM3914 data sheet.

  2. Lancaster, Don, "Tech Musings," August 2001.

  3. "Charlieplexing: Reduced Pin-Count LED Multiplexing," Maxim Application Note 1880, Feb 10, 2003.

  4. Benabadji, Noureddine, "PIC microprocessor drives 20-LED dot- or bar-graph display,"EDN, Sept 1, 2006, pg 71.

RSS
Reprints/License
Print
Email
Talkback
Canon Resource Center

Featured Company


Most Recent Resources

Advertisement
Related Content

No related content found.

  • 0 rated items found.
Advertisement

KNOWLEDGE CENTER

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
Engineering Careers
Jobs sponsored by
Advertisement
About EDN   |   Site Map   |   Contact Us   |   Subscription   |   RSS
© 2011 UBM Electronics. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other UBM Canon sites

UBM Canon | Design News | Test & Measurement World | Packaging Digest | EDN | Qmed | Pharmalive | Appliance Magazine | Plastics Today | Powder Bulk Solids | Canon Trade Shows