Digital voltmeter for power supply

This summer I finally found some time to fix my power supply.

It’s a rather old but relieable unit, and I have no intention of replacing it. Basically, it still works except for the voltage meter on the front panel. Over time, the pointer developed an offset of around 1V, which is visible in this image where the power supply is turned off. Instead of indicating exactly zero volt, the pointer is below the beginning of the scale.

This, together with the fact that today’s microcontroller require 3.3V to operate (while the voltmeter only has an 1V resolution), forced me to always use a multimeter when using it, to be able to precisely set the output voltage.

The solution I found was to simply replace the analog voltmeter with a digital one. Instead of using a voltmeter chip like the ICL7107 that usually require the measurement ground to be separated from the supply ground, these days it is easier to build a voltmeter using a microcontroller.

That’s because even the cheap and simple micros now have at least a 10 bit ADC which is more than enough for a voltage meter in the rage 3..15V (which is the range of my power supply). Since the task is easy there was no need to use an ARM microcontroller as I usually do, but instead an ATtiny26 proved more than enough, despite only having 2KBytes of FLASH and 128Bytes of RAM.

This is the result:

The circiut is simple, a 78L05 is used to reduce the 20V found in the power supply to 5V to power the microcontroller. A voltage divider made with 1% precision resistors is connected from the power supply input to an ADC capable GPIO on the microcontroller, and three LED displays show the voltage with 0.1V resolution.

The LED displays are ofcourse multiplexed so that the ATtiny, despite its low number of GPIOs, can drive the display with no other glue logic except for current limiting resistors.

Around 100 lines of C++ code keep the whole thing working.


Tags: , , ,

3 Responses to “Digital voltmeter for power supply”

  1. GeriBoss Says:


    I am currently building a similar device, but I’m having problems with the ADC accuracy (1-2 volts error), I suspect something is wrong with my code. Would you be so kind to upload your source code?

  2. Michael Bell Says:

    I would love to see the code, and the schematic for this if you ever see this post

  3. fedetft Says:

    Looks like there are people interested in this code, so here it is:
    Let me know if you find it useful. For what concerns the schematic, I don’t have it at hand, but it’s so simple that the comments in the source should give plenty of information on how to attach the components to the micro.
    Note that for good accuracy the resistors of the voltage dividers should be 1% (also because a 4Kohm 5% resistor does not exist). A simple 78L05 was used to give the 5v for the micro.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: