Digital voltmeter using 89c51 microcontroller

13
DIGITAL VOLTMETER USING 89C51 MICROCONTROLLER Guide, Prof. S. A. Karmude By, Saylee S. Joshi

Transcript of Digital voltmeter using 89c51 microcontroller

Page 1: Digital voltmeter using 89c51 microcontroller

DIGITAL VOLTMETER USING 89C51 MICROCONTROLLER

Guide,Prof. S. A. Karmude

By,Saylee S. Joshi

Page 2: Digital voltmeter using 89c51 microcontroller

INTRODUCTION• Voltmeter is a voltage measuring instrument. • We can measure the potential difference between any two

points in an electrical network using voltmeter. • There are two types of voltmeter as analog voltmeter and

digital voltmeter. • Analog voltmeter moves pointer on a scale but it has some

limitations like accuracy of few percent of full scale.• Digital voltmeter can display numerical value of voltage on a

display by use of analog to digital converter (ADC). • All the data processing and manipulating is in digital form, so

it is very essential to use ADC.

Page 3: Digital voltmeter using 89c51 microcontroller

Cont….

• We have used ADC0804 analog-to-digital converter IC. The range of input voltage is 0-15V. Here the input voltage should be DC voltage so as to get the steady output on the LCD display.

• If you give the AC voltage as an input, it will display continuously running numbers as the nature of AC voltage.

Page 5: Digital voltmeter using 89c51 microcontroller

Components Required For Digital Voltmeter Using 89c51 Microcontroller• Microcontroller, AT89C51• Analog to Digital Converter, ADC0804‐ ‐• 16×1 LCD• Oscillator circuit for the microcontroller– 12MHz Crystal Capacitor– 33pF Capacitors

• Voltage divider circuit/ Input terminals– 200k, 100k Resistors– 100nF Capacitor

• ADC Clock Circuit 100k Potentiometer (to adjust the back light of the ‐ LCD)– 10k Resistor– 150pF Capacitor

• 100k Potentiometer (to adjust the back light of the LCD)‐

Page 6: Digital voltmeter using 89c51 microcontroller

Circuit Diagram Of Digital Voltmeter Using 89c51 Microcontroller

Page 7: Digital voltmeter using 89c51 microcontroller

Lcd Pin DiagramPin no. Name Description1 Vss Ground

2 Vdd +5V

3 Vee Contrast  Adjustment  ‐2V  to  ‐5V

4 RS Register  Select

5 RW 1  ‐Read  ,  0‐ Write

6 E Enable  Strobe

7 D0 Data  Line

8 D1 Data  Line

9 D2 Data  Line

10 D3 Data  Line

11 D4 Data  Line

12 D5 Data  Line

13 D6 Data  Line

14 D7 Data  Line

15 LED+ Backlit  LED  +V   Vdd  (Optional  signal)

16 LED‐ Backlit  LED  –V   Vss  (Optional  signal)

Page 8: Digital voltmeter using 89c51 microcontroller

Components1. 8051 Based Controller: 12. ADC0804: 13. LCD 16x1: 14. Potentiometer 10K: 15. Resistor 10K: 26. Resistor 200K: 17. Resistor 100K: 18. Capacitor 33pF: 29. Capacitor 10uF: 110. Capacitor 150pF: 111. Capacitor 100nF: 112. Crystal 12Mhz: 1

Page 9: Digital voltmeter using 89c51 microcontroller

C Program For Digital Voltmeter Using 89c51 Microcontroller#include <REGX51.H>#include "lcd.h"#define adc_port P1 //ADC Port#define rd P3_7 //Read signal P3.7#define wr P3_6 //Write signal P3.6#define cs P3_5 //Chip Select P3.5#define intr P3_4 //INTR signal P3.4void conv(); //Start of conversion

functionvoid read(); //Read ADC functionunsigned int adc_avg,adc;void main(){char i;

LCD_INI();while(1)

{ //Forever loop

adc_avg = 0;for(i=0;i<10;i++){conv(); //Start conversionread(); //Read ADCadc_avg += adc;}adc_avg = adc_avg/10;wrt_cmd(0x80);wrt_string("V(DC): ");adc = adc_avg * 59;hex2lcd((unsigned char)(adc/1000));

Page 10: Digital voltmeter using 89c51 microcontroller

Cont….wrt_data('.');adc = adc%1000;hex2lcd((unsigned char)(adc/10));wrt_data('V');}}void conv(){cs = 0; //Make CS lowwr = 0; //Make WR lowwr = 1; //Make WR highcs = 1; //Make CS high

while(intr); //Wait for INTR to go low

}void read(){cs = 0; //Make CS lowrd = 0; //Make RD lowadc = adc_port; //Read ADC portrd = 1; //Make RD highcs = 1; //Make CS high}

Page 11: Digital voltmeter using 89c51 microcontroller

Advantages

• This system is used to measure the voltage in low voltage applications.

• Used to measure the toy batteries.• We can measure the physical quantities like

temperature, humidity, gas etc. using this system with a little modification.

Page 12: Digital voltmeter using 89c51 microcontroller

 disadvantages

• The input analog voltage range should be 0 to 5V.

• Using this system we can measure only one analog input value at a time.

Page 13: Digital voltmeter using 89c51 microcontroller