perkun.eu Services Portfolio Blog About Contact PL
← Portfolio iot

Industrial Embedded Data Logger (ESP32 + Modbus RTU)

Modbus RTU→MQTT gateway on ESP32 with FreeRTOS — industrial sensor data, SD card storage, Grafana dashboard. 99.7% uptime over 12 months, zero data loss on WiFi outages.

ESP32C++FreeRTOSModbus RTURS485MQTTInfluxDBGrafana

Challenge

A manufacturing facility had temperature, humidity and pressure sensors with a Modbus RTU interface — an older protocol with no network connectivity. Data was read once a day by a technician with a laptop. The client wanted real-time monitoring and alerts when parameters go outside normal ranges.

Solution

ESP32 with RS485 module as Modbus RTU → MQTT gateway. FreeRTOS with two tasks: Modbus read every 10s and MQTT publish every 60s. When WiFi is unavailable, data is written to SD card with timestamps; when connectivity returns, automatic sync to the broker (Mosquitto on VPS).

Grafana + InfluxDB on VPS as visualisation and alerting layer. Alerts configured per parameter per zone (Hall A, Hall B, Cold Storage) with escalation: email → SMS after 30 minutes without acknowledgement.

Firmware updated via OTA (ESP32 Arduino OTA) — no need to physically access the device for updates.

Results

  • 99.7% uptime over 12 months of production operation
  • Zero data loss on WiFi outages (SD buffer + auto-sync)
  • Client detected compressor failure 4 hours before physical breakdown based on temperature anomalies