ACS712 Hall Effect Sensor Reference

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

ALLEGRO ACS712

Interfacing a Hall-effect current sensor with an Arduino


Leave a reply

Current flow in a system is depends on load characteristics. Due to a faulty condition or


controlling scheme, the current flow in the system might be changed. So having
knowledge about the current flow in a system is important for both protection and
controlling purposes.

There are various methods available for sensing current flow in a system. Usage of shunt
resistors, current transformers and usage of Hall-effects sensors are some such
available methods. This articles talks about usage of Allegro ACS712 sensor [1] with an
Arduino development board for measuring current in a system. Allegro ACS712 sensor
operates according to the Hall-effect principal and it can be used for both AC and DC
current measurement. There is no need of auxiliary circuits for this sensor it is an
immense advantage over the other available methods.

What is Hall Effect principle?

The Hall-effect is the production of a voltage difference (the Hall voltage) across an
electrical conductor, transverse to an electric current in the conductor and a magnetic
field perpendicular to the current. It was discovered by Edwin Hall in 1879.[2]

Allegro ACS712 sensor

This is a bi-directional measuring device and therefore this can be used for both AC and
DC current sensing. The ACS712 sensor is designed for three current ranges 5A, 20A
and 30A. The sensor consists of an integrated circuit which works according to the Hall-
effect principal. This IC generates a voltage proportional to the current flowing in the
circuit. Breakout board of current sensors based on this device also available in the
market and they make your life easier.
Following graph show the variation of the output voltage with the current flow for 5A
sensor [1].

Interfacing with Arduino

Connection configuration

T1 and T2 of the sensor should be connected in series with the current path which is
need to sense. Out pin should be need to connect one of the analog input pin available in
the Arduino. VCC and GND pins should be connected to 5V and GND pin of the Arduino
respectively.
Code

The sensor outputs an analog voltage correspondence to the current flow. Therefore to
get the current reading from the Arduino. So we need to perform analog to digital
conversion inside the Arduino and multiply with calibrating constant to get the actual
value.

We need to use little bit of mathematics for the actual current value calculation. Adruino
has 10 bit analog to digital converter register. So ADC value is in range of 0-1023. Then
the actual sensor voltage output can be obtained from

OutputSensorVoltage = analogRead(sensorPin)*5.0/1023.0

From the graph and the datasheet,

At zero current, OutputSenosrVoltage = 2.5

Gradient of the graph = 185mV/A (given in datasheet as sensitivity)

So the equation of the graph is

OutputSensorVoltage = 0.185*Current + 2.5

Therefore current can be expressed as

Current = (OutputSensorVoltage 2.5)/0.185

If the current flows in negative direction, current value will be negative.

Following is an example code which can be used for measuring current using the sensor.
It will display the current measurement on serial monitor.

You might also like