Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

ELECTRONICS HUB
P R OJ E C T S | T U TO R I A L S | C O U R S E S | K I T S

HOME PROJECTS MINI PROJECTS ARDUINO FREE CIRCUITS TUTORIALS SYMBOLS

DIY COURSES CONTACT US

YOU ARE HERE: HOME / ARDUINO / INTERFACING ACS712 CURRENT SENSOR WITH ARDUINO – MEASURE CURRENT WITH
ARDUINO

Interfacing ACS712 Current Sensor with


Arduino – Measure Current with Arduino
JULY 19, 2018 BY RAVI — LEAVE A COMMENT

In this project, we will discuss about ACS712 Current Sensor, how a Hall E ect based current
sensor works and nally how to interface the ACS712 Current Sensor with Arduino.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 1/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Table of Contents 
1. Introduction
2. Output Video
3. A Brief Note on ACS712 Current Sensor
3.1. How ACS712 Current Sensor Works?
3.2. ASC712 Current Sensor Application Circuit
4. ACS712 Current Sensor Module
5. Interfacing ASC712 Current Sensor with Arduino
6. Circuit Diagram of ASC712 Current Sensor with Arduino
6.1. Components Required
6.2. Circuit Design
7. Code
8. Working
9. Applications

Introduction
If you recall the previous Arduino project, I have discussed about measuring voltages greater
than 5V with Arduino using a Voltage Sensor. In this project, we will learn about measuring
current using a Current Sensor (ACS712 Current Sensor to be speci c).

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 2/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

  

A Current Sensor is an important device in power calculation and management applications. It


measures the current through a device or a circuit and generates an appropriate signal that is
proportional to current measured. Usually, the output signal is an analog voltage.

Output Video
Take a look at the output video before proceeding further into ACS712 Current Sensor Module.

Interfacing ACS712 Current Sensor with Arduino

A Brief Note on ACS712 Current Sensor


The ACS712 Current Sensor is a product of Allegro MicroSystems that can be used for precise
measurement of both AC and DC currents. This sensor is based on Hall E ect and the IC has
an integrated Hall E ect device.

Coming to the output of the ACS712 Current Sensor, it produces an analog voltage that is
proportional to AC or DC currents (whichever is being sensed).

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 3/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

  

The ACS712 IC is available in an 8-lead SOIC package and the following image shows its pin
diagram.

Let us now see the pin description of ACS712. The following table shows the pin number,
name and description.

Pin Number Pin Description


Pin Name

1&2 +ve terminals for sensing current


IP+

3&4 -ve terminals for sensing current


IP-

5 Signal Ground
GND

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 4/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

6 FILTER External Capacitor (to set the bandwidth)

7 Analog Output
VIOUT

8 Power Supply
VCC

There are three variants of ACS712 Sensor based on the range of its current sensing. The
optimized ranges are +/-5A, +/-20A and +/-30A. depending on the variant, the output
sensitivity also varies as follows:

ACS712 Model Output Sensitivity


Optimized Current Range

ACS712 ELC-05 +/- 5A 185 mV/A

ACS712 ELC-20 +/- 20A 100 mV/A

ACS712 ELC-30 +/- 30A 66 mV/A

How ACS712 Current Sensor Works?


As mentioned earlier, the ASC712 is based on Hall E ect. There is a copper strip connecting
the IP+ and IP- pins internally. When some current ows through this copper conductor, a
magnetic eld is generated which is sensed by the Hall E ect sensor.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 5/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

The Hall E ect sensor then converts this magnetic eld into appropriate voltage. In this
method, the input and the output are completely isolated.

ASC712 Current Sensor Application Circuit


The typical application circuit using the ASC712 Current Sensor is given in its datasheet and
the following images shows the same.

ACS712 Current Sensor Module


Using one of the variants of the ACS712 IC (5A, 20A or 30A), several manufacturers developed
ASC712 Current Sensor Module boards that can be easily interfaced to a microcontroller like
Arduino.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 6/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

