AMP HOUR METER Project What it does: It measures and displays volts and amps of a 12V battery system. It also measures and displays Ampere Hours similar to a watt meter used by utilities to determine electricity consumption except that it runs backward and forward.. As batteries are charged and discharged, battery voltage changes. An ampere reading gives information about how much is drawn from the batteries or how much charge goes into the batteries. Both data are important to estimate how much power is left in a battery. Voltmeters and Ammeters are readily available, fairly cheap to install and are widely used. With this meter, both are displayed so there is no need for extra meters. In addition, AMPERE HOURS provide important information not available from volt or ammeters for the management of batteries. Ampere hours measure how many amps have been withdrawn or added to batteries during charge and discharge cycles. If, for example, you run a fridge from batteries, it is difficult to estimate how much power it has used overnight - this depends on how much food is in the fridge, ambient temperatures and a number of other variables. The AMP HOUR meter will tell you. Recharging the batteries by an equivalent number of amp hours (+ 20% or so to account for conversion losses) will restore the batteries. No nasty surprises from discharging a battery too much. Circuit description: Two Voltage to Frequency Converters (LM331) are used to measure current and voltage. These IC's produce regular pulses that vary in frequency with the input voltage. These pulses are divided by two (LS7474) to yield a square wave which is fed to the PIC micro controller. The PIC is programmed to measure the pulse width and converts them to volts, amps and ampere hours. This is displayed on a dot matrix liquid crystal display on 2 lines. As you can see from the photo of the AMP HOUR METER, the three data are simultaneously displayed and updated about twice per second. The voltage VFC is fed from a simple divider circuit consisting of a fixed and variable resistor. The variable resistor allows convenient calibration of the volts reading. The current VFC circuit is more complex and has an additional IC, a MAX472. This is a current to voltage op amp with an additional "sign" output to tell the direction of the current flowing in the shunt resistor to the PIC. This is essential because it must know whether to add or subtract ampere hours and of course also drive the sign for the amp reading. There is one other unusual IC, a Switching Power Supply, This unit produces floating 5 volts from 12 volts much like a transformer. This is a much neater solution than transformer based isolators which convert DC to AC, isolate AC and then rectify it to DC. This unit is produced by a company called MEAN WELL and are distributed in Australia by Computronics. The Switching Power Supply allows the meter and measurement circuits to be supplied from the same source (battery). Construction Notes: If you are designing your own circuit board the you will undoubtedly know how to construct the meter. If you decide to use my design then proceed as follows. First study the placement diagrams that come with the board very thoroughly before you start soldering. You'll note that some parts are placed on the solder side and some parts on the component side. Begin by soldering the MAX472, a surface mounted device. The trick with SMD's which I found works, is to tin their little feet and the pads on the PCB. Next use a pair of tweezers and place the IC on the board. A very light touch on each foot with the soldering iron should then result in a solid solder joint - but check with a very powerful magnifier. Next mount an 18 pin socket for the PIC micro controller followed by the passive components, the resistors and capacitors. The LCD is best connected by bolting the display board to the motherboard with 2mm bolts and then soldering the connections between the LCD and the motherboard with short length of tinned wire. When finished cut the excess lengths to size. This yields secure mechanical and electrical connections between the two boards. Note that the holes for the 5V regulator and the terminals need to be drilled to 0.9mm. This destroys the through plating but it is not needed anyway. The value of the SHUNT resistor is not critical because a calibration routine in the PIC accommodates quite a range of values. This reduces the cost because precision shunts are quite expensive. A piece of 2mm diameter copper wire about 25mm long will work well. Use your inventive skills to design and build a suitable resistor. It must be capable of carrying the maximum current you will use and have suitable connectors at each end. Don't be tempted to solder power leads to the shunt - they melt easily and may disrupt your power supply. I used brass blocks from electrician's earth connectors. They are available in variety of sizes from electrical wholesalers. Fuse holders may also be suitable. The shunt may be located up to 8 meters away from the meter and should be close to the battery terminal. I prefer to mount the shunt in the NEGATIVE line. Four wires are needed to connect the meter to the battery. Two carry +5 and 0v(ground) and two carry the current across the shunt. Do not be tempted to use 3 wires, the power supply ground is not the same as the wire which measures the shunt current!!! even though they are connected to the same battery terminal (i.e. 0V) There is also provision for a LCD back light switch. This is included because back lights consume quite a bit of power (up to 200mA) and this battery drain may not be necessary. There is also provision for 2 series diodes (or resistors) on the PCB to reduce the back light current. One diode is mandatory! The other is optional. If you choose to use one diode only, check the temperature of the 5V regulator. It may need a heat sink. The variability of different LCD back light diodes is quite large, so test this. Testing After completion, apply power (making sure polarity is observed) and the display will show Volts, Amps and Ampere Hours. The voltage reading is adjusted with the 5k trim pot. Use a volt meter to calibrate. Shorten the shunt leads and the display should show -1 amp, the minimum discharge current. It will not read zero because the power consumed by the meter is measured! Open the shunt leads and the meter will show some hundreds of AMPS. To calibrate the Amp (and AMPHOUR) readings, connect the shunt and discharge the batteries at exactly 10 amps - use an ammeter to measure this current. Press the calibrate button. The meter will show 10 amps discharge and when you release the calibration button, the meter is calibrated. As simple as that! Run a convenient discharge for suitable period of time the verify the amp hour reading. There may be slight differences between the instantaneous amp reading and the amp hour reading because the amp reading is truncated to an integer while the amp hours are much more accurate. In fact the PIC reads amp seconds and converts this to amp hours. For example, a discharge of 9.6 amps will read 10 amps but the amp hours will read 96 amps after 10 hours. Don't expect perfect accuracy, +\- 5% is quite possible due to variation in the parts, notable the PIC crystal frequency and the working temperature of the meter. In practice however, the accuracy is quite adequate. Trouble Shooting Problems are usually traced back to faulty soldering, bad capacitors and incorrectly placed components. So check everything very, very carefully including voltages at the appropriate IC pins. If you have an oscilloscope available, check that the PIC oscillator works, and that the two LM331s are pulsing. Also check the LS7474 (pins 5 & 9) produces square waves in the milliseconds ranges. I have had some problems with some 7404 not providing enough current to drive the optoisolater. Make sure it is a TTL chip. Another point of note is that "noisy" chargers such as cheap automotive devices with half wave rectifiers will produce voltage /current spikes that will have meter readings varying quite a bit. The best solution to that problem is don't use these chargers. Another solution is to increase the smoothing capacitors C9 and C6 up to 4700uF(!). By the way, a normal 16V electrolytic is acceptable for C9 because diodes protect against blowing the capacitor from a higher than acceptable reverse voltage. My research indicates that electrolytic capacitors can tolerate a reverse voltage of up to 5% of the voltage rating. In practice hundreds of hours of use have not blown one capacitor yet. If you are timid, use a bipolar type. That's really all there is to it. Before you commence the project, verify that you have the necessary tools and skills for fine soldering - this kit is definitely NOT for beginners. Frank Winter (VK4BLF) frankwinter@optusnet.com.au