Advertisement
Intermediate Time: 3–4 weeks Electrical Engineering

Smart Meter with IoT Integration

Build an AMI-compatible smart electricity meter with remote reading, prepaid top-up, and tamper detection.

Smart MeterAMIDLMSCOSEMPLCPrepaid Metering
DifficultyIntermediate
Duration3–4 weeks
Components10 items
Steps3 steps

Introduction

Build an AMI-compatible smart electricity meter with remote reading, prepaid top-up, and tamper detection. This comprehensive guide covers everything from design through implementation, testing, and deployment.

Theory & Background

The ATM90E36A performs all 3-phase metering calculations in hardware. Connect 3 CT secondary outputs and 3 VT secondary outputs to designated analog inputs. Configure via SPI registers: set measurement mode (3P4W, 3P3W), calibration constants for CT/VT ratios, phase angle correction for CT accuracy. Read energy registers: APENERGY (accumulated kWh) via SPI every second. Pulse output can drive a standard LED pulse output (1000 imp/kWh typically).

Advertisement

Components & Requirements

10 components required for this project.

#ComponentPurposeQty
1ATM90E36A Metering IC3-phase energy metering with CT/VT inputsx1
2STM32F103 MicrocontrollerMeter intelligence and communicationx1
3SIM800L GSM ModuleRemote data transmission and SMS billingx1
4Current Transformers (100:5A)3-phase current measurementx3
5Voltage Transformers (230V:5V)3-phase voltage measurementx3
6MFRC522 RFID ReaderPrepaid top-up card readerx1
7Optocoupler (PC817)Input isolation for tamper detectionx6
8LCD 3.5" TFT DisplayMeter display and menu interfacex1
9Tamper Detection Switches (magnetic)Detecting cover and terminal tamperingx3
10Sealed Lead connector + meter housingWeatherproof IEC-compliant housingx1

Step-by-Step Implementation

Follow these 3 steps carefully.

1
ATM90E36A Configuration

The ATM90E36A performs all 3-phase metering calculations in hardware. Connect 3 CT secondary outputs and 3 VT secondary outputs to designated analog inputs. Configure via SPI registers: set measurement mode (3P4W, 3P3W), calibration constants for CT/VT ratios, phase angle correction for CT accuracy. Read energy registers: APENERGY (accumulated kWh) via SPI every second. Pulse output can drive a standard LED pulse output (1000 imp/kWh typically).

2
Tamper Detection Implementation

Monitor for common electricity theft attempts: missing neutral (sum of 3-phase currents ≠ 0 by > 5A), terminal cover opening (magnetic switch), meter cover opening (microswitch), reverse current flow (tampered installation), strong magnetic field (meter slowing magnet placed near CT), and bypass detection (current detected in bypass wire via additional CT). Log all tamper events with timestamp and GPS location. Immediately alert utility server via GSM.

3
Prepaid Metering with RFID

Implement a prepaid system: utility loads credit (kWh units) onto RFID cards. Customer taps card on meter's RFID reader. Meter validates card's cryptographic signature, reads kWh credit, adds to balance. As energy is consumed, balance decrements. At 5 kWh remaining: warning beep and SMS alert. At 0 kWh: disconnect load relay and lock until card top-up. This eliminates meter-reading visits and reduces unpaid bill risk for utilities.

Code & Implementation

Core code for smart_meter.cpp:

smart_meter.cpp C/C++
// ATM90E36A SPI communication #include <SPI.h> #define ATM_CS 10  uint16_t atm_read(uint16_t reg) {   SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));   digitalWrite(ATM_CS, LOW);   SPI.transfer16(reg | 0x8000);    uint16_t val = SPI.transfer16(0);   digitalWrite(ATM_CS, HIGH);   SPI.endTransaction();   return val; }  float getVoltage(int phase) {   uint16_t raw = atm_read(0x00 + phase);    return raw * 0.01;  }  float getCurrent(int phase) {   uint16_t raw = atm_read(0x10 + phase);    return raw * 0.001;  }  float getTotalEnergy() {   uint32_t hi = atm_read(0xA0) << 16 | atm_read(0xA1);    return hi * 0.0001;  }

Testing & Troubleshooting

Test Smart Meter with IoT Integration by verifying each subsystem individually before full integration.

!
Troubleshooting Tips

Verify power voltages, check ground connections, use serial monitor for debug.

Real-World Applications

*Utility AMI (Advanced Metering Infrastructure) rollout
*Industrial sub-metering for energy auditing
*Campus energy monitoring system
*Prepaid energy metering for commercial tenants
*Net metering for solar prosumers
*Demand response program monitoring
*EV charging station metering
*Building energy management

Extensions & Next Steps

  • Add time-of-use (ToU) tariff implementation with peak/off-peak rates
  • Implement power quality monitoring with harmonics analysis
  • Build a mesh network of meters for neighborhood energy sharing
  • Add demand forecasting for utility planning support
  • Integrate with blockchain for peer-to-peer energy trading

Interactive Playground

Coming Soon

An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.

Frequently Asked Questions

What communication protocols do smart meters use?
Smart meters use multiple protocols depending on the network layer: DLMS/COSEM (Device Language Message Specification / Companion Specification for Energy Metering) for application-layer standardization, ensuring interoperability between meters and head-end systems. Physical/network layers: PLC (Power Line Communication) for wired networks using existing power cables, RF mesh (ZigBee, LoRa) for wireless AMI networks, GPRS/4G for direct cellular connection, and NB-IoT for low-power wide-area applications.
Advertisement