Arduino current sensor project

With this project, we are going to be working with a less popular sensor that we have been so far: the current sensor.

A current sensor can be super useful to monitor the amount of current that flows into a motor, for example, this can help avoid overloading your motor when it is in use and the same time help preserve the motor from burning. You can also use a current sensor to calculate the energy consumption of a circuit.

The name of the sensor we are going to use here is ACS712.

Let’s get started.

Parts needed

It is very useful to have jumper wires with alligator clips to make the connection of the motor to the battery easy.

We will also need some male to female cables to connect the display and the sensor to the Arduino.  There are no pins connected to the digital side of Arduino. We used one analog pin, SDA and SCL for the I2C communication with the display.

Keep in mind that on the schematic, the blue cables are GND and the red cables are VCC (5V).

The 9V battery is for illustration purposes only, you can use any different battery as long as it fits with your the parameters of your motor.

When you are done connecting, upload the following code to the Arduino board.

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,20,4);
void setup() {

void loop() {

float value=0.0;
long int sum_of_reads = 0;

for (int x = 0; x < 200; x++){
sum_of_reads += analogRead(A0);
value = sum_of_reads/200;
value = (2.5 - (value * (5.0 / 1024.0)) )/0.066;
value = abs(value);
value -= 0.15;

lcd.setCursor(0, 0);
lcd.print("Current: ");
lcd.setCursor(0, 1);
lcd.print(" A");

To make our readings more reliable, we used the for loop to read the output of the sensor multiple times then output the average value. We’ve also subtracted 0.15 from the readings to serve as an error correction, thanks to this we have 0.00A when the current is not flowing through the circuit. You can see the result on the LCD but also on the serial monitor.

As you can see in the video below, I am trying to stop shaft of the motor with my fingers and as the result of this, the current is increasing which is normal. You can also try working with a bigger motor or even building an Arduino current meter for your workshop.

That’s all for this Arduino project. Waiting to hear from you in the comment section below!


Related Posts