Build it step by step
0 of 8 doneWire the sensor
VCC to 5V, GND to GND, OUT to A0.
Wire the load in series
Fan black to IP+, IP- to GND, fan red to 5V.
Wire the display
SDA to A4, SCL to A5, power it from 5V and GND.
Upload with the fan unplugged from the sensor
The sketch measures the zero offset.
Connect the load
Current appears in milliamps.
Check the supply
Measure 5V and set VREF.
Compare
Multimeter in series on its current range.
Add loads
Try one LED with a resistor for a small current.
How do you build a small DC current meter?
A current sensor module measures how much current a small 5 V fan or LED load draws and shows it in milliamps. You need Arduino Nano, ACS712 current sensor module (5 A / 20 A / 30 A), 16x2 LCD with I2C backpack (PCF8574), 5 V DC fan 40 mm, Digital multimeter, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points. It takes 8 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- DisplaysBuy
- Motors & ActuatorsBuy5 V DC fan 40 mm × 1
- Tools & InstrumentsBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| ACS712 module VCC | Nano 5V | Power |
| ACS712 module GND | Nano GND | Common ground |
| ACS712 module OUT | Nano A0 | Analog output, 2.5 V at zero current |
| Fan red wire | Nano 5V | Load supply |
| Fan black wire | ACS712 IP+ screw terminal | Current enters the sensor |
| ACS712 IP- screw terminal | Nano GND | Current returns to ground |
| LCD module SDA and SCL | Nano A4 and A5 | I2C display |
| LCD module VCC and GND | Nano 5V and GND | Power |
Code
The ACS712 is a Hall effect current sensor: the current you want to measure flows through a copper path inside the chip, and the chip outputs a voltage that moves up or down from half the supply, about 2.5 volts at zero current. On the 5 amp version the output changes by 185 millivolts for every amp, so 100 milliamps moves the output only 18 millivolts, which is about four steps of the Nano ADC. That is why this build averages 200 readings, measures the zero offset at start with the load disconnected, and ignores readings under 15 milliamps. Wire the load in series, so all of its current flows into IP+ and out of IP-, never across the sensor terminals as you would with a voltmeter. The supply here is only the 5 volt USB rail and a small fan, so this is a low voltage build. The sensor reading is tied to the supply voltage, and a USB port can sit at 4.8 to 5.2 volts, so check it with a multimeter and set VREF to match. Compare the displayed milliamps with a multimeter on its current range wired in series, and expect an error of a few tens of milliamps, which is normal for this module. Do not use this setup for mains.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // try 0x3F if the screen stays blank
const int SENSOR = A0;
const float VREF = 5.0; // USB supply, check it with a meter
const float SENS = 0.185; // volts per amp for the 5 A module (0.100 for 20 A, 0.066 for 30 A)
float zeroV = 2.5;
float readVolts() {
long sum = 0;
for (int i = 0; i < 200; i++) sum += analogRead(SENSOR); // average out noise
return (sum / 200.0) * VREF / 1023.0;
}
void setup() {
lcd.init();
lcd.backlight();
lcd.print("Keep load off...");
delay(1500);
zeroV = readVolts(); // measure the zero offset with no current
lcd.clear();
lcd.print("Zero ");
lcd.print(zeroV, 3);
lcd.print(" V");
delay(1500);
lcd.clear();
}
void loop() {
float amps = (readVolts() - zeroV) / SENS;
float mA = amps * 1000.0;
if (abs(mA) < 15) mA = 0; // below the noise floor of this sensor
lcd.setCursor(0, 0);
lcd.print("Current ");
lcd.setCursor(0, 1);
lcd.print(mA, 0);
lcd.print(" mA ");
delay(300);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Start with no load | Zero near 2.5 V, reading 0 mA |
| Fan connected | Reading of roughly 80 to 200 mA, depending on the fan |
| Single LED with 330 ohm | About 10 mA, may show 0 as it is below the noise floor |
| Compare with the meter | Within a few tens of milliamps |
| Disconnect the fan | Reading returns to 0 |
If it does not work
Reading is negative
Swap the load wires on IP+ and IP-.
Reading stuck near zero
Check the load really passes through the sensor terminals.
Reading drifts
Re-upload with the load off so the zero is measured again.
Screen blank
Try address 0x3F and turn the backlight contrast screw.
Values far off
Check the module version and set SENS to 0.100 or 0.066.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the small DC current meter?
Arduino Nano, ACS712 current sensor module (5 A / 20 A / 30 A), 16x2 LCD with I2C backpack (PCF8574), 5 V DC fan 40 mm, Digital multimeter, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points.
How long does the small DC current meter take to build?
About 90 minutes for a beginner maker, in 8 steps.
How do I know the small DC current meter works?
Start with no load: Zero near 2.5 V, reading 0 mA. Fan connected: Reading of roughly 80 to 200 mA, depending on the fan. Single LED with 330 ohm: About 10 mA, may show 0 as it is below the noise floor.
Reading is negative: what should I check?
Swap the load wires on IP+ and IP-.
Reading stuck near zero: what should I check?
Check the load really passes through the sensor terminals.
Reading drifts: what should I check?
Re-upload with the load off so the zero is measured again.
Screen blank: what should I check?
Try address 0x3F and turn the backlight contrast screw.
