Smart Meter Firmware — DLMS/COSEM
Standards-compliant metrology and multi-channel communication firmware for utility-grade smart electricity meters, built on the Hitrend HT5023 metrology MCU.
Overview
Smart electricity meters sit at the intersection of precision measurement, embedded real-time systems, and utility-grade communication standards. For this project, I developed the firmware for two core subsystems of a smart meter built on the Hitrend Technology HT5023 metrology MCU: the measurement unit (metrology, energy accumulation, tamper and event detection) and the communication unit, spanning UART, DLMS/COSEM, RF, PLC, and Cellular channels for data exchange with head-end systems and field tools.
Challenge
Utility metering is one of the most protocol-heavy domains in embedded systems. A meter isn't just measuring energy — it has to:
- Accumulate energy readings at a legally-defined accuracy class, over years of field operation, while resisting tamper and fraud
- Detect and log events (power loss, cover opening, reverse current, magnetic tampering) in real time
- Expose all of this through a standardized, vendor-agnostic data model so any Head-End System (HES) — regardless of manufacturer — can read and manage it
- Communicate reliably over whichever channel a given deployment demands — a wired RS485/PLC network in one country, RF mesh in another, cellular where backhaul infrastructure is thin
- Do all of the above on constrained hardware, unattended, for a decade or more
The industry's answer to the interoperability problem is DLMS/COSEM (IEC 62056) — a rich, object-oriented protocol standard. It solves interoperability, but implementing it correctly requires careful COSEM object modelling and precise handling of the association and data-exchange semantics that many implementations get subtly wrong.
Approach
Measurement subsystem — built on the HT5023
- Metrology firmware leveraging the HT5023's 24-bit Sigma-Delta (Σ-Δ) ADCs, dedicated to current and voltage sensing, for high-resolution active/reactive/apparent energy accumulation across multiple tariffs
- Firmware calibration and signal-chain design tuned to comfortably meet IEC 62053-22 (Class 0.5S) and IEC 62053-21 (Class 1.0 / Class 1) active energy accuracy — the accuracy classes utilities require for revenue-grade metering
- Real-time tamper and event detection logic, with event logging tied directly into the COSEM object model
- Firmware designed for long-term field accuracy and drift resistance, not just lab-bench performance
Communication subsystem — multi-channel by design
- DLMS/COSEM (IEC 62056) object modelling — COSEM interface classes mapped cleanly onto the standard's logical device model, so meter data is readable by any compliant HES
- UART as the local/serial interface for field tools and module-to-module communication
- RF communication module for wireless mesh/point-to-point deployments
- PLC (Power Line Communication) module for wired-grid deployments where the power line itself carries the data
- Cellular module for direct-to-HES connectivity in regions without local network infrastructure
- A communication architecture that lets the same measurement core serve multiple deployment topologies just by swapping the active comms module — rather than re-architecting firmware per market
Results
Why it matters (industry)
This firmware isn't a lab prototype — it's built to sit inside meters that utilities deploy by the hundreds of thousands, expect to run for a decade without a truck roll, and need to interoperate with HES/MDM platforms from entirely different vendors. Achieving Class 0.5S / Class 1.0 accuracy on the HT5023's 24-bit metrology front-end means the firmware is legally deployable for revenue metering, not just monitoring. And supporting DLMS/COSEM across UART, RF, PLC, and Cellular means one firmware core adapts to whatever comms infrastructure a given country or utility already has — wired grid, wireless mesh, or cellular backhaul — without re-engineering the metrology layer. That's the practical value: fewer field failures, true multi-vendor interoperability, revenue-grade accuracy, and deployment flexibility across network topologies.
Why it matters (academic / technical depth)
This project is a case study in implementing a formal, object-oriented communication standard on a resource-constrained metrology MCU — balancing the abstract COSEM object model against the hard real-time, accuracy, and memory constraints of a Sigma-Delta-based measurement system. It also required understanding the physical-layer tradeoffs across four distinct communication mediums (UART, RF, PLC, Cellular) and how each interacts with the DLMS/COSEM transport layer differently. This spans metrology signal processing, embedded real-time systems, and standards-based multi-modal communication — the same fundamentals underpinning my published research on multi-node industrial communication (RS485, ICCIT 2024, Best Paper & Best Technical Presentation).
Gallery
35 views