Wireless Communication - kobeylake/ares-red GitHub Wiki
The system operates on a star topology with the Base Node (nRF52840DK) acting as the central coordinator. Communication is as follows:
-
Mobile Node (Thingy:52): Acts as the environmental sensor source, periodically broadcasting data (Co2, temperature, humidity) via BLE advertising.
-
Base Node (nRF52840-DK): Scans for mobile node advertisements, calculates a control servo angle, and rebroadcasts a JSON-formatted packet containing all sensor data and angle over BLE advertising. It is also connected via USB UART to a PC running a shell interface for debugging and configuration.
-
Actuator Node (nRF52840DK + CRICKIT): Receives JSON packets via BLE, decodes the data, updates the vent angle via a PWM-controlled servo, and forwards the JSON data over UART to a Windows PC for MQTT publishing.
-
PC's 1-3 (Grafana + InfluxDB + Mosquitto Broker): Connected to the Actuator Node via UART. Runs Python scripts that read UART data and publish to MQTT, allowing real-time visualisation and logging in Grafana.
The project uses Bluetooth Low Energy (BLE) in advertising-based mode, along with UART serial and MQTT over TCP/IP, to support multi-node data flow, actuation, and real-time visualisation. The system is distributed across three PCs, each with a dedicated role.
Direction | Source → Destination | Mode | Purpose |
---|---|---|---|
Thingy:52 → Base Node | BLE Advertising | Broadcast sensor data | Periodic broadcast of temperature, humidity, and CO₂ |
Base Node → Actuator Node | BLE Advertising (JSON) | Sensor + angle payload | Transmit fused sensor data and servo angle |
Actuator Node → PC 1 | UART Serial | JSON to PC | Forward JSON packets over serial to MQTT publisher |
PC 1 → PC 3 (Viewer/Grafana) | MQTT over TCP/IP | Broker communication | Visualise real-time sensor and actuator data |
PC 2 → Base Node | UART CLI | Shell commands | Control ultrasonic, servo mode, and sensor overrides |
- Role: BLE Broadcaster
-
Function: Periodically advertises:
- Temperature
- Humidity
- CO₂ (eCO₂/TVOC)
- Communication: BLE Advertising
- Sensor Interface: I²C
- Role: BLE Scanner + Broadcaster
-
Functions:
- Scans BLE packets from Thingy:52
- Performs sensor fusion to compute servo angle
- Broadcasts JSON including:
- Temp, Humidity, CO₂
- Ultrasonic distance
- Computed angle
-
Communication:
- BLE Advertising (to Actuator Node)
- UART CLI for real-time control from PC 2
- Role: BLE Scanner
-
Functions:
- Parses BLE advertisements from Base Node
- Controls servo via PWM using received angle
- Sends JSON over UART to PC
-
Communication:
- BLE (input from Base Node)
- UART (output to PC 1)
- Role: MQTT Bridge
-
Functions:
- Reads JSON from Actuator Node over UART
- Publishes data to local Mosquitto MQTT broker
- Tools: Python (Paho MQTT), Mosquitto
-
Communication:
- UART (inbound from Actuator Node)
- MQTT (outbound to PC 3)
- Role: Manual Control Interface
-
Functions:
- Sends control commands to Base Node via Zephyr Shell:
-
ultrasonic_on
,ultrasonic_off
servo_mode auto/manual
sensor_override <CO2> <TEMP>
-
- Sends control commands to Base Node via Zephyr Shell:
- Communication: UART Shell
- Role: Real-time Visualisation
-
Functions:
- Subscribes to MQTT broker
- Visualises sensor data and control state
- May optionally display local alerts
- Communication: MQTT over Wi-Fi