Arduino UNO R4 - ACS712 Current Sensor
In this guide, we will learn how to use the ACS712 30A current sensor with the Arduino UNO R4 WiFi or Minima to find out how many amps a motor, a lamp or an LED strip really pulls. A voltage sensor tells you "how strong" the power is. A current sensor tells you "how much" is flowing. In detail, we will learn:
- What the ACS712 module does, and what its pins and screw terminal are for.
- How to put the ACS712 in series with a 12V load and connect it to the Arduino UNO R4.
- How to write a program for the Arduino UNO R4 that finds the zero point by itself and prints the DC current in amps.
- How to use the 14-bit ADC of the Arduino UNO R4 to get finer steps.
- How to measure AC current as an RMS value.

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables STEM V4 IoT Starter Kit (Arduino included) | |
| 1 | × | DIYables STEM V4B IoT Starter Kit (Arduino included) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of ACS712 Current Sensor
The ACS712 is a chip from Allegro that measures current with the Hall effect. Inside it, the current runs through a thick copper path. This current makes a small magnetic field, and a Hall sensor next to the copper turns that field into a voltage. The copper path has only about 1.2 mΩ of resistance, so it hardly changes your circuit. Also, the load side is isolated from the Arduino side (up to 2.1 kV RMS), so the measured circuit has no electrical link to your board.
The chip comes in three versions. They look the same, so check the text on the chip (for example ACS712ELCTR-30A-T):
| Version | Range | Sensitivity |
|---|---|---|
| ACS712 5A | -5A to +5A | 185 mV per amp |
| ACS712 20A | -20A to +20A | 100 mV per amp |
| ACS712 30A | -30A to +30A | 66 mV per amp |
This guide uses the 30A version. Its main specs:
| ACS712 30A | |
|---|---|
| Supply voltage | 5V (4.5V to 5.5V) |
| Measured current | DC and AC, -30A to +30A |
| Output at 0A | about 2.5V (half of the supply) |
| Output at +30A / -30A | about 4.48V / 0.52V |
| Sensitivity | 66 mV per amp |
| Bandwidth | 80 kHz |
| Total output error | about ±1.5% at 25°C |
| Isolation | 2.1 kV RMS |
The output is "ratiometric". This means it follows the real 5V supply. If the supply is 4.9V, the zero point is about 2.45V, not 2.5V. That is why the code measures the zero point at startup, instead of trusting the 2.5V number.

The module has a 3-pin header on one side:
- VCC pin: connect to 5V of the Arduino UNO R4.
- GND pin: connect to GND (0V).
- OUT pin: analog output voltage, connect to an analog pin of the Arduino UNO R4 (A0 in this guide).
On the other side, there is a 2-pin screw terminal (IP+ and IP-, sometimes not labeled). It goes in series with the load: cut one supply wire of the load and put the terminal in between, so all the load current flows through the module. When current goes from IP+ to IP-, the reading is positive. If your reading is negative, just swap the two wires. A small LED on the module shows that it has power.
How good is the 30A version for small currents? The 30A version is made for big currents, so it is coarse for small ones. With the normal 10-bit reading (0 to 1023), one step is about 4.9 mV, which is about 74 mA. The Arduino UNO R4 can read its analog pins with 14 bits (0 to 16383), so one step is only about 0.3 mV. This does not remove the noise of the sensor itself: at 0A, the value still jumps by about ±50 to 100 mA. But together with averaging, it gives a calm and stable number. The module fits loads of about 0.5A and more, like motors, lamps, LED strips, heaters and chargers.
How the Voltage Becomes Amps
At 0A, the OUT pin sits at the zero voltage (about 2.5V). Each amp moves it by 0.066V, up for one direction and down for the other. So the formula is:
For example, if the zero voltage is 2.493V and the Arduino UNO R4 reads 2.559V, the current is (2.559 - 2.493) / 0.066 = 1.00A.
Wiring Diagram
The Arduino UNO R4 works with 5V on its analog pins, the same as the ACS712 output. So the OUT pin goes straight to A0, and no voltage divider is needed. The 12V side is separate: the 12V adapter feeds the 12V DC device (such as a DC motor, LED strip or lamp) through the screw terminal of the module.