The following image shows the ASC712 Current Sensor board used in this project.

As you can see, it is fairly a simple board with only a few components including the ASC712 IC,
few passive components and connectors.

This particular board consists of ASC712 ELC-30 i.e. the range of this board is +/- 30A. the
following image shows the components and pins on the board.

Interfacing ASC712 Current Sensor with Arduino


Measuring voltages (DC Voltages) with Arduino is very easy. If your requirement is to measure
less than or equal to 5V, then you can directly measure using the Arduino Analog Pins. If you
need to measure more than 5V, then you can use a simple voltage divider network or a
voltage sensor module.

When it comes to measuring current, Arduino (or any other microcontroller) needs assistance
from a dedicated Current Sensor. So, Interfacing an ACS712 Current Sensor with Arduino helps
us in measuring current with the help of Arduino.

As ASC712 can be used for measuring either AC or DC currents, Arduino can be implemented
to measure the same.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 7/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Circuit Diagram of ASC712 Current Sensor with Arduino


The circuit diagram of interfacing ACS712 Current Sensor with Arduino is shown in the
following image.

Components Required
Arduino UNO  [Buy Here]
ASC712 Current Sensor Module  [Buy Here]
Load (like a lamp or a motor)  [Buy Here]
Power supply (for load like battery)  [Buy Here]
16×2 LCD Display  [Buy Here]
10KΩ Potentiometer  [Buy Here]
330Ω Resistor  [Buy Here]
Connecting wires  [Buy Here]

Circuit Design
First, the load. I have used a 12V DC Motor along with a 12V power supply. The screw terminals
of the ASC712 Current Sensor Module board are connected in series with the motor and power
supply as shown in the circuit diagram.

Then connect the VCC, GND and OUT of the ASC712 board to +5V, GND and A0 of Arduino.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 8/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Now, in order to view the results, a 16×2 LCD is connected to Arduino. Its RS, E, D4-D7 pins are
connected to Digital I/O Pins 7 through 2 of Arduino.

A 10KΩ POT is connected to Pin 3 of LCD and its VCC and GND are connected to +5V and GND.

Code

1 #include <LiquidCrystal.h>
2
3 LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
4
5 const int currentPin = A0;
6 int sensitivity = 66;
7 int adcValue= 0;
8 int offsetVoltage = 2500;
9 double adcVoltage = 0;
10 double currentValue = 0;
11
12 void setup()
13 {
14 Serial.begin(9600);
15 lcd.begin(16, 2);
16 lcd.print(" Current Sensor ");

17 lcd.setCursor(0,1);
18 lcd.print(" with Arduino ");
19 delay(2000);
20 }
21
22 void loop()
23 {

24 adcValue = analogRead(currentPin);

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 9/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

25 adcVoltage = (adcValue / 1024.0) * 5000;


26 currentValue = ((adcVoltage - offsetVoltage) / sensitivity);
27
28 Serial.print("Raw Sensor Value = " );
29 Serial.print(adcValue);
30
31 lcd.clear();
32 delay(1000);
33 //lcd.display();
34 lcd.setCursor(0,0);

35 lcd.print("ADC Value = ");


36 lcd.setCursor(12,0);
37 lcd.print(adcValue);
38
39 delay(2000);

40
41 Serial.print("\t Voltage(mV) = ");
42 Serial.print(adcVoltage,3);
43
44 lcd.setCursor(0,0);
45 lcd.print("V in mV = ");
46 lcd.setCursor(10,0);

47 lcd.print(adcVoltage,1);
48
49 delay(2000);
50
51 Serial.print("\t Current = ");

52 Serial.println(currentValue,3);
53
54 lcd.setCursor(0,0);
55 lcd.print("Current = ");
56 lcd.setCursor(10,0);
57 lcd.print(currentValue,2);
58 lcd.setCursor(14,0);

59 lcd.print("A");
60 delay(2500);
61 }

