atmega8 VA meter final

Atmega8 based Voltmeter Ampmeter v2

This is V2 update of Atmega8 Volt-Ammeter. This new version features the following upgrades,

  • Low power consumption
  • Better Amperes display resolution while using low value drop resistor.
  • Much smaller PCB size, only 5cm x 5cm. Still no SMD components.
  • Easy calibration, only one voltage adjust and one ampere adjust preset, no voltage out detection.
 Atmega8 based Voltmeter Ammeter v2 used Component List:
1x Atmega8L/Atmega8A Pre-Programmed microcontroller (PDIP)
1x 1×16 LCD with Green/Blue Backlight
1x Custom PCB (5cm x 5xm)
1x LM7805 5V Voltage Regulator
2x 22uF 50V Electrolytic polarized capacitor
1x 100kpF Ceramic Capacitor
2x 10K Multiturn Trimmer Potentiometer in 3268 package
1x 10K 1/4watt Metal Film Resistor +-5% (brown, black, orange, golden)
2x 1K 1/4watt Metal Film Resistor +-5% (brown, black, red, golden)
1x 0.1~0.5Ohm / 3W Power Resistor
1x 1×16 and 1x 1×6 female pin header for LCD and ISP
  Voltmeter Ammeter v2 Technical Specifications:
Voltage Supply: 6V – 30V
Current Consumption: ~ 30mA with LCD backlight
Voltage Input: 6-30V
Voltage Resolution: 50mV
Current Input: 0-5A
Current Resolution: 100mA

Schematics diagram

Board Top

Board Bottom

Assembled PCB

Voltage supplied by my 12Volt benchtop PSU(The resistor at output terminal is disconnected)

The 10Ohm resistance is connected and is burning :P. Voltage dropped to 8.75~8.80V and hence Amperes would be 0.875~0.88Amps and it is displayed here as 0.90Amps. It’s perfect as the meter is having 100mA resolution.

Callibration and usage:

  • Connect a 5V DC supply to the voltage input. And short pin 1 and pin 3 of the LM7805 regulator.
  • Now tune the rightmost preset to show 5.00V on the LCD.
  • Now connect any real power supply of say 12volts. Connect a load at output, say a auto lamp, Measure current with multimeter, or calculate Amperes, and then tune the 2nd rightmost preset to show that reading of Amperes on LCD.

Software is written in WinAVR and Peter’s LCD library is used.The code below,

#include <avr/io.h>
#include “lcd.h”
#include <util/delay.h>
void InitADC()
{
ADMUX=(1<<REFS0);                         // For Aref=AVcc;
ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); //Prescalar div factor =128
}
uint16_t ReadADC(uint8_t ch)
{
ch=ch&0b00000111;
ADMUX|=ch;
ADCSRA|=(1<<ADSC);
while(!(ADCSRA & (1<<ADIF)));
ADCSRA|=(1<<ADIF);
return(ADC);
}
void print(uint16_t parameter)
{
parameter%=10000;
lcd_putc((parameter/1000)+48);
parameter%=1000;
lcd_putc((parameter/100)+48);
parameter%=100;
lcd_puts(“.”);
lcd_putc((parameter/10)+48);
lcd_putc((parameter%10)+48);
}
void main()
{
int adc;
while(1)
{
lcd_init(LCD_DISP_ON);
lcd_clrscr();
lcd_gotoxy(0,0);
lcd_puts(“Volts”);
lcd_gotoxy(8,0);
lcd_puts(“Amperes”);
lcd_gotoxy(0,1);
InitADC();
adc=ReadADC(0);
print(adc*5);
lcd_puts(“V”);
InitADC();
adc=ReadADC(1);
lcd_gotoxy(8,1);
print(adc*10);
lcd_puts(“A”);
_delay_ms(100);
}
}

Downloads:

Eagle filesProject Package

UPDATE:- The previously uploaded compiled HEX file had some problems. Use this hex file with fuse settings.

-U lfuse:w:0xe1:m -U hfuse:w:0xd9:m

88 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.