How to Measure Ampere using ACS712 current Sensor with Arduino
Have you
ever stopped and wonder the amount of current each of your electrical
appliances require? Well, it’s a tedious process to know it all but that’s
where the functionality of a current sensor comes to play. With different
devices having different current requirements, if a wrong amount of current is
fed to them, it may result in severe circumstances (overloading, etc.). Hence,
it’s necessary for one to monitor the required current for applications, and
that’s when people turn to a current sensor to do the job, notably the ACS712
AC/DC Current sensor.
What is the ACS712 AC/DC Current Sensor?
The
ACS712 is a fully integrated, hall effect-based linear current sensor with
2.1kVRMS voltage isolation and a integrated low-resistance current conductor.
Technical terms aside, it’s simply put forth as a current sensor that uses its
conductor to calculate and measure the amount of current applied.
The
features of ACS712 include:
- 80kHz bandwith
- 66 to 185 mV/A output
sensitivity
- Low-noise analog signal path
- Device bandwith is set via
the new FILTER pin
- 1.2 mΩ internal conductor
resistance
- Total output error of 1.5%
at TA = 25°C
- Stable output offset
voltage.
- Near zero magnetic
hysteresis
For more
information on ACS712 pinout, schematics, and circuit diagram, you can download
ACS712 datasheet here!
How does the ACS712 Current Sensor work?
Now that
we’ve had an idea of what the ACS712 is capable of, we’ll take a look at its
working principle. Well, when it comes to how a current sensor works, it can
either be done through direct or indirect sensing. For the ACS712, it uses
indirect sensing.
- For current sensors that
work by direct sensing, ohm’s law is being applied to measure the drop in
voltage when flowing current is detected.
Here’s
how the ACS712 work (Simplified):
- Current flows through the
onboard hall sensor circuit in its IC
- The hall effect sensor
detects the incoming current through its magnetic field generation
- Once detected, the hall
effect sensor generates a voltage proportional to its magnetic field
that’s then used to measure the amount of current
ACS712 Current Sensor Applications
We’ve
established a general idea of what current sensors are applicable for earlier.
Well, with the ACS712 IC being able to detect both AC/DC current, it can be
used in a wider range of applications apart from electrical appliances. Be it
Arduino/other microcontroller usages, or industrial, commercial, and
communication applications, it can be found applicable.
Here are
the common list of applications:
- Motor speed control in motor
control circuits
- Electrical load detection
and management
- Switched-mode power supplies
(SMPS)
- Protection for over-current
ACS712 Current Sensor Arduino Guide
The
ACS712 current sensor can be connected to your Arduino board through a series
of jumper wires connections based on its pinout. However, here at Seeed, we
understand the complications and complexity of doing so. Hence, we’ve decided
to provide a tutorial for our Grove – ±5A DC/AC Current Sensor (ACS70331)
to display how easy our Grove plug-and-play system is!
Here’s
what you need for today’s tutorial:
Code Below
------------------------------------------------------------------------------------------------------------
#include "ACS712.h"
/*
This example shows how to measure DC current
*/
// We have 30 amps version sensor connected to A1 pin of arduino
// Replace with your version if necessary
ACS712 sensor(ACS712_30A, A1);
void setup() {
Serial.begin(9600);
// This method calibrates zero point of sensor,
// It is not necessary, but may positively affect the accuracy
// Ensure that no current flows through the sensor at this moment
sensor.calibrate();
}
void loop() {
// Get current from sensor
float I = sensor.getCurrentDC();
Serial.println(String("I = ") + I+ " A");
// Wait one second before the new cycle
delay(100);
}
---------------------------------------------------------------------------------------------------------------