|
||||||||
|
||||||||
|
DAN127 Build an Auto Ranging Voltmeter By Michael Simpson This one of 4 applications notes that will be used in a upcoming project called the Ultimate Utility Meter. Have you ever wanted to build your own voltmeter. That way you could customize it to meet your exact needs. One of the problems with using AtoD and a microcontroller is that you can not insert a voltage higher than VCC or you stand a chance of blowing the controller. One answer is to add a resistor or two to lower the voltage before entering the microcontroller. This works but at you loose resolution when measuring lower voltages. By using a 74HC4066 analog switch we can solve the resolution problem.
First Look at Voltmeter Lets take a look at a the basic voltmeter code.
To display the actual voltage we multiply the AtoD reading by a reference value. This value is calculated by the taking the maximum voltage and dividing by the number of steps. In the case of this circuit the max voltage is 4.97 volts (regulator output). The AtoD is 10 bits so that yields 1024 steps. So 4.98 / 1024 = .00486 An AtoD reading of 576 would be 2.8v
Now lets look at the Auto Ranger To build an auto ranger we will need an additional hardware component. The 74HC4066 quad analog switch. This Chip will let us select various resistors for the different scales we want to create.
In order to create this voltmeter you must have a regulated power source. Other wise your readings will drift. Here you see I am using a Breadboard regulator. Any 7805 will works just as well. We are not so concerned about the exact tolerances of the resistors as we will calibrate once the meter is assembled. R1 is the most important resistor. If it bypassed or omitted you will blow the controller. Essentially what we are doing is switching in various resistors to ground. Let Take a Look at the Program (Download it here)
There are three sections in the code. Initialization
Reading
Setscale
Calibrating the meter Calibration is simple. Hook up an existing voltmeter to the same to your input test lead. You will need a voltage source for each scale. What you do is tweak the reference voltage for the scale you are testing then reprogram. Start with very minor adjustments. As you go up in scale the resolution will drop so don't expect to get .004 resolution in scale 3. What next You can add a parallel LCD and display the readings to an LCD if you like. In a future project we will be doing just that.
Parts list
|
Copyright © 2001 - 2007 Kronos Robotics