# Arduino current measurement

I am planning to use an Arduino to make a joulemeter for a current range of 0-30 A and a voltage range of 0-24 V.

The voltage measurement is fine but I have questions about the current measurement. For measuring current, I plan on using a MAX4081TAUA+ to amplify voltage across a shunt.

The Arduino internal ADC can read up to 5 V and the voltage gain of the amplifier is listed as 20 V/V. From my understanding, at maximum current, the voltage across the shunt resistor should be 5 / 20 = 0.25 V, so the resistance of the shunt should be about 1 mΩ. Is this correct and will this give a reasonable accuracy?

• Which arduino are you using? As far as I know, they can only measure up to VCC, the "absolute maximum" rating is probably VCC+0.5V, which may be where you got 5.5V from, but a lot of Arduinos run at 3.3V as well. Depending on the chip you are using, 5.5V may burn out the pin (I wouldn't run it anywhere near the "absolute maximum" rating). Jan 8, 2020 at 16:46
• What does "reasonable accuracy" mean? What is reasonable to you might be completely unreasonable to me. You must specify the maximum allowable uncertainty in your measurements, and you need to provide a link to the datasheet for the particular flavor of Arduino that you want to use so we can see how much uncertainty is introduced by its ADC. Jan 8, 2020 at 17:06
• Please edit to quote the part number in the hyperlink rather than "current sense amplifier" which requires us to open another page to understand what you are referring to. Make sure you're linking to the datasheet and not the catalog page. Jan 8, 2020 at 17:08
• Thank you for pointing out correct arduino ADC maximum voltage . I have also edited the part listing. The microcontroller on the board is a atmega328p. The ADC is 10 bits.I don't have an exact accuracy requirement, I just want it to be accurate as possible, and from my understanding that would require choosing the largest shunt resistor possible. Is there a way to estimate the accuracy? Jan 8, 2020 at 17:16
• @RonBeyer 30mA would be the resolution of the measurement, not its accuracy. The datasheet for the ATmega328 gives a typical error of up to 4.5 LSBs, so the maximum error might be twice that. So, the ADC itself would introduce an uncertainty of +/- 270mA in the readings...that's on top of the uncertainty introduced by the shunt resistor. Jan 8, 2020 at 21:08

A trick I’ve used to good effect is to have a couple of amplifiers with different gains, both running from the same supply as the Arduino. The high gain amp will max out at a moderate current (maybe 5A) and the second will work up to 30A or more. I’d start with a sane value of shunt e.g. 1mR gives <1W at max current, then work out the gain values you need. Purpose-designed current sense amplifiers are fine but you can also use a DC coupled operational amplifier (choose one with rail-to-rail inputs and outputs.

• You can use a selectable gain amplifier like the mouser.com/datasheet/2/268/22004b-9166.pdf which costs less than \$1 and has gain of 1, 10, and 50 using one pin. Aug 17, 2022 at 5:19

For maximum accuracy, you want 5 V output from the current-sense amplifier when 30 A is flowing through the shunt/sense resistor. Since the voltage gain of the device across the shunt resistor is 20 V/V, then the maximum required resistor value would be:

R = 5V / 20V/V / 30A = 8.33 milliohm.

You can see a close-by example in the second-to-last row of Table 1 in the datasheet that you linked to. For a 5 V full-scale output voltage at 25 A full-scale current and gain of 20 V/V, the calculated sense resistor value is 10 milliohm.

For best accuracy, you want to use the full scale of the ADC converter, that is generate 0-5 V for the current range of 0-30 A, which the resistor computed above would provide.

It is not advisable to use the maximum possible resistance. 8.3 mΩ with 30 A will dissipate nearly 8 W which is quite extreme.