ACS712 current sensor with Arduino-based PLC: wiring and sketch

Non-invasive AC/DC current measurement with Hall-effect sensor on M-Duino
June 18, 2026 by
ACS712 current sensor with Arduino-based PLC: wiring and sketch
Joan F. Aubets - Industrial Shields

The ACS712 is a Hall-effect current sensor by Allegro MicroSystems that outputs an analog voltage proportional to the AC or DC current flowing through it. Connecting one to an Arduino-based PLC gives you non-invasive current measurement with a single analog input and a few lines of sketch code — no shunt resistor, no isolation circuit required.

This post covers the sensor specifications, wiring to an M-Duino PLC, and a working Arduino sketch that reads and converts the analog output to amperes. The same approach applies to any Arduino-based PLC with analog inputs.

ACS712 current sensor module

ACS712 specifications

The ACS712 module is available in three current ranges. Select the variant that matches the load you are monitoring:

VariantCurrent rangeSensitivityOutput at 0 A
ACS712-05B±5 A185 mV/A2.5 V
ACS712-20A±20 A100 mV/A2.5 V
ACS712-30A±30 A66 mV/A2.5 V

Key characteristics common to all variants: supply voltage 5 VDC, bandwidth 80 kHz, output noise 21 mV RMS, total output error ±1.5% at 25 °C. The output at 0 A is always VCC/2 = 2.5 V. Positive current increases output above 2.5 V; negative current decreases it below 2.5 V.

ACS712 output voltage vs sensed current characteristic curve

Requirements

  • Arduino-based PLC with analog inputs (M-Duino 21+, 42+, 58+, or Ardbox Analog)
  • ACS712 current sensor module — 5 A, 20 A, or 30 A variant depending on load
  • Arduino IDE with the Industrial Shields board library installed
  • Load to monitor: motor, heater, pump, or resistive load

No additional libraries required. The conversion uses only built-in Arduino functions.

Wiring

The ACS712 module has three signal connections — VCC, GND, and OUT — plus two load terminals (IP+, IP−) through which the monitored conductor passes.

ACS712 pinM-Duino connection
VCC5 V pin
GNDGND
OUTI0.12 (analog input, pin A0)

M-Duino analog inputs are conditioned for 0–10 V industrial signals. The ACS712 outputs 0–5 V (VCC/2 ± range), so the ADC uses half its range — acceptable for most monitoring tasks. Route the load conductor through the ACS712 sensor opening; the sensor measures the magnetic field generated by the current without breaking the circuit.

ACS712 current sensor wiring connection to Arduino PLC

Arduino sketch

Adjust SENSITIVITY to match your variant: 0.185 for 5 A, 0.100 for 20 A, 0.066 for 30 A.

// ACS712 current sensor — Arduino-based PLC
// Adjust SENSITIVITY: 0.185 (5A) / 0.100 (20A) / 0.066 (30A)

#define SENSOR_PIN   A0        // I0.12 on M-Duino
#define V_REF        2.5       // Output voltage at 0 A (VCC/2)
#define SENSITIVITY  0.185     // V/A — change for your variant
#define NUM_SAMPLES  100       // Samples to average per reading

void setup() {
  Serial.begin(9600);
}

void loop() {
  long sum = 0;
  for (int i = 0; i < NUM_SAMPLES; i++) {
    sum += analogRead(SENSOR_PIN);
    delay(1);
  }
  float avgADC = sum / (float)NUM_SAMPLES;

  // M-Duino 0–10 V input: full ADC range (0–1023) = 10 V
  float voltage = (avgADC / 1023.0) * 10.0;

  // Convert voltage to current in amperes
  float current = (voltage - V_REF) / SENSITIVITY;

  Serial.print("Voltage: ");
  Serial.print(voltage, 3);
  Serial.print(" V  |  Current: ");
  Serial.print(current, 3);
  Serial.println(" A");

  delay(500);
}

The sketch averages 100 samples to reduce ADC noise. At 185 mV/A sensitivity, the ACS712 output noise of 21 mV RMS translates to 0.11 A peak error — averaging brings this down significantly before reporting.

Industrial use cases

Non-invasive current monitoring with the ACS712 covers a wide range of industrial tasks:

  • Motor load monitoring — detect overload or underload conditions that indicate mechanical problems
  • Energy consumption tracking — log current draw per machine for OEE and energy audits
  • Pump and compressor health — current signature changes signal cavitation and bearing wear
  • Heater element verification — confirm elements draw expected current after actuation
  • Circuit breaker pre-trip warning — alert operators before overcurrent reaches trip threshold

For applications requiring better than 1.5% accuracy, consider 4–20 mA loop-powered current transducers connected to the industrial analog inputs of your PLC. The ACS712 suits embedded, low-cost monitoring nodes where moderate accuracy is sufficient.

Running this on Industrial Shields hardware

The M-Duino and Ardbox families from Industrial Shields are programmable controllers built on original Arduino boards — the same hardware and IDE you are already using. M-Duino PLCs (21+, 42+, 58+) are DIN-rail mounted controllers based on the Arduino Mega, with industrial-grade I/O protection, 12–24 VDC power input, and relay, analog, and digital I/Os ready for panel installation. The Ardbox series brings the same industrial hardening to a more compact form factor based on the Arduino Leonardo.

Both families run standard Arduino sketches without modification. The ACS712 example above works as-is — connect the sensor to the analog input, upload via the Arduino IDE, and the PLC reads and reports current inside an IP20-rated enclosure designed for industrial cabinet installation.

​Search in our Blog

ACS712 current sensor with Arduino-based PLC: wiring and sketch
Joan F. Aubets - Industrial Shields June 18, 2026
Share this post
Tags

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

PLC Comparison