# Is it possible to measure the voltage and current of a load with this circuit and Arduino?

I'm trying to measure the voltage and current for a DC-AC converter in my car with Arduino.

I know it would be easier, more accurate and cheaper to use breakouts with INA226 like this. But this question is purely from my curiosity.

I'm thinking about a circuit like this with a shunt resistor. • Voltage : V0
• Current : V1/R

But Arduino can't measure voltage higher than 5V (Arduino Reference, analogRead()). Besides, if the voltage drop in the load was very low, voltage higher than 5V might be applied to V1.

Then I came up with an idea using a voltage divider. • Voltage : V0 * (r1 + r2) / r2
• Current : V1/R2

r1 + r2 should be large enough to avoid drawing too much current to the tributary. R1 + R2 should be small enough to prevent voltage drop.

But I feel I'm missing something. Can this quite simple circuit measure the voltage and current?

# EDIT 2018-3-11 15:49 GMT

The current will be up to 25A since the max power consumption of the load is 300W.

• BT103 and op-amp for current draw Mar 10, 2018 at 17:31
• For practical reasons, you will want to amplify the voltage coming out of the shunt (R2). In future, please use a different number for every resistor. It is potentially confusing to have r1 and R1 in the same circuit. Mar 10, 2018 at 17:36
• R1, in series with shunt R2 seems to serve no purpose. Also, if you do this, use a Zener diode to protect the ADC input that senses battery voltage. Sometimes automotive systems have large voltage transients. The combination of r1 and a Zener should protect the ADC. Mar 10, 2018 at 17:38 it is, in theory, possible to measure the voltage across and current thru the load. The voltage is IN0 - IN1, and the current is IN1/R.

However, for a useful current measuring circuit, R would need to be very low. You want the worst case voltage dropped across R to be a small fraction of the total 12 V that is available. You don't say what the maximum current is you need to measure, but I'd start with not wanting to have more than 100 mV across R. In reality, that means you need to amplify the IN1 signal before presenting to a A/D that has a 5 V or 3.3 V input range.

Another option is to use such a high resolution A/D so that you still have enough resolution left after using only a small portion of its range. With a 20 bit delta-sigma A/D, for example, with 3.0 V reference, 100 mV would be 1/30 of its range. That still leaves about 15 bits of resolution.

As for IN0 being a higher voltage than can be measured directly, use a resistor divider to scale it down to the range you can measure. For example, a top resistor of 20 kΩ and a bottom resistor of 10 kΩ attenuates the signal by 3. If using a A/D with 5 V range, that means the input signal can be measured over a 15 V range.

At high current, the sense resistor will need to be small, and the voltage drop across it will be small. You will need a difference amplifier to read it. LM358 has problems reading difference below 0.3mV, but above 10mV should be mostly OK. The output of the difference amplifier is the voltage difference across the sense resistor.

You will need another op amp with some gain to increase it for the full range of the ADC. You might want to do the same (opamp with gain) on the other side for reading voltage to change the scale from 0-1.2V to 0-5V.

It is preferable to have load connected to ground, but then the op amp will need at least 1.5V more than the load supply. But, if this is not connected to anything else, and not part of a bigger circuit, it may be ok to not have the load ground referenced. However, a short circuit on the load will still put the input voltage at the op amp to 12V. I'm not sure if this might be a problem, considering that the gain stage will only have output up to 5V, and LM358 inputs can go upto supply voltage (12V, if there is no 15V separate supply for the op amps). Sorry, I made a mistake. You will need a negative supply for the op amp so it can sense below 3A. For 25A, please change the resistor to 0.01 Ohm 10W (it will get hot, so might want to add some cooling). Should work reasonably well above 0.5A. If this is an inductive load, I'd definitely have separate power supplies for the op amp. Might even go with an op amp that has null offset pins for accuracy. 