Farmassist-CM / farmassist-iot-device-simulator

A minimal IoT device simulator built using Node-RED. It sends telemetry data to Firebase Realtime Database for Farmassist app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Farmassist IoT Device Simulator

📡 IoT Device Simulation

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


how should your firebase realtime database look like


UI Dashboard of the IoT Device Simulator


💻 How to Run the IoT Device Simulator

The IoT device simulator is a Node-RED flow stored using JSON. The functions are written in JavaScript.

Run the Node-RED flow locally

  • 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 and node-red-contrib-firebase-data, are required to run the simulator. node-red-dashboard is used to create a dashboard, whereas node-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.

Customize the simulator

  • 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 or update. The default method in the JSON file is update.
  • 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.

use the docker run -it -p 1880:1880 -v node_red_data:/data --name farmassist-iot-simulation nodered/node-red to lunch the docker app for red node.


✒️ References

About

A minimal IoT device simulator built using Node-RED. It sends telemetry data to Firebase Realtime Database for Farmassist app.

License:GNU General Public License v3.0


Languages

Language:Dockerfile 100.0%