Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to design and build an external ATX power supply adapter, much like this one. I want to use it as a benchtop power supply. I wanted my adapter to have one more feature: I wanted it to have a voltmeter and an ammeter at each positive rail (+12V and +5V). I'm planning on having an ATmega328P do the voltage readings and display them in a common 16x2 LCD.

Here's where my problems begin. I'm having trouble designing the ammeters. My first attempt at it was the schematics below.

My attempt at an ammeter and voltmeter for ATX power supply adapter

The idea behind the schematics is that I'll read voltages in ports A0 and A2 to determine voltages of +12V and +5V rails, respectively, using ATmega328P ADC. There I would have my voltmeters, no problem. The voltage dividers in each circuit are there to bring voltages to the ADC's 5V limit.

To determine currents for the +12V and +5V rails, I would calculate the differences A1 - A0 and A3 - A2, assuming I'll be using 0R1 (0.1 ohm) 5W shunt resistors.

The shunts I'm planning to use yield 100mV/A. I plan on making readings well below 7A to respect the 5W spec on the resistors.

The problem is that I'm not comfortable having to make two readings to get the currents. I would much rather have the shunt connected to ground and then make a single voltage reading at its other end using the ATmega's 1.1V internal analog reference. That would give me the accuracy I want, all the way to about 6A. But then I don't know how to design such circuit so that all current that goes to each rail gets measured.

So, my question is: Is this design going to work? I'm afraid I won't have enough accuracy, especially because I'm depending on two readings to calculate current. Will the stacked up errors be too much?

Another related question: is there a better way to measure the current of each rail?

share|improve this question
up vote 3 down vote accepted

A single-ended reading from the perspective of your micro is the way to go. Use an accurate analog circuit to compute the difference and quantize that difference with a single ADC channel to get your reading.

I suggest using a smaller shunt (something that will produce 10mV at your maximum load) and a part from the INA210 family - these parts are highly accurate and work in both the high-side and low-side.

enter image description here

If you don't end up with the exact gain you want, you can simply voltage-divide the output of the INA21x and feed that into your ADC input.

share|improve this answer
The recommendation for using a smaller shunt is to get a voltage drop as low as possible not to disturb the rail, right? If so, that would be a good reason for me not to try and measure the shunt voltage with my AVR ADC directly. That's because I would want to raise the voltage difference as much as possible to gain accuracy, and thus, would be disturbing the voltage rail too much. Is that the design issue at play here? – Ricardo Jan 6 '14 at 19:11
Correct, it's to minimize the voltage drop caused by the shunt element. – Adam Lawrence Jan 6 '14 at 20:16

Apart from the suggested solution of the previous answer you can also use

INA138 enter image description here

Or a chip that doesn't need external supply like ZDS1009 (uses a current mirror)

enter image description here

Note that the resistance of the voltage divider in your schematic is too high for the AVR ADC input. The recommended output impedance of the divider should be 10K or lower so that the internal sample & hold circuitry of the ADC operates properly and gives correct results.

share|improve this answer
+1 for the great answer AND for pointing out that my voltage divider has too large resistor values. – Ricardo Jan 6 '14 at 19:07
@Ricardo Note that for low varying voltages you can get away with a small capacitor (10nF range) connected to the ADC input (ADC to ground). This capacitor acts as a reservoir and charges the ADC S&H capacitor very fast. The negative is the low speed I mentioned, the high resistance of the divider and the capacitor create an RC circuit that needs some time to reflect the actual voltage when it changes. – alexan_e Jan 6 '14 at 19:21

You could use an ACS712 Hall-effect sensor - the sensor output is electrically isolated from the circuit being measured. Available from Sparkfun, mounted on a small PC board.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.