Current Sensor (ACS712) with Arduino UNO: Using the Hall Effect


To measure the current passing through the wire, ACS712 is the best current sensor to deal with, as it can measure up to 5A

In this tutorial, we’ll interface the current sensor (ACS712) with Arduino Uno, dealing with current sensing and utilization for current control. This tutorial provides the coding, wiring diagram and component list.

Current Sensor Introduction

In industrial, commercial, and communications systems, the ACS712 provides cost-effective and precise AC or DC current sensing solutions. The circuit is made up of a precise, low-offset linear Hall circuit with a copper conduction route near the die’s surface. The Hall IC converts the magnetic field generated by the applied current flowing via this copper conduction route into a proportionate voltage. The magnetic signal is close to the Hall transducer, which improves device accuracy.

ACS712 Current Sensor

Working Principle of Current Sensor

The ACS712 generates an analogue signal from the Vout pin. The Vout voltage fluctuates linearly with the uni- or bi-directional AC or DC primary sampled current. The noise is removed by adding a capacitor and inductor filter with values that vary depending on the application. The signal leads are electrically insulated from the conductive path’s terminals optocoupler. This enables the ACS712 utilize in applications that require electrical isolation without the use of expensive opto-isolators or other isolation techniques.

Hall Effect Working
Hall Effect Working

What We Need

Arduino Uno R3 board

As usual, I suggest adding from now to your favourite e-commerce shopping cart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continue with the project or remove them from the shopping cart. So, hardware will be only:

Check hardware prices with the following links:

Amazon Arduino Uno box
Amazon ACS712 current sensor box
Amazon Breadboard box
Amazon Dupont Wiring box

Step-by-Step Procedure

Wiring Diagram of Current Sensor with Arduino

There are 3 pins of the current sensor, VCC connects to the +5V, Ground Connect with the GND and OUT connects with the A0 of the Arduino Uno. The current sensor is an analogue, which value varies from 0 to 5V.

acs712 current sensor arduino wiring diagram

Get currentsensor.ino, Code Explanation

Connect your PC to Arduino and open Arduino IDE. For the very first steps, you can refer to Connecting Windows PC with Arduino tutorial. Get the current Sensor code from the download area with the link:

Code Explanation Section

Section 1: Current sensor and Acsvalue variables are declared for displaying and reading the current values. Setup starts in which the baud rate of the serial monitor is set at 9600.

float currentvalue = 0.0f; // current display variable
float AcsValue = 0.0f; // current reading variable
 * Start of Setup
void setup() 

Section 2: Reading of the sensor perform from pin A0.

As explained in code comments, the formula implements the following measure:

current_value = mean_voltage_error – (sensor_value * (max_voltage / resolution_steps)) /voltage_change_per_Ampere.

Then, we print the read voltage and the current value on serial monitor.

 * Start of Loop
void loop() {
  AcsValue = analogRead(A0);
  currentvalue = (2.5 - (AcsValue * (5.0 / 1024.0)) ) / 0.185; 
  // 2.5 is the voltage of mean error so needs to be seperated.
  // AcsValue is the current sensor value. 
  // 5/1024 are the number of steps.
  // 0.185 is the voltage change per 1 amperes. 
  // currentvalue= meanvoltageerror - (sensorvalue * (voltage/resolution))/ voltage change per Ampere
  Serial.print("initialValue: ");


In the serial monitor, the voltage produces by the sensor display. Voltage and current displays on the serial monitor to see the resemblance of the values.

Important Note: (I don’t recommend this if you are not well ) This sensor can measure up to 5A. To increase the current measurement change the Resistor R1 on the sensor and replace it with a shunt: just connect it the same as the terminal of the resistor removed. Each end of the terminal with each side of the resistor pad on the sensor. R1 resistor must be removed when adding the shunt.

acs712 arduino Serial Monitor Results

What’s Next

Please find more tutorials on Arduino in peppe8o Arduino archives.


Umar Jamil

For any queries and help for work, please contact me at:
Whatsapp: +92-346-661-7017/ Link

How useful was this post?

Click on a star to rate it anonymously!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?