v1.0 ยท Arduino Library Manager

Your sensor is
lying to you.

ACS712 reads 0.3A with no load. Voltage jumps between 12.4 and 12.7 on the LCD. It's not the sensor. It's your code. IndustrialSense fixes that.

Get Started
Library Manager โ†’ IndustrialSense

Three lines. Done.

No config structs. No init sequences. Declare, begin, read.

01_Basic_Usage.ino
#include <IndustrialSense.h>

IndustrialCurrent currentSensor(ACS712_20A, A0);
IndustrialVoltage voltageSensor(A1, 30000.0, 7500.0);

void setup() {
    currentSensor.begin();
    voltageSensor.begin();
}

void loop() {
    float amps  = currentSensor.read();
    float volts = voltageSensor.read();
    delay(500);
}
Every read() runs the full pipeline: oversample โ†’ filter โ†’ convert โ†’ deadzone โ†’ smooth. Lab-grade output from a $2 sensor.

Raw analogRead() is not enough.

ADC noise. Thermal drift. Non-linear sensors. You know the drill. Here's what this library does about it.

K

Adaptive Kalman Filter

Locks onto stable readings. Only reacts to real current changes, not ADC noise from your motor driver.

C

Multi-Point Calibration

10 reference points, auto-interpolation. Your sensor isn't linear and we don't pretend it is.

S

Persistent Storage

EEPROM on AVR, NVS on ESP32. Calibration survives power cycles and firmware updates.

Z

Auto-Zero

Detects 0A for 5+ seconds, then silently recalibrates the offset. Handles thermal drift automatically.

64

64ร— Oversampling

64 samples averaged per read. 3 extra bits of resolution. 13-bit accuracy from a 10-bit ADC, under 1ms.

fn

Custom ADC

Pass a function pointer to your ADS1115 or MCP3008. The pipeline keeps working. No fork needed.

See the difference.

Feature Raw analogRead() Other Libraries IndustrialSense
Noise filtering โœ— Simple averaging โœ“ Adaptive Kalman
Zero-current stability โœ— Reads 0.2โ€“0.5A โœ— Manual offset โœ“ Auto-zero + deadzone
Thermal drift โœ— โœ— โœ“ Auto-recalibrates
Non-linear correction โœ— โœ— Linear only โœ“ 10-point interpolation
Calibration saved โœ— Lost on reboot โœ— Manual EEPROM โœ“ Auto NVS/EEPROM
Runtime calibration โœ— Reflash needed โœ— โœ“ Serial/MQTT
Cross-platform โœ— ESP32 or AVR only โœ“ Both + fallback
External ADC โœ— โœ— โœ“ Function pointer
Beginner-friendly โœ“ But inaccurate โœ“ But limited โœ“ 3 lines to start

No datasheet needed.

Pass the enum. Sensitivity is loaded automatically.

Enum Sensor Sensitivity Range
ACS712_05AACS712 5A185 mV/Aยฑ5A
ACS712_20AACS712 20A100 mV/Aยฑ20A
ACS712_30AACS712 30A66 mV/Aยฑ30A
ACS758_50BACS758 50B (Bidirectional)40 mV/Aยฑ50A
ACS758_100UACS758 100U (Unidirectional)20 mV/A0โ€“100A

Voltage Divider.

Vin โ”€โ”€โ”€[ R1 = 30kฮฉ ]โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€[ R2 = 7.5kฮฉ ]โ”€โ”€โ”€GND โ”‚ โ””โ”€โ”€โ–ถ A1 (ADC Input) Divider Ratio = (R1 + R2) / R2 = 37500 / 7500 = 5.0ร— Max Input (5V ref) = 5.0 ร— 5.0 = 25.0 V Max Input (3.3V ref) = 3.3 ร— 5.0 = 16.5 V

Calibrate without reflashing.

Already deployed? Send commands over Serial, MQTT, or Bluetooth. Changes persist across reboots.

v12.5 Map current ADC reading to 12.5V. Auto-saved. Up to 10 points.
v0 Set zero-voltage reference. Connect input to GND first.
auto Force zero-offset recalibration now. Fixes thermal drift. Saved to EEPROM/NVS.
reset Wipe all calibration data. Back to factory defaults.
Calibration Workflow
// In your loop(), enable serial commands:
if (Serial.available()) {
    String cmd = Serial.readStringUntil('\n');
    voltageSensor.processCommand(cmd);  // "v12.5", "reset"
    currentSensor.processCommand(cmd);  // "auto", "reset"
}

