Introduction: ACS724 Current Sensor Measurements With Arduino

In this instructable we'll experiment with connecting an ACS724 current sensor to an Arduino to make current measurements. In this case the current sensor is a +/- 5A variety that outputs 400 mv/A.

The Arduino Uno has a 10 bit ADC, so good questions are: How accurate is the current reading we can get and how stable is it?

We'll start by just connecting the sensor to a voltmeter and a current meter and make analog readings to see how well the sensor works and then we'll connect it to an Arduino ADC pin and see how well it works.

Supplies

1 - Breadboard
2 - Benchtop power supplies
2 - DVM's
1 - ACS724 sensor +/- 5A
1 - Arduino Uno
1 - LM7805
3 - 10 ohm, 10W resistors
1 - 1nF cap
1 - 10nF cap
1 - 0.1uF cap
Jumpers

Step 1:

The test circuit is as shown in the diagram. The connection from the Arduino 5V pin to the LM7805 +5V rail is optional. You may get better results with this jumper in place but be careful about your wiring if you use it because the Arduino is connected to your computer and the second power supply will exceed 5V when you turn it up to increase current through the sensor.

If you connect the power supplies together then the sensor power supply and the Arduino power supply will have the exact same +5V reference point and you would expect more consistent results.

I did this without this connection and I saw a higher zero current reading on the current sensor (2.530 V instead of the expected 2.500 V) and lower than expected ADC reading at the zero current point. I was getting a digital ADC reading of about 507 to 508 with no current through the sensor, for 2.500V you should see an ADC reading of about 512. I corrected for this in the software.

Step 2: Test Measurements

Analog measurements with a voltmeter and ammeter indicated that the sensor is very accurate. At test currents of 0.5A, 1.0A and 1.5A it was exactly correct to the millivolt.

ADC measurements with the Arduino were not nearly as accurate. These measurements were limited by the 10 bit resolution of the Arduino ADC and noise issues (see the video). Due to noise the ADC reading was jumping around worst case up to 10 or more steps with no current through the sensor. Considering that each step represents about 5 mv, this is about a 50 mv fluctuation and with a 400mv/amp sensor represents a 50mv/400mv/amp = 125ma fluctuation! The only way I could get a meaningful reading was to take 10 readings in a row and then average them.

With a 10 bit ADC or 1024 possible levels and 5V Vcc we can resolve about 5/1023 ~ 5mv per step. The sensor out puts 400mv/Amp. So at best we have a resolution of 5mv/400mv/amp ~ 12.5ma.

So the combination of fluctuations due to noise and low resolution mean that we cannot use this method to accurately and consistently measure current, especially small currents. We can use this method to give us an idea of the current level at higher currents but it is just not that accurate.

Step 3: Conclusions

Conclusions:

-ACS724 analog readings are very accurate.

-ACS724 should work very well with analog circuits. e.g controlling power supply current with an analog feedback loop.

-There are issues with noise and resolution using the ACS724 with Arduino 10 bit ADC.

-Good enough for just monitoring average current for higher current circuits but not good enough for constant current control.

-May need to use an external 12 bit or more ADC chip for better results.

Step 4: Arduino Code

Here's the code I used to simply measure the Arduino A0 pin ADC value and the code to convert the sensor voltage to current and take the average of 10 readings. The code is fairly self explanatory and commented for the conversion and averaging code.