Electronic – Designing ammeter for an external ATX power supply adapter

amperagepower supplyshunt

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 16×2 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?

Best Answer

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.