Need Assistance with ESP8266-ACS712 Communication for AC Current Measurement

Hi!
I'm currently working on a project that involves interfacing an ESP8266 with an ACS712-20A sensor to measure AC current. I've consulted various forums on the Internet, and it seems that the midpoint oscillates around 512. However, my sensor is returning a value around 800.

My code:

#define Current_sensor A0 

float i;

void setup() {

Serial.begin(9600);
pinMode(Current_sensor, INPUT);

}

void loop() {
  i = analogRead(Current_sensor);
  Serial.println(i);
  delay(100);   

}

Is my sensor possibly damaged? I've also attempted to write code for AC current measurement, but it's not accurate. Can someone assist me with this issue?

the esp32 is a 3.3V MCU and the ACS712 is a 5 V device. so 2.5 V with a 3.3 V reference gives you around 800 in 10 bit resolution. use a voltage divider to map 0 to 5 V to 0 to 3.3 V.

Agree with Juraj => use a voltage divider.
Please note that the mV per Ampere will be scaled too then.
See also - GitHub - RobTillaart/ACS712: Arduino library for ACS Current Sensor - 5A, 20A, 30A

1 Like

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