Ray Jasson
31/01/2021
This is a minimal IoT device simulator built using Node-RED. It sends telemetry data to Firebase Realtime Database for Farmassist app. There are 5 types of telemetry data:
- Air Humidity (%)
- Air Temperature (°C)
- Soil Moisture (%)
- Soil pH (pH)
- Soil Salinity (Millisiemens/cm)
Connected Nodes in Node-RED editor
UI Dashboard of the IoT Device Simulator
The IoT device simulator is a Node-RED flow stored using JSON. The functions are written in JavaScript.
- To run the simulator locally, you will need a supported version of Node.js and Node-RED editor.
- To install Node.js, download the recent version from here.
- To install Node-RED editor, run:
npm install -g --unsafe-perm node-red
- Open Node-RED editor by running:
node-red start
- Open http://localhost:1880 to view the editor in the browser.
- 2 extra node modules:
node-red-dashboard
andnode-red-contrib-firebase-data
, are required to run the simulator.node-red-dashboard
is used to create a dashboard, whereasnode-red-contrib-firebase-data
is used to connect the nodes to Firebase Realtime Database. To install them, run:npm install node-red-dashboard npm install node-red-contrib-firebase-data
- Download the JSON file and import it into the Node-RED editor. You will see the import option at the upper-right corner of the editor.
- You need to add your Realtime Database URL into the configuration node. You can find the URL in the Realtime Database section of your Firebase console. The configuration node ⚙️ is located at the third option in the right panel.
- Double-click
Add Firebase
node to configure your Firebase URL and set the child path to where the telemetry data is stored in the database. Also, there are several methods for you to write data into Realtime Database, for example,set
,push
orupdate
. The default method in the JSON file isupdate
. - Remember to click "Deploy" to save your configurations.
- Open the dashboard, and use the sliders to select the range of the telemetry data you would want to send.
- Toggle the switch to start/stop sending the telemetry data.