Acs712 Hall Effect-Based Linear Current Sensor is used to measure both AC and DC. A circuit can be made using Acs712 and Arduino Uno to measure current accurately. ACS712 is used to measure both currents. After reading so many articles on Internet I was not quite satisfied that’s why I have decided to write in detail about measuring DC and AC.

How to make Home Security System Using Arduino?

1. DC Current Measurement Using ACS712

To measure the current use of the current sensor ACS712 in series with the load. The current measurement sensor has four input pins (VCC, OUT, FILTER, GND) and two output pins (IP+, IP-). Connect the OUT with Arduino, GND with the ground, and Vcc with Vcc. Now connect the one terminal of the load with IP- and the other with the ground. Connect the IP+ with the Vcc source. Also to see the result connect the LCD with Arduino.

Components used:

Following are the components used to measure the current of our circuit

  • Arduino Uno
  • ACS712
  • LCD
  • Connecting wire
  • Battery source
  • Load

current measurement using ACS712


                                                             Simulation and circuit diagram

Current sensor ACS712 Arduino Code

#include “LiquidCrystal.h”
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
double offset = 2.5;
double sensor = 0.066;
double current = 0;
double tension = 0;
void setup()
void loop()
double value = analogRead(A1);
tension= (value*5.0)/1024;
current= (tension- offset)/sensor;
lcd.print(current );

How to get back  to Virtual Terminal in Proteus?

2.  Ac Current Measurement Using ACS712

To measure the AC using the current sensor ACS712 Follow these steps. 

  • Connect Vcc pin of Current sensor to 5V pin of Arduino.
  • Also, Connect the GND pin of the Sensor to the GND pin of Arduino.
  • Now, Connect the Out pin of the Current sensor to the A0 pin of Arduino.
  • Connect IP- pin to a light bulb.
  • Likewise, connect the IP+ pin to the multimeter.
  • Connect the other probe of the multimeter to switch.
  • Now, connect one side of the AC source to the switch and the other to the ground wire from the bulb.
  • Connect the LCD with Arduino.

Components used:

Following are the components used to measure the AC current of our circuit


  • Arduino Uno
  • ACS712
  • LCD
  • Connecting wire
  • AC Source
  • Load
  • Switch
  • Multimeter

AC current measurement using ACS712

Current sensor ACS712 Arduino Code  for AC

#include <Filters.h> //This library does a huge work check its .cpp file
#include <LiquidCrystal_I2C.h> //LCD ic library

#define ACS_Pin A0 //ACS712 data pin

#define I2C_ADDR 0x27 //I2C adress, you should use the code to scan the adress first (0x27) here
#define BACKLIGHT_PIN 3 // Declaring LCD Pins
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); //Declaring the lcd

float testFrequency = 50; // test signal frequency (Hz)
float windowLength = 40.0/testFrequency; // how long to average the signal, for statistist

float intercept = 0; // to be adjusted based on calibration testing
float slope = 0.0752; // to be adjusted based on calibration testing

float Amps_TRMS;
float ACS_Value;

unsigned long printPeriod = 1000;
unsigned long previousMillis = 0;


void setup() {
lcd.begin (16,2);
lcd.setBacklight(HIGH); //Lighting backlight
lcd.home ();


void loop() {
RunningStatistics inputStats; // create statistics to look at the raw test signal
inputStats.setWindowSecs( windowLength );

while( true ) {
ACS_Value = analogRead(ACS_Pin); // read the analog in value:
inputStats.input(ACS_Value); // log to Stats function

if((unsigned long)(millis() – previousMillis) >= printPeriod) { //every second we do the calculation
previousMillis = millis(); // update time

Amps_TRMS = intercept + slope * inputStats.sigma(); //Calibrate the values
lcd.clear(); //clear the lcd and print in a certain position
lcd.print(” A”);



ACS712 Current Sensor Applications

ACS712 can be used to detect both AC and DC and is used in different electrical appliances. Besides this, it can be used with Arduino or another microcontroller in industrial, commercial, and communication applications.

  • Motor speed control circuits
  • Electrical load detection and management
  • Switched-mode power supplies (SMPS)
  • Protection for over-current

After reading this article “Current Measurement Using ACS712” you will be able to measure the DC. We have tried to cover each aspect of the current measurement and will look for more and try to add those in the next update. Have you used an Arduino-based current measurement circuit in your project? Let us know in the comments section below.


By inham

Inhamullah Jadoon is an Electrical Engineer and Founder of He has huge experience in the field of Engineering and assisting Engineers in Software and Hardware issues.

Leave a Reply

Your email address will not be published.