Issue with ACS712 - Incorrect Current Readings

Hi, I'm currently facing an issue with my ACS712 current sensor. Despite trying different codes, including ones shared by other users, I'm consistently getting incorrect values. I hope you can help me troubleshoot this problem.

Here are the details of my setup:

  1. I have the ACS712 current sensor connected in series with a 5V DC power supply and a 27-ohm resistor (rated for 10W power).
  2. Board: Arduino UNO
  3. Sensor: ACS712T, ELC- 30, 15098

Expected Current Draw: 0.178 A

Using my own code (provided below), I'm obtaining a current reading of only 0.053 A, which is significantly lower than the expected value.

float vref = 2.4975562095;
float volt, current;

void setup() {
  Serial.begin(9600);
  pinMode(10, INPUT);
}

void loop() {

  float x = analogRead(A0);

  x = (x * 5.0) / 1023.000;
  //Serial.println(x,10);
  current = (x - vref) / 0.185;
  Serial.print("Current is: ");
  Serial.println(current, 3);

  delay(1000);
}

To investigate further, I also tried using an existing online code that should work correctly with the ACS712 sensor. However, this code also produced inaccurate results.

At this point, I'm uncertain whether the issue lies with my code or the sensor itself. I would greatly appreciate any guidance or suggestions you can provide to help resolve this problem.

Thank you in advance for your assistance.

Please post a link to the product page for the exact sensor you bought. The designation above suggests that you are using the 30A version. If so, you are using the wrong sensitivity factor (185 mV/A), when you should be using 66 mV/A.

Notes:

  1. Measure Vref with your multimeter, for zero current.

  2. Both numbers in the following equation are wrong. You should measure and use the actual ADC reference voltage, instead of assuming 5.0, and the correct divisor is 1024.

x = (x * 5.0) / 1023.000;
  1. You can't expect high accuracy when attempting to measure 0.18 A with a 30 A full scale sensor.

Resolution (steps per A/D value) with an ACS712-30A sensor is 1024 * 0.4 * 30000 = 73mA.
An INA226 or INA219 breakout board is much better for small currents.
Leo..

I think you might be right.

  1. Vref = 2.4951171875.

  2. how do i measure the ADC reference number? does it have to do something with analogreference()??

  3. I was only using the resistor to test the code and get it calibrated, i'm going to use it with much higher currents eventually.

  1. Vref = 2.4951171875.

Really? How did you manage to measure that voltage to 10 digits past the decimal point? My multimeter is good to 2 at best.

  1. By default, the ADC reference voltage is the voltage on the Arduino 5V pin.

  2. Calibrate the sensor with an accurately measured current of 15A, for accurate full scale readings.

Hi,

0.178A > 0.066 * 0.178 = 0.0117 = 11.7mV
Resolution of UNO ADC = 1023
5V ref
.00117 * 1023 / 5 = 2.4 counts.

To do a proper calibration you will need at least 50% of rated current, that is 15A.

Tom... :grinning: :+1: :coffee: :australia:


float current=0.0;

void setup() {
  Serial.begin(115200);
}

void loop() {

  current = float(analogRead(A0)-512)/17.06666;
  Serial.print("Current A: ");
  Serial.println(current, 3);

  delay(1000);
}

I calculate 13.6333 (the ADS712 only uses 80% of the A/D).
Leo..

The "512" is likely incorrect, as well.

Zero point can be calibrated by changing '512' one or two digits.
At least is't more stable that subtracting 2.4951171875volt.
Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.