Introduction
This experiment demonstrates how to use the ACS712 current sensor to measure the current flowing through a circuit.
Components Needed
- ACS712 Current Sensor
- Arduino
- Jumper Wires
- Power Source
Circuit Setup
- Connect the ACS712 sensor to the Arduino using the appropriate pins (VCC, GND, and OUT).
- Place the sensor in series with the circuit where current measurement is desired.
The ACS712 sensor reads the current flowing through a wire and converts the value into an analog voltage, which is then read by the Arduino.
Code for Current Sensing
Upload the following code to your Arduino to measure the current:
const int sensorPin = A0;
float voltage, current;
void setup() {
Serial.begin(9600);
}
void loop() {
voltage = analogRead(sensorPin) * (5.0 / 1023.0);
current = (voltage - 2.5) / 0.185; // Calculating current in Amperes
Serial.print("Current: ");
Serial.print(current);
Serial.println(" A");
delay(1000);
}
Explanation
The ACS712 sensor produces an output voltage that is proportional to the current flowing through it. The Arduino reads the voltage and calculates the current based on the sensor’s sensitivity.
Troubleshooting
- If the readings are inaccurate, check the sensor’s placement and ensure proper calibration.
- Verify the wiring connections, particularly the power and output pins.