Architecture Overview

Entry Point

The application starts from main, which creates a Sensor.Sensor.Sensor instance and calls setup() followed by loop().

Configuration

Device configuration is loaded from two sources:

  1. Static configConfiguration/config.json, loaded by Configuration.config.Config

  2. Dynamic config – Fetched from the Gateway at startup via Manager.Manager.Manager

Sensing Loop

The main loop in Sensor.Sensor.Sensor.loop() performs these steps each cycle:

  1. Read all enabled sensors via their wrapper’s getSensorReading()

  2. Average readings over the configured interval

  3. Compute derived indices (WBGT, dew point, etc.)

  4. Post data to Gateway via Manager.Manager.Manager.sendData()

  5. Send realtime data via Manager.Manager.Manager.sendRealtimeData()

Communication Threads

Several communication interfaces run in background threads:

  • Network – Continuous internet connectivity check

  • WebSocket – Realtime data push to dashboard

  • Modbus – Async sensor polling on the Modbus bus

  • LoRa – Long-range radio communication

  • Sigfox – LPWAN communication

  • HMI – 7-segment display updates