Download the AVRStudio assembly source for the program: M8DPM091109A.asm
Download the AVRStudio hex file: M8DPM091109A.hex
Find updates at www.projects.cappels.org
– A 10 bit digital panel meter for positive voltage only.
– Input resistance: about 130k
– Ranges: 0 to 10.20 volts and 0 to 102.3 volts.
– Over range indication.
This project came from friend named Don’s need for a digital panel meter for a power supply project. This was further complicated by Don and me being on different continents, and the problems that go with troubleshooting remotely.
Don had considered an ATMEGA8 project that was posted on the web, but when contacted, the author was not helpful and seemed very discouraging. So rather than pick through his code, trying to figure out what he had done, I thought about writing the code myself. Most of it could be taken from other projects.
Then I realized that with only the 10 bit A-to-D converter on the available AVR controllers, the resolution would only be 100 millivolts because Don intended his power supply to supply over 20 volts.
The 10 bit A-to-D converter has a range of 0 to 1023. To explain in a little more detail, using the ATMEGA8’s internal 2.5 volt band gap reference means that by using a resistive divider ahead of the A-to-D converter, the input could be scaled such that any voltage range from 0 to 2.5 volts or higher could be accommodated. If the range had less than 1024 steps, then some resolution would be lost. For Don’s application, a 102.3 volt scale would be necessary. The least significant digit would be 100 millivolts. And when he used the meter to measure (for example) 10.0 volts, the 100 millivolt resolution would be a little bit coarse.
“Ok, no problem”, I thought. “He can have two ranges on the meter. He can switch between two resistive dividers on the input to get a 10.23 volt full scale range and a 102.3 volt full scale range.
And why not have the meter switch between the two ranges automatically. That would make the project a lot more interesting. I had always taken it for granted that auto ranging voltmeters were pretty simple, and this would be a chance to do so
mething unusually analog with an AVR controller, so why not?
The circuit came out to be very simple and compact. The ATMEGA8 is the lowest pin count AVR controller that I could find that has an onboard 10 bit A-to-D converter. It had no problem directly driving the four digits delivering an average approximately 50 milliamps to the display. The on-chip clock oscillator also saved some parts. I am not sure whether the 8 uH inductor and 0.33 uF decoupling capacitor on the analog VCC was necessary, but I used them as a good practice. Better to put a couple of extra parts on the board than to take the chance of having to take the board back and add them later.
Read more: A 10 Bit LED Digital Panel Meter With Auto Ranging Based On The ATMEGA8