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:
I have the ACS712 current sensor connected in series with a 5V DC power supply and a 27-ohm resistor (rated for 10W power).
Board: Arduino UNO
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.
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:
Measure Vref with your multimeter, for zero current.
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;
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..