Professional Documents
Culture Documents
Electronics Hub: Interfacing ACS712 Current Sensor With Arduino - Measure Current With Arduino
Electronics Hub: Interfacing ACS712 Current Sensor With Arduino - Measure 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
YOU ARE HERE: HOME / ARDUINO / INTERFACING ACS712 CURRENT SENSOR WITH ARDUINO – MEASURE CURRENT WITH
ARDUINO
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
Output Video
Take a look at the output video before proceeding further into ACS712 Current Sensor Module.
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.
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
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:
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.
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.
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
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
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 }
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).
adcValue = analogRead(currentPin);
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/
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
SPONSORED SEARCHES
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
KITS
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
SUBSCRIBE
https://www.electronicshub.org/interfacing-acs712-current-sensor-with-arduino/ 16/16