Voltmeter with Analog To Digital Conversion

This is a simple Digital voltmeter project mainly focusing on designing condition circuits and demonstrating a use of Analog to Digital Converter (ADC).
----------------
Input Range: 0-15V DC

Bill of Material:
-----------------
8051 Based Controller: 1
ADC0804: 1
LCD 16x1: 1
Potentiometer 10K: 1
Resistor 10K: 2
Resistor 200K: 1
Resistor 100K: 1
Capacitor 33pF: 2
Capacitor 10uF: 1
Capacitor 150pF: 1
Capacitor 100nF: 1
Crystal 12Mhz: 1

Analog to Digital Conversion

To be able to implement analog to digital conversion using the ADC0804LCN 8-bit A/D converter. You will design a circuit and program the chip so that when an analog signal is given as input, the equivalent digital voltage is displayed on an LCD display. Thus, in effect, your circuit should function like a simple voltmeter.
Description:
The ability to convert analog signals to digital and vice-versa is very important in signal processing. The objective of an A/D converter is to determine the output digital word corresponding to an analog input signal.
The Datasheet for ADC0804LCN shows the pinout and a typical application schematic. The A/D converter operates on the successive approximation principle. Analog switches are closed sequentially by successive-approximation logic until the analog differential input volatge[Vin(+) - Vin(-)] matches a voltage derived from a tapped resistor string across the reference voltage.
The normal operation proceeds as follows. On the high-to-low transition of the WR input, the internal SAR latches and the shift-register stages are reset, and the INTR output will be set high. As long as the CS input and WR input remain low, the A/D will remain in a reset state. Conversion will start from 1 to 8 clock periods after at least one of these inputs makes a low-to-high transition. After the requisite number of clock pulses to complete the conversion, the INTR pin will make a high-to-low transition. This can be used to interrupt a processor, or otherwise signal the availability of a new conversion. A RD operation(with CS low) will clear the INTR line high again. The device may be operated in the free-running mode by connecting INTR to the WR input with CS=0.
Since this is an 8-bit A/D converter, a voltage from 0-5V. O will be repersented as 0000 0000 (0 in decimal) and 5V is represented as 1111 1111 (256 in decimal). To convert a value X volts to decimal, use the following formula: (X * 5.0)/256

To get a better resolution, and display the vlaue as a floating point number, you can multiply the numerator by a factor of 100, 1000 etc. and then print the voltage accordingly.

...................................................................................................................................

#include
#include "io.h"


sbit READ = P3^2; /* Define these according to how you have connected the */
sbit WRITE = P3^3;/* RD, WR, and INTR pins */
sbit INTR = P3^4;


void main( void ) {

unsigned char adVal;
unsigned long volts;
InitIO();

READ = 1;
WRITE = 1;
INTR = 1;
ClearScreen();

while(1) {

/* Make a low-to-high transition on the WR input */

while( INTR == 1 ); /* wait until the INTR signal makes */
/* high-to-low transition indicating */
/* completion of conversion */


/* Read the voltage value from the port */
READ = 0;
adVal = P1;
READ = 1;

/* Compute the digital value of the volatge read */

/* Print the value of the voltage in decimal form */
}
}

...................................................................................................................................

Theory behind calculation of Voltage divider circuit.
All we want is input voltage to ADC should not increase 5V and
Our maximum I/p Voltage to voltmeter is 15V only. So we design
the voltage divider circuit as follows.

where Vmax is Maximum i/p voltage to voltmeter.
Vip is i/p voltage to ADC.
R1 and R2 are resistance of voltage divider circuit.

    Vmax
    ---
     |
     \
     / R1
     \
     /
     |___ I/p (Vip)
     |
     \
     / R2
     \
     /
     |
     |
     V
    GND

Vmax = 15V

V = R2*Vmax/(R1+R2)

5/15 = R2/R1+R2

3 = R1/R2+1

2 = R1/R2

R2 = R1/2

Lets take R1 as 200K
and R2 will be 100K

Maximum current: Imax = (Vmax-Vipmax)/R1 (approx)

Vmax = 15V
Vipmax = 5V
R1 = 200K

Imax = (15-5)/200 = 10/200 = 0.02mA
Download this Project Report

Password: be
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Post a Comment

Thanks for your Valuable comment