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.
Build an AMI-compatible smart electricity meter with remote reading, prepaid top-up, and tamper detection.
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.
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).
10 components required for this project.
| # | Component | Purpose | Qty |
|---|---|---|---|
| 1 | ATM90E36A Metering IC | 3-phase energy metering with CT/VT inputs | x1 |
| 2 | STM32F103 Microcontroller | Meter intelligence and communication | x1 |
| 3 | SIM800L GSM Module | Remote data transmission and SMS billing | x1 |
| 4 | Current Transformers (100:5A) | 3-phase current measurement | x3 |
| 5 | Voltage Transformers (230V:5V) | 3-phase voltage measurement | x3 |
| 6 | MFRC522 RFID Reader | Prepaid top-up card reader | x1 |
| 7 | Optocoupler (PC817) | Input isolation for tamper detection | x6 |
| 8 | LCD 3.5" TFT Display | Meter display and menu interface | x1 |
| 9 | Tamper Detection Switches (magnetic) | Detecting cover and terminal tampering | x3 |
| 10 | Sealed Lead connector + meter housing | Weatherproof IEC-compliant housing | x1 |
Follow these 3 steps carefully.
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).
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.
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.
Core code for smart_meter.cpp:
// 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; }
Test Smart Meter with IoT Integration by verifying each subsystem individually before full integration.
Verify power voltages, check ground connections, use serial monitor for debug.
An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.