Projects / Small DC current meter

Small DC current meter

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANO

    Wire the sensor

    VCC to 5V, GND to GND, OUT to A0.

  2. NANO

    Wire the load in series

    Fan black to IP+, IP- to GND, fan red to 5V.

  3. NANO

    Wire the display

    SDA to A4, SCL to A5, power it from 5V and GND.

  4. NANO

    Upload with the fan unplugged from the sensor

    The sketch measures the zero offset.

  5. NANOACS7121.59 A

    Connect the load

    Current appears in milliamps.

  6. NANO

    Check the supply

    Measure 5V and set VREF.

  7. NANOACS7121.60 A

    Compare

    Multimeter in series on its current range.

  8. NANOACS7121.60 A

    Add loads

    Try one LED with a resistor for a small current.

In short

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

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
ACS712 module VCCNano 5VPower
ACS712 module GNDNano GNDCommon ground
ACS712 module OUTNano A0Analog output, 2.5 V at zero current
Fan red wireNano 5VLoad supply
Fan black wireACS712 IP+ screw terminalCurrent enters the sensor
ACS712 IP- screw terminalNano GNDCurrent returns to ground
LCD module SDA and SCLNano A4 and A5I2C display
LCD module VCC and GNDNano 5V and GNDPower

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.

CheckExpected
Start with no loadZero near 2.5 V, reading 0 mA
Fan connectedReading of roughly 80 to 200 mA, depending on the fan
Single LED with 330 ohmAbout 10 mA, may show 0 as it is below the noise floor
Compare with the meterWithin a few tens of milliamps
Disconnect the fanReading 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 →

Ask Lark AI

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.