API.

IndustrialCurrent
void begin()
Initialize sensor. Auto-detects ADC resolution, loads saved offset, seeds Kalman filter.
float read()
Full pipeline: oversample โ†’ Kalman โ†’ convert โ†’ deadzone โ†’ auto-zero. Returns Amperes.
float readRaw()
Raw oversampled ADC value before Kalman. For diagnostics.
void setKalmanProcessNoise(float Q) Advanced
Process noise Q. Higher = trust measurements more (noisier). Default: 0.01
void setKalmanMeasurementNoise(float R) Advanced
Measurement noise R. Higher = trust model more (smoother, slower). Default: 0.5
void setKalmanInnovationThreshold(float rho) Advanced
Skip Kalman update if |change| < rho. Set 0 to disable. Default: 0.5
void setOversampleCount(uint16_t count)
ADC samples per read. More = better resolution, slower. Default: 64
void setDeadzone(float amps)
Readings below threshold forced to 0.0A. Default: 0.20A
void forceAutoZero()
Immediately recalibrate zero offset from current ADC reading.
void setCustomADCFunction(CustomADCReadFunc func) Advanced
Inject custom ADC. Signature: int myRead(uint8_t pin). For ADS1115 etc.
void saveCalibration() Persistence
Save zero-offset to EEPROM/Preferences.
bool processCommand(const String& cmd)
Parse calibration command. Supports "auto" and "reset". Returns true if recognized.
IndustrialVoltage
void begin()
Initialize sensor. Loads calibration map, seeds EMA.
float read()
Full pipeline: oversample โ†’ interpolation โ†’ EMA smooth. Returns Volts.
bool addCalibrationPoint(float realVoltage)
Read current ADC, map to given voltage. Auto-sorted. Returns false if full (10 points).
void setEmaAlpha(float alpha)
EMA smoothing factor (0, 1]. Higher = less smoothing. Default: 0.15
void saveCalibration() Persistence
Save all calibration points to EEPROM/Preferences.
bool processCommand(const String& cmd)
Parse command. Supports "v<value>" and "reset". Returns true if recognized.

Architecture.

IndustrialSense/ โ”œโ”€โ”€ library.properties โ† Arduino Library Manager metadata โ”œโ”€โ”€ keywords.txt โ† IDE syntax highlighting โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ IndustrialSense.h โ† Public API (include this) โ”‚ โ”œโ”€โ”€ IndustrialCurrent.cpp โ† Kalman + Auto-Zero + Deadzone โ”‚ โ”œโ”€โ”€ IndustrialVoltage.cpp โ† NL Interpolation + EMA โ”‚ โ””โ”€โ”€ StorageManager.h โ† ESP32 Preferences / AVR EEPROM โ””โ”€โ”€ examples/ โ”œโ”€โ”€ 01_Basic_Usage/ โ† 3-line quickstart โ””โ”€โ”€ 02_Advanced_Calibration/โ† Serial commands, Kalman tuning
Current Sensor: ADC โ†’ [Oversample 64ร—] โ†’ [Adaptive Kalman] โ†’ [ADCโ†’Amps] โ†’ [Deadzone] โ†’ [Auto-Zero] โ†’ Output Voltage Sensor: ADC โ†’ [Oversample 32ร—] โ†’ [NL Interpolation / Divider Math] โ†’ [EMA Smooth] โ†’ Output Storage: processCommand() โ†’ save() โ†’ โ”Œโ”€ ESP32: Preferences (NVS) โ””โ”€ AVR: EEPROM.update()

What you actually get.

1

Ship faster

Stop rewriting moving-average filters. Install and focus on your product.

2

Deploy and forget

Auto-zero + persistent calibration. Setup once, runs for years.

3

Scale without rewriting

Start with analogRead(), swap to ADS1115 later. Same API, zero refactoring.

What's next.

v1.1 AC current. True RMS for CT sensors and ACS712 on mains.
v1.2 Power calculation. Real-time Watts, kWh, power factor.
v1.3 Diagnostics. Noise floor analysis, calibration health, serial export.
v2.0 Multi-channel. One manager, many sensors, shared storage.