Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:laboratoare:2025:lab3 [2025/10/11 13:19]
dan.tudose [Subscribe & control the on-board NeoPixel]
iothings:laboratoare:2025:lab3 [2025/10/13 17:20] (current)
dan.tudose [Platformio.ini]
Line 48: Line 48:
     * ''​sensors/​room1''​     * ''​sensors/​room1''​
     * ''​sensors/​temperature/​office/​room1''​     * ''​sensors/​temperature/​office/​room1''​
 +{{ :​iothings:​laboratoare:​2025:​single-level-wild-card--1-.png?​600 |}}
  
 == # (Multi-Level Wildcard) == == # (Multi-Level Wildcard) ==
Line 61: Line 62:
  
   * ''#''​ alone matches **all topics**.   * ''#''​ alone matches **all topics**.
 +
 +{{ :​iothings:​laboratoare:​2025:​single-level-wild-card--1--1.png?​600 |}}
  
 == Rules and Constraints == == Rules and Constraints ==
Line 112: Line 115:
   adafruit/​Adafruit BME680 Library   adafruit/​Adafruit BME680 Library
   bblanchon/​ArduinoJson @ ^7   bblanchon/​ArduinoJson @ ^7
-  256dpi/MQTT @ ^2.5.2 ​      ​+  256dpi/MQTT @ ^2.5.2 ​   
 +  knolleary/​PubSubClient @ ^2.8    ​
 </​code>​ </​code>​
  
Line 147: Line 151:
 Every ten seconds, the ESP32 reads environmental data from the on-board BME680 sensor—including temperature,​ humidity, pressure, and gas resistance—and packages those readings into a JSON message. It then publishes this JSON payload to an MQTT topic dedicated to that device’s sensor data. Any other MQTT clients subscribed to that topic can instantly receive and process the latest environmental information,​ such as for logging, visualization,​ or automation. In short, this code makes the ESP32 function as a small, networked environmental node that continuously streams live sensor data to the MQTT ecosystem while maintaining reliable connection status reporting. Every ten seconds, the ESP32 reads environmental data from the on-board BME680 sensor—including temperature,​ humidity, pressure, and gas resistance—and packages those readings into a JSON message. It then publishes this JSON payload to an MQTT topic dedicated to that device’s sensor data. Any other MQTT clients subscribed to that topic can instantly receive and process the latest environmental information,​ such as for logging, visualization,​ or automation. In short, this code makes the ESP32 function as a small, networked environmental node that continuously streams live sensor data to the MQTT ecosystem while maintaining reliable connection status reporting.
  
-[[iothings:​laboratoare:​2025:lab3_code3|Click here to get the code for this example.]]+[[iothings:​laboratoare:​2025_code:lab3_3|Click here to get the code for this example.]]
  
 Test it out using [[https://​dantudose.github.io/​labs/​lab3_3.html | this link]]. Test it out using [[https://​dantudose.github.io/​labs/​lab3_3.html | this link]].
Line 159: Line 163:
 At the same time, the ESP32 regularly publishes telemetry data through MQTT. It sends heartbeat messages with uptime, signal strength, and network information,​ and it transmits environmental sensor readings from the BME680 to a designated topic as JSON data. All MQTT communication uses Quality of Service level 1 to ensure that messages are delivered at least once, providing reliable data exchange between the device and the broker. The code also manages automatic reconnection with exponential backoff, meaning it gracefully retries connecting to the MQTT broker when disconnected without flooding the network. In essence, from the MQTT point of view, this device behaves as a resilient, bidirectional IoT client that reports data, accepts remote commands, and maintains a persistent, reliable session with the broker. At the same time, the ESP32 regularly publishes telemetry data through MQTT. It sends heartbeat messages with uptime, signal strength, and network information,​ and it transmits environmental sensor readings from the BME680 to a designated topic as JSON data. All MQTT communication uses Quality of Service level 1 to ensure that messages are delivered at least once, providing reliable data exchange between the device and the broker. The code also manages automatic reconnection with exponential backoff, meaning it gracefully retries connecting to the MQTT broker when disconnected without flooding the network. In essence, from the MQTT point of view, this device behaves as a resilient, bidirectional IoT client that reports data, accepts remote commands, and maintains a persistent, reliable session with the broker.
  
-[[iothings:​laboratoare:​2025:lab3_code4|Click here to access your code for this example.]]+[[iothings:​laboratoare:​2025_code:lab3_4|Click here to access your code for this example.]]
  
 Test it out using [[https://​dantudose.github.io/​labs/​lab3_4.html | this link]]. Test it out using [[https://​dantudose.github.io/​labs/​lab3_4.html | this link]].
iothings/laboratoare/2025/lab3.1760177953.txt.gz · Last modified: 2025/10/11 13:19 by dan.tudose
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0