Skip to the content.

Change the Sensor Reporting Interval Dynamically

Lab Objectives

In this lab you will modify the ESP8266 Arduino program to receive MQTT commands from your Node-RED instance nd build a Node-RED Dashboard Form to dynamically change the reporting interval of the ESP8266 DHT environmental sensor data. You will learn:

Introduction

Remote management and control of IoT Devices is critical to managing the flow of sensor data to the Cloud. The IoT Device might only need to check in occasionally during quiet periods of inactivity. Waking up the device and requesting that it report sensor data more frequently during active time periods is better for power management, bandwidth consumption and cloud storage.

This section will build a Node-RED Dashboard Form where you can enter a new reporting interval. A MQTT command will be published from your Node-RED instance to the ESP8266 device. The ESP8266 will receive the interval update and adjust how often it transmits the DHT environmental sensor data.

Step 1 - Import the Node-RED Dashboard Reporting Interval Form Flow

Node-RED Dashboard Reporting Interval Form Flow Get the Code:{target=_blank}

Node-RED Dashboard Form flow screenshot

Step 2 - Node-RED Dashboard Form node

Node-RED Dashboard Form flow node

Step 3 - Description of the Set ESP8266 Interval flow

Step 4 - Send MQTT Commands with the MQTT Out Node

Node-RED Dashboard Form flow node

Step 5 - Reprogram the ESP8266 to Subscribe to MQTT Commands

For this part you should modify the Arduino program for your device to

Step 6 - Node-RED Dashboard Reporting Interval Form

Reporting interval form

Step 7 - Arduino Serial Monitor

Arduino Serial Monitor


Click to return to the Part 3 homepage.