Ceska verze

The simplest digital LCD voltmeter with AVR

    This is probably the simplest possible digital voltmeter with Atmel AVR microcontroller and LCD display. The circuit is controlled by a microprocessor IO1 - AVR Atmel ATmega16A, ATmega16L, ATmega16, ATmega32A, ATmega32L or ATmega32. Below is a program to download for free and configuration bits setting printscreen. The three digit seven segment LCD display is used to display the voltage value. I used the LCD3.0-13 type. The display is driven by a rectangular AC voltage at a frequency of about 50Hz. Active segments are connected to a voltage in-phase with a common electrode or so called backplane (BP). Inactive segments are connected to a voltage in phase with the common electrode. The circuit uses single ended 10-bit AD converter of the AVR. The output value is in range of 0 to 1023. As is not worth adding a fourth digit for the narrow range of 1000 - 1023, the range is limited to 0 - 999. When the input voltage is out of range, the display shows a symbol "- - -". The scale corresponds to an input voltage of 2.5 V. The input divider of R9, R10 and P1 decreases the voltage by 4, providing a 10V range with a resolution of 0.01 V. The input impedance is about 1M. (If you require a 100V range, replace R10 to 9M1 and P1 2M2. Then you'll get 100V range with a resolution of 0.1 V and an input impedance of around 10M.) Calibrate the voltmeter using P1 while a known voltage is connected. Select the decimal point as needed (1h or 2h). The selected point connect to pin 29 (PC7). Unused point should be connected to pin 21 (PD7) and thus to BP, so there's no voltage respect to BP (do not let the point "in free air"). Refresh rate of the voltmeter is about 4Hz. IO1 uses an internal RC oscillator set to 1MHz. The circuit is powered from a supply of about 3 - 5V for ATmega16A / ATmega32A / ATmega16L / ATmega32L or 4.5 - 5V for ATmega16 / ATmega32 (according to my experiments ATmega32 operates at 3V too, but it is not guaranteed by the datasheet). Current consumption at 3V is about 0.2 to 0.4 mA and at 5V it is about 2-4 mA. The voltmeter can be useful as an improvement for a lab power supply, vehicle board voltage indicator, the PC power supply voltage meter, UPS battery voltage meter, etc. The supply voltage can be obtained using a simple power supply using for exampe the 7805, LM317 or a zener diode. Put the proper fuse at the power input.
The program for free download:
source code in assembler (ASM) for ATmega16(A/L)
source code in assembler (ASM) for ATmega32(A/L)
compiled HEX file for ATmega16(A/L) (284 Bytes)
compiled HEX file for ATmega32(A/L) (284 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


Schematic diagram of the simplest digital voltmeter with LCD and AVR ATmega16(A)(L) / ATmega32(A)(L).


Setting of the configuration bits. (same for ATmega16(A)(L) and ATmega32(A)(L))


Testing the voltmeter with ATmega16A. At right you can see another LCD3.0-13 display from bottom side.


Video - testing the simple LCD AVR voltmeter.



Added: 21. 8. 2012
home