This document will guide you through the Radio Soil Sensor project. You will be able to see, save and analyze moisture level and temperature in Node-RED and Grafana visualization tool.
Either BigClown Radio Soil Sensor Kit, or individual components:
You will need Raspberry Pi with the BigClown Raspbian distribution installed. Please see Raspberry Pi Installation document.
Connecting to Raspberry Pi
All the configuration, services and flashing firmware will be done on the Raspberry Pi. You use your computer only to connect to the Raspberry Pi SSH server and Grafana web page.
Please follow the Raspberry Pi Login document where you find how to discover Raspberry Pi IP address on your network and connect to the SSH server.
In this procedure we will use the BigClown Firmware Tool to upload firmware to the Core Module. You will connect and flash firmware with Raspberry Pi
Now it's time to write firmware to the Core Module.
Connect the Micro USB cable to the Core Module and Raspberry Pi.
Upload the firmware to the Core Module:You may want to update available firmwares by
bcf updateif the installation has been prolonged for a longer time after Playground SetupYou must first switch the Core Module to the DFU mode.Flashing Core Module R1 & R2
For differences of flashing older Core Module 1 and newer Core Module 2 please read Core Module R1 and R2 comparison in the Hardware section
Write this command to the Raspberry Pi SSH command line.
bcf flash --device /dev/ttyUSB0 bigclownlabs/bcf-radio-soil-sensor:latest
Remove the Micro USB cable from the Core Module and Raspberry Pi.
Start with the Battery Module.Make sure the Battery Module does not have batteries inserted.
In this section, we will create a radio link between the Radio Dongle and the Radio Climate Monitor.
Follow these steps in Node-RED:
Click on the Start node pairing button.Make sure, that after pressing the Start node pairing button in the right debug tab you have two messages. One is command and the second one with ""start"" is the response from Radio Dongle.
Insert the batteries into the Radio Climate Monitor to send the pairing request (you should also see the red LED on the Core Module to be on for about 2 seconds).
In the Node-RED debug tab, there is a message about name and firmware version of the new paired module.
Click on the Stop node pairing button.
Follow these steps in Node-RED:
Switch to debug tab on the right.
Start breathing on the temperature sensor on the Soil Sensor to invoke a change of temperature and hence trigger a radio transmission.
You should then see similar messages:
Optionally put the assembly into the appropriate enclosure, if you have one.
Now we have assembled our kit and let's start with some basic integration with Grafana.
Install Grafana and InfluxDB database to your Raspberry Pi. This is explained in Grafana for Visualization document.
Add these lines to the /etc/bigclown/mqtt2influxdb.yml configuration file which you had created in the Grafana for Visualization tutorial. This adds support for new topics that Soil Sensor sends.For text editing, we use nano editor. You can save changes by pressing key combination
Ctrl + Oand exit editor by pressing
Ctrl + X.
Open mqtt2influxdb configuration in nano text editor.
sudo nano /etc/bigclown/mqtt2influxdb.yml
And append these lines at the end of the existing file:
- measurement: moisture topic: node/+/soil-sensor/+/moisture fields: value: $.payload tags: id: $.topic channel: $.topic - measurement: temperature topic: node/+/soil-sensor/+/temperature fields: value: $.payload tags: id: $.topic channel: $.topic
Test that the configuration is valid. Otherwise there is some formating error in the YAML file.
mqtt2influxdb -c /etc/bigclown/mqtt2influxdb.yml --test
Restart MQTT2InfluxDB service, because we've changed the configuration
pm2 restart mqtt2influxdb
Open Grafana page which is running on Raspberry Pi on port
Now you can see temperature and battery voltage on the bottom. We need to add a moisture graph. Because we added
- measurement: moistureto the config file, we need to duplicate existing graph and change its
measurementdata source to
Now click on Edit in the duplicated graph.
Now in Metrics tab change the FROM item from value temperature to moisture.
Now click on the Save button in the Grafana so all your configuration stays the same next time you open the page.