3
\$\begingroup\$

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?

\$\endgroup\$

3 Answers 3

3
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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? \$\endgroup\$
    – Ricardo
    Commented Jan 6, 2014 at 19:11
  • 1
    \$\begingroup\$ Correct, it's to minimize the voltage drop caused by the shunt element. \$\endgroup\$ Commented Jan 6, 2014 at 20:16
4
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ +1 for the great answer AND for pointing out that my voltage divider has too large resistor values. \$\endgroup\$
    – Ricardo
    Commented Jan 6, 2014 at 19:07
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – alexan_e
    Commented Jan 6, 2014 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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