MQTT-based telemetry system for SELEC EM2M energy meter using ESP32.
This project demonstrates a complete IoT pipeline: ESP32 → Modbus (EM2M) → MQTT → Cloud / Dashboard
- Clean integration with EM2M Modbus driver
- Publishes structured JSON data
- Multi-rate telemetry:
- Fast (3s): Voltage, Current, Frequency, PF
- Power (10s): Active/Reactive/Apparent Power
- Energy (60s): Energy + Demand metrics
- MQTT ready (HiveMQ, Mosquitto, etc.)
- ESP32
- MAX485 (RS485 to TTL)
- SELEC EM2M Energy Meter
| ESP32 | MAX485 |
|---|---|
| TXD2 | DI |
| RXD2 | RO |
| GPIO4 | RE/DE |
em2m/device-id/fast em2m/device-id/power em2m/device-id/energy
{ "voltage": 230.5, "current": 0.42, "frequency": 50.0, "pf": 0.98 }
-
Install dependencies:
- WiFi
- PubSubClient
- EM2M driver
-
Replace user configurable settings
- WiFi Ssid
- WiFi Password
- MQTT Broker
- MQTT Port
- MQTT ClientId
- MQTT Topics
-
Upload to ESP32
- Select correct board and port
- Flash using ArduinoIDE / PlatformIO
ESP32 reads meter data via Modbus RTU (RS485) Data is processed using EM2M driver JSON payloads are published to MQTT broker Can be consumed by dashboards, databases, or analytics systems
MIT License