IoT Electricity Theft Detection
A smart meter that spots tampering and bypass with anomaly alerts.
Addresses a real problem for Pakistani utilities: an IoT meter compares expected and measured consumption, detects anomalies that indicate theft, and raises remote alerts for the distribution operator.
README · rendered from GitHub
IoT Based Electricity Theft Detection System
Introduction
Electricity theft is a major issue affecting power utilities and national economies. According to Islamabad Times, nearly 360 billion rupees worth of electricity was stolen in 2022-23. This IoT-based solution detects unauthorized consumption by monitoring the current differential in a circuit using ACS712 sensors. If theft is detected, the system disconnects the power using a relay, activates a buzzer, and sends an SMS alert to the configured number via GSM.
Project Overview
This smart electricity meter is built using:
- Arduino UNO: Microcontroller for logic processing.
- ACS712 Current Sensors: Measure current at two different points.
- LCD 16x2 Display: Show current readings and alerts.
- Relay Module: Cuts off power if theft is detected.
- Buzzer: Audible alert on theft.
- GSM Module: Sends SMS to user (in expanded version).
- Potentiometer (10k): Controls contrast for LCD.
The system compares two current values. If the difference exceeds a threshold, it assumes power is being illegally diverted.
Features
- Dual Current Monitoring using ACS712 sensors
- Differential Current Detection to spot theft
- Relay Cutoff + Buzzer Alarm when theft is detected
- SMS Alert via GSM module (optional/expandable)
- Real-Time LCD Display of current values and theft status
- Auto Reset After Alert (if desired via code update)
Hardware Components
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| ACS712 Current Sensor (20A) | 2 |
| LCD Display (16x2) | 1 |
| Relay Module | 1 |
| Buzzer | 1 |
| GSM Module (SIM800L) | 1 (optional) |
| Potentiometer (10k) | 1 |
| Jumper Wires | - |
| Breadboard/PCB | 1 |
| Power Supply | 1 |
Working Principle
- The system constantly measures current from two separate points using ACS712 sensors.
- If both values are close (within threshold), the system assumes normal usage.
- If there's a significant difference, the system detects power theft.
- On detection:
- The relay is triggered to cut off power.
- A buzzer sounds an alert.
- A message is sent via GSM (if configured).
Software Flow & Logic
Working Logic
- Read both sensors and calculate current values
- Compute differential current
- If
differentialCurrent ≥ threshold (e.g., 50):- Display “POWER THEFT”
- Trigger relay + buzzer
- Optionally send SMS alert
- Else, display both currents and differential
Pin Configuration
| Component | Arduino Pin |
|---|---|
| LCD RS, E, D4-D7 | D7, D6, D5, D4, D3, D2 |
| ACS712 Sensor 1 | A0 |
| ACS712 Sensor 2 | A1 |
| Buzzer | D8 |
| Relay | D9 |
| GSM TX/RX | D10/D11 (if used) |
Code Summary
- Libraries Used:
LiquidCrystal - Sensor Sensitivity: 100mV/A
- Voltage Reference: 5V (5000 mV)
- Offset Voltage: 2500 mV (for both sensors)
- RMS Calculation:
(Vpeak - offset) / sensitivity / √2
> Ensure that ACS712 sensors are properly calibrated and isolated from mains supply!
Sample Output
LCD Display: I1 = 2.55 I2 = 2.53 A Vd = 0.02
OR
POWER THEFT !! -Disconnected-
SMS Alert Integration
To enable SMS alerts:
- Connect SIM800L GSM module
- Use
Serialto send AT commands - Configure destination number using
AT+CMGS
Example:
Serial.println("AT+CMGF=1");
Serial.println("AT+CMGS=\"+923XXXXXXXXX\"");
Serial.println("Power Theft Detected!");
Future Enhancements
- Integrate IoT Cloud Platform (e.g., ThingSpeak, Blynk) for remote monitoring
- Replace GSM with Wi-Fi (ESP8266) for real-time internet connectivity
- Develop a Mobile App Dashboard for live data tracking
- Incorporate Machine Learning models to analyze and predict theft behavior
- Add an Auto Reset Relay function after theft alert acknowledgment
Applications
This system has wide-ranging real-world use cases, particularly in countries facing energy theft and distribution losses. Some of the key applications include:
- Residential Electricity Monitoring: Detect unauthorized connections or tampering in household energy usage.
- Commercial & Industrial Energy Management: Prevent illegal power usage in factories, shops, and commercial facilities.
- Smart Grid Integration: Can be scaled into smart grids for automated theft detection and control at the transformer/distribution level.
- Utility Company Deployment: Helps utility providers reduce revenue losses and monitor consumer integrity.
- Educational & Research Projects: Ideal for IoT, embedded systems, and energy efficiency-based academic research or student final-year projects.
- Remote Locations Monitoring: With GSM/WiFi integration, the system can operate in remote areas without physical inspection.
- Tamper Detection in Prepaid/Postpaid Meters: Add-on module to modern meters for enhanced security and power usage audit.
Troubleshooting
| Issue | Solution |
|---|---|
| LCD not displaying | Check potentiometer setting and wiring |
| No current reading | Calibrate sensor, verify VCC & GND |
| Relay not switching | Confirm digital HIGH signal and connections |
| GSM not working | Use active SIM, check signal & power supply |
| False theft alerts | Tune or raise the differential threshold |
License
This project is licensed under the MIT License. Feel free to use, modify, and distribute it with proper attribution.
Demo Video
https://github.com/user-attachments/assets/ea9b1b55-9d12-4969-9dc2-6b3e9aedabbd
Remarks:
More in Embedded
Related projects
Embedded2025FreeRTOS Smart Energy Monitor
STM32F746 tasks compute Vrms, Irms and kWh; an ESP32 pushes it to a cloud dashboard.
- STM32F746
- FreeRTOS
- ESP32
- C/C++
- Embedded2024
Crowd-Sourced AQI Monitor
Six sensors, Bluetooth to a phone app, and AQI within 1% of the US Embassy station.
- Arduino UNO
- C/C++
- PMS5003
- MQ-series
Embedded2024Fully Automated Egg Incubator
ATmega328P climate control and egg turning that hatched every pigeon egg in 18 days.
- ATmega328P
- Arduino IDE
- Atmel Studio
- Proteus