The ACS712 Current Sensor is an economical and precise solution for AC or DC current sensing in industrial, commercial, and communications systems. The device operates on the principle of Hall-effect, which is the production of a voltage difference across an electrical conductor, transverse to an electric current in the conductor and a magnetic field perpendicular to the current. The ACS712 outputs an analog signal that is linearly proportional to the current passing through the IP+ and IP- pins of the sensor.
Pin Number | Name | Description |
---|---|---|
1 | Vcc | Power supply (4.5V to 5.5V) |
2 | GND | Ground connection |
3 | OUT | Analog output voltage |
4 | IP+ | Current input |
5 | IP- | Current output |
// ACS712 Current Sensor Example Code for Arduino UNO
const int analogIn = A0; // Connect the sensor output to analog pin A0
float sensitivity = 0.185; // Sensitivity for the 5A model (change as needed)
float offsetVoltage = 2.5; // Offset voltage for zero current (Vcc/2)
void setup() {
Serial.begin(9600);
}
void loop() {
float voltage = analogRead(analogIn) * (5.0 / 1023.0); // Convert analog reading to voltage
float current = (voltage - offsetVoltage) / sensitivity; // Convert voltage to current
Serial.print("Current: ");
Serial.print(current, 3); // Print current with 3 decimal places
Serial.println(" A");
delay(1000); // Wait for 1 second before next reading
}
Q: Can the ACS712 sensor measure both AC and DC current? A: Yes, the ACS712 can measure both AC and DC currents.
Q: What is the accuracy of the ACS712 sensor? A: The accuracy can vary, but it is generally within a few percent of the actual current.
Q: How do I increase the resolution of my current measurements? A: Use a microcontroller with a higher resolution ADC or an external ADC with higher resolution.
Q: Is the ACS712 sensor isolated from the high current path? A: Yes, the sensor IC incorporates isolation to protect the electronics from high current paths.