Acs 712
Acs 712
In this project, we will discuss about ACS712 Current Sensor, how a Hall
Effect based current sensor works and finally how to interface the ACS712
Current Sensor with Arduino.
Outline
Introduction
Output Video
A Brief Note on ACS712 Current Sensor
o How ACS712 Current Sensor Works?
o ASC712 Current Sensor Application Circuit
ACS712 Current Sensor Module
Interfacing ASC712 Current Sensor with Arduino
Circuit Diagram of ASC712 Current Sensor with Arduino
o Components Required
o Circuit Design
Code
Working
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 specific).
Output Video
Take a look at the output video before proceeding further into ACS712
Current Sensor Module.
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 Name
5 GND
7 VIOUT
8 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:
The Hall Effect sensor then converts this magnetic field 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.
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.
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.
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.
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
#include <LiquidCrystal.h>
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(" Current Sensor ");
lcd.setCursor(0,1);
lcd.print(" with Arduino ");
delay(2000);
}
void loop()
{
adcValue = analogRead(currentPin);
adcVoltage = (adcValue / 1024.0) * 5000;
currentValue = ((adcVoltage - offsetVoltage) / sensitivity);
lcd.clear();
delay(1000);
//lcd.display();
lcd.setCursor(0,0);
lcd.print("ADC Value = ");
lcd.setCursor(12,0);
lcd.print(adcValue);
delay(2000);
lcd.setCursor(0,0);
lcd.print("V in mV = ");
lcd.setCursor(10,0);
lcd.print(adcVoltage,1);
delay(2000);
lcd.setCursor(0,0);
lcd.print("Current = ");
lcd.setCursor(10,0);
lcd.print(currentValue,2);
lcd.setCursor(14,0);
lcd.print("A");
delay(2500);
}
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 flowing
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.
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
30A Sensor).
Applications
Inverters
SMPS
Battery Chargers
Automotive Applications like Inverters, Power Steering etc.