sensor-experiments

Introduction

This experiment demonstrates how to use the ACS712 current sensor to measure the current flowing through a circuit.

Components Needed

No Ads Available.

Circuit Setup

  1. Connect the ACS712 sensor to the Arduino using the appropriate pins (VCC, GND, and OUT).
  2. 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

Contact Us

If you have any questions or inquiries, feel free to reach out to us at Microautomation.no@icloud.com .

Follow our Socials for the newest updates!