Arduino Projects

Measure AC current by interfacing ACS712 sensor with Arduino

Learn how to measure AC and DC currents with the help of ACS712 sensor by connecting it with Arduino

In this Tutorial, learn how to interface ACS712 AC and DC current sensor module with Arduino to measure the current and power consumption of the load and display the current and power consumption on LCD display module, which can be also called as current monitoring system or power monitor. These sensor modules comes in 3 different capacities 5A, 20A, 30A which we are going to discuss them in detail below.

ACS712 current sensor module

ACS712 sensor module uses ACS712 IC which is developed by Allegro Micro Systems. This IC uses Hall effect principle to measure current. ACS712 IC consists of a low-offset, precise and linear Hall sensor circuit with a copper conduction path at the surface of the die.

This modules comes in 3 ranges:

  • +/- 5A
  • +/- 20A
  • +/- 30A

You need to choose the right module according to your requirement, as higher the capacity of the sensor lower the accuracy. For better accuracy use 5A version as it can measure current of major household appliances. if you go for higher 30A version measuring the current vales of smaller loads will give very in accurate and deviated results. Refer the below table for the mV per Ampere measured by the sensors.

5A Module 20A Module 30A Module
185mV/Amp 100mV/Amp 66mV per Amp

For more details about the ACS712, Please refer ACS712 datasheet : here

ACS712 current sensor module Specifications

  • Measures both AC and DC current
  • Available in 5A, 20A and 30A modules
  • 66 to 185 mV/A output sensitivity
  • Very small in size
  • Outputs analog voltage, so its easy to connect with most of the Microcontrollers.

Principle, pinout and working of ACS712 current sensor module

Principle: We already discussed this sensor uses the Hall effect principle.

Pinout diagram of ACS712 IC:

ACS712 CURRENT SENSOR IC PINOUT DIAGRAMPin Description table

Pin Number Pin Name Pin Description
1 & 2 IP+ +ve terminals for current sensing
3 & 4 IP- -ve terminals for current sensing
5 GND Ground Signal
6 FILTER External Capacitor to set the bandwidth
7 VIOUT Analog Voltage Output
8 VCC Power Supply to IC

Working of ACS712 current sensor

ACS712 current sensor working

As you can see from the above image, the current to sensed is connected to the top 4 pins, 2 pins for positive and 2 pins for negative, when current flows with in an amount of magnetic field is produced across the copper conduction path which is proportional to the amount of current passed. This magnetic field is sensed by the integrated hall effect IC and outputs voltage through the VIOUT pin.

ACS712 current sensor module application circuit (On PCB)

ACS712 Current sensor module application circuitFrom the above circuit image and module image, You can see i have arranged both the images with same IC pin sides, So, it would be easy for you  to understand the placements of capacitors and resistors.

Here we have 2 capacitors Cbyp and Cf with 0.1µF and 1nF respectively, Cbyp is connected in series with +5v and GND, and Cf is connected in series with FILTER and GND. A 1kΩ resistor with SMD code 102 is connected to 5v and power LED.

When AC current flow is connected between the 2 plastic screw connectors the ACS712 IC sensor senses the magnetic field and generate and outputs analog voltage at OUT pin.

As per the manufacturers datasheet the AC side and DC output are separated with 2100 Vrms which protects the microcontroller and USB power supply from contacting with high voltage. But still take necessary precautions to protect you, your computer and microcontroller Arduino from 240V AC.

Interfacing ACS712 Current sensor with Arduino to display result over serial monitor

Circuit Diagram

Interfacing ACS712 Current sensor with Arduino Circuit DiagramFrom the above schematic diagram you can observe the OUT pin from the current sensor is connected to the analog pin A0 of Arduino. VCC and GND pins of sensor are connected to 5V and GND of Arduino.

On the other side one of Load wire is connected in series with the sensor as shown in the above image.

Source code:

After connecting all the components as shown in the circuit diagram, Copy and upload the below code to Arduino through Arduino IDE.

Under the rest condition (no load on sensor) when the VCC is connected to 5V from the Arduino, OUT pin on the Sensor outputs 2.5V. when the load is added the voltage increases or decreases by sensitivity values(185mV/A for 5A module, 100mV/A for 20A Module or 66mV/A for 30A Module).

Under DC load DC circuits have a unidirectional flow of current and like AC it is not changing the direction periodically. So its easy to measure it unlike AC which changes its directional flow periodically with a frequency of 50 or 60 Hz according to the country you stay. So in this scenario Voltage goes up and down according to a sine function while current goes back and forth. This means that we must measure the output voltage related with peak current.

After uploading the code open serial monitor to check the values of current in Amps and Power consumption in Watts.

Calibration is more important in this sensor module because this doesn’t not give accurate results  directly, it has some error percentage. This error percentage increases if we use Higher Amp versions as the sensitivity decreases.

Connecting LCD display to Current monitoring system

In this we are just adding a LCD display module to display the current and power consumption values on LCD display instead connecting it to a PC to check the values.

Here we are using a 16×2 LCD display with I2C adapter connected, which is easier to connect with inbuilt potentiometer to adjust contrast. If you still want to connect LCD display without I2C adapter refer the below article.

Circuit diagram

Interfacing ACS712 Current sensor with Arduino to display result over lcd module

From the above circuit diagram you can notice every other connections except for LCD display are same as previous one. here LCD display module VCC and GND are connected with 5V and GND from Arduino.

SDA and SCL pins from the LCD module are connected to the A4 and A5 pins of the Arduino. That’s it for connection now its time to upload the code.

Source code for LCD display:

After connecting everything as per the above circuit diagram, Please copy the below code and paste it in Arduino IDE and upload it to your Arduino.

After uploading the code the LCD display shows the out as,

Interfacing ACS712 Current sensor with Arduino to display result over lcd module output

If you have any doubt regarding this project please feel free to ask through below comments, or Our Facebook page “Circuit Schools”.

If you want to interface ACS712 current sensor module with ESP8266 or ESP32, refer the below articles.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Back to top button