This image is created using Fritzing. Click to enlarge image
See The best way to supply power to the Arduino Uno R4 and other components.
| ACS712 Module | Arduino UNO R4 |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | A0 |
| Load side | Connect to |
|---|---|
| Screw terminal IP+ | positive (+) of the 12V DC power jack |
| Screw terminal IP- | positive (+) wire of the DC device |
| DC device negative (-) wire | negative (-) of the 12V DC power jack |
※ NOTE THAT:
Safety first. Mains AC (110V/220V) is dangerous and can kill. If you are a beginner, practice only with a low-voltage DC load like the 12V DC device in this guide. When the module is used in a mains circuit, the screw terminal and the copper side carry the full mains voltage. Never touch the terminal or the wires while the circuit is live.
How To Program For ACS712 Current Sensor
- Switch the analog pins to 14-bit readings (values from 0 to 16383):
- Turn a raw reading into volts:
- Find the zero point once in setup(), while the load is off. Read the sensor 1000 times and take the average:
- In loop(), average 200 readings to calm the noise, then turn volts into amps:
Arduino UNO R4 Code - ACS712 DC Current
Detailed Instructions
Follow these instructions step by step:
- If this is your first time using the Arduino Uno R4 WiFi/Minima, refer to the tutorial on setting up the environment for Arduino Uno R4 WiFi/Minima in the Arduino IDE.
- Wire the components according to the provided diagram.
- Keep the 12V adapter unplugged for now, so no current flows through the sensor.
- Connect the Arduino Uno R4 board to your computer using a USB cable.
- Launch the Arduino IDE on your computer.
- Select the appropriate Arduino Uno R4 board (e.g., Arduino Uno R4 WiFi) and COM port.
- Copy the code above and paste it into the Arduino IDE.
- Open the Serial Monitor.
- Click the Upload button to upload the code to the Arduino UNO R4. The board measures the zero point in the first second after it starts.
- Now plug in the 12V adapter. The DC device turns on.
- Check the results on the Serial Monitor.
The first lines show the idle noise: a few hundredths of an amp, up and down around 0. This is normal for the 30A version. Here, the DC device is a 12V DC motor. When the motor starts, it pulls a short burst of current, then it settles at about 0.8A. If you slow the motor down by holding the shaft lightly, the current goes up.
※ NOTE THAT:
If the current reads about 0.5A or more with the load off, the zero point was measured while current was flowing. Unplug the 12V adapter and press the RESET button of the Arduino UNO R4 to measure it again.
Measuring AC Current
With AC, the current changes direction many times per second (50 or 60 times, depending on your country). So the OUT pin swings above and below the zero point all the time. One single reading means nothing, and a plain average is close to 0. Instead, we use the RMS value, which is the number a normal AC meter shows:
- Sample the sensor for 200 ms. That covers 10 cycles at 50 Hz or 12 cycles at 60 Hz.
- For each sample, take the distance from the zero voltage and square it.
- Take the average of the squares, then the square root. Divide by 0.066 to get amps.
※ NOTE THAT:
Again: mains voltage is dangerous. Only measure a mains load if you know how to work with mains safely, keep the circuit unplugged while you wire it, and never touch the screw terminal while the power is on.
The wiring on the Arduino UNO R4 side stays the same. Only the load changes: the screw terminal goes in series with one wire of the AC load.
Arduino UNO R4 Code - ACS712 AC Current
Detailed Instructions
- Keep the AC load switched off.
- Copy the code above and paste it into the Arduino IDE.
- Click the Upload button to upload the code to the Arduino UNO R4.
- Wait for the "Zero point" line in the Serial Monitor, then switch the AC load on (for example a small heater).
With the load off, the RMS value is not exactly 0. Noise always makes a small positive number after squaring, so a value under about 0.1A means "no current".