Arduino_Current_Sensor_ACS712.ino hosted with by GitHub view raw

Working
Make the connections and upload the code to Arduino. In the code, there is a small calculation
for measuring the current.

First, assuming the VCC to ASC712 is 5V, when there is no current owing through the IP+ and
IP- terminals, the output voltage at VIOUT of ACS712 is 2.5V. This means that you need to
subtract 2.5V from the voltage measured at the analog pin.

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 10/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Now, in order to calculate the current, divide this value with the sensitivity of the sensor
(185mV/A for 5A Sensor, 100mV/A for 20A Sensor and 66 mV/A for 5A Sensor).

The same is implemented in code as follows.

adcValue = analogRead(currentPin);

adcVoltage = (adcValue / 1024.0) * 5000;

currentValue = ((adcVoltage – o setVoltage) / sensitivity);  

Applications
The ACS712 Current Sensor can be used in various current measuring applications like:

Inverters
SMPS
Battery Chargers
Automotive Applications like Inverters, Power Steering etc.  

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 11/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

At an affordable premium of
₹563/month for 1 Cr. cover*

CONTINUE
YOUR JOURNEY
*Disclaimer Non- Participating, UIN: 104N092V03
Non-Linked Term Insurance Plan ARN: 051218/GDN-OTPRe-3/

FILED UNDER: ARDUINO, DIY PROJECTS

Leave a Reply
Your email address will not be published. Required elds are marked *

Comment

Name *

Email *

Website

POST COMMENT

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 12/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Search this website

SPONSORED SEARCHES

Circuit Board Design

Weight Sensor

Magnetic Sensor

Voltage Sensor

Digital Display

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 13/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

PROJECTS BY CATEGORY

Arduino Projects (200+)


Electronics Projects (250+)
Mini Project Circuits (160+)
Mini Project Ideas (150+)
ECE Projects (150+)
EEE Projects (150+)
8051 Projects (110+)
Raspberry Pi Projects (101+)
Electrical Project Ideas (100+)
Embedded Projects (100+)
Latest Electronics Ideas (100+)
Microcontroller Mini Projects (100+)
Robotics Projects (100+)
VLSI Projects (100+)
Solar Projects (100+)
IOT Projects (100+)

Communication Projects (70+)


LED Projects (70+)
Power Electronics Projects (60+)
RFID Projects (60+)
Home Automation Projects (50+)
Matlab Projects (50+)
EIE Projects (50+)
Wireless Projects (50+)
LabView Projects (45+)
Zigbee Projects (45+)
GSM Projects (40+)
555 Timer Circuits (40+)
Sensor Projects (40+)
ARM Projects (60+)
https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 14/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

DTMF Projects (30+)


PIC Projects (30+)
Electrical Mini Projects (25)
ESP8266 Projects (15)

KITS

Best Drone Kits [12]


3D Printer Kits [12]
Best Robot Vacuum Clears [14]
Best Waveform Generators [12]
RGB LED Strip Light Kits [20]
Best LED Christmas Light Kits [13]

SUBSCRIBE FOR UPDATES

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 15/16
3/28/2019 Interfacing ACS712 Current Sensor with Arduino - Measure Current with Arduino - Measuring Current with Arduino

Enter your email address:

SUBSCRIBE

GENERAL PROJECTS PROJECTS

Tutorials Electrical Mini projects


Symbols Electronics Microcontroller
Courses Embedded Arduino
Calculator Power Solar
Contact Robotics Free circuits

ARM Home Automation


IOT Seminar Topics
Electronics Questions

TUTORIALS TUTORIALS FOLLOW US

Capacitors Ampli ers Instagram


Resistors IO Devices Youtube
Filters Thyristors Facebook
Diodes DC Circuits Google Plus
Transistors Number System Twitter
TS EAMCET 2019

Copyright © 2019 Electronicshub.org

https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 16/16

You might also like