Introduction: LoRa Mesh Sensors
This is the third in the series on Ripple LoRa mesh networks, now showcasing sensor nodes.
See the previous articles for reference:
Hardware components can be purchased here:
Adafruit Feather with LoRa module: https://www.adafruit.com/product/3178BN-180
dipole antenna: https://www.banggood.com/Beitian-Smallest-Mini-Du...
Step 1: Background
Most Arduino sensor modules, like temperature, humidity, etc, can be queried either via digital or analog GPIO pin. For this article I have tested on a flame sensor, which uses both a digital pin (for when the sensor value triggers from potentiometer setting) and an analog pin.
Sensor module: https://www.banggood.com/3pcs-KY-026-Flame-Sensor-...
The goal of this part of the project is bringing dedicated sensor nodes into the Ripple LoRa mesh networks. You can either just remotely monitor sensors, or get alert messages when a configurable trigger condition is reached, like a flame being detected, or motion being detected, etc.
Step 2: Wiring
Currently there are only two board types supported, with the following pins that the sensor module must be connected to:
* Analog pin: A1 (gpio 15) -OR-
* Digital pin: 10
TTGO/HELTECH ESP32 LoRa module:
* Analog pin: 39 -OR-
* Digital pin: 34
Most sensor modules can accept 3.3Volt, so you just need to also wire up the GND and VCC pins to the board's GND and 3.3V pins.
Step 3: Flashing the Firmware
For this you will need to have installed the Arduino IDE, and support for the target board type.
There are instructions on how to flash the firmware on this Github page:
Choose one of the 'Sensor Node' targets. With the board connected via USB cable, test that the firmware is OK by opening the Serial Monitor in the Arduino IDE. Enter 'q' (without quotes) in the send line, and press enter. The serial monitor should reply with text starting with "Q: ..."
Step 4: Configure the Sensor in the App
To configure the sensor module and to monitor it, you need to install the Ripple Commander app. Currently only Android is supported. Download from Play: https://play.google.com/store/apps/details?id=com....
The app has two launcher icons. The 'Device Provision' one is just for when you are setting up your mesh network (repeaters, sensors, gateway, etc). The sensor nodes just need to be assigned a unique Id (between 2 and 254), and have their encryption keys generated. Just click on the 'NEW' menu on the toolbar, and enter the Id and name for the sensor, then click SAVE. The sensor should now be in the main list.
For sensor nodes, there are extra configuration parameters to be setup. Tap on the 'edit' (pencil) icon, and then tap on the '...' button in the next screen to see the Sensor Config screen. (first screen-shot above). This is for setting up sensor, how it should report its status, and how to generate alert messages. Once the config is complete, tap on the SAVE menu in the top toolbar.
Tap on the 'chip' icon to the right, to go the 'Programmer' screen. Connect the sensor board via USB-OTG cable to the Android, then tap on the 'PROGRAM' button. If all goes well, then there should be a message saying 'Done', and that you can now disconnect.
Exit back to the Android launcher, then tap on the main 'Ripple Commander' launcher icon. This is the main UI of the app, where you can chat with other 'pager' users in the network (who use the Ripple Messenger app), plus monitor your special nodes, like repeaters and the sensor nodes. Tap on a sensor node in the list, and you should see the device status screen (see second screen-shot above).
Step 5: Demo
Here is a demonstration of the flame sensor activating an alert status, and the home node receiving the alert.
Note that the alerts represent a state which are 'reset' either manually or automatically after an elapsed time. The screen shown here offers a "Reset Alert" button for manually resetting the alert status.
The alert messages generated will make the the home node board buzzer sound, and the message will be in the 'History' tab.
Step 6: Feedback
This capability, having sensors report remote states, and having alerts generated represents an extremely useful feature for these long range IOT networks. I am quite excited to hear of what can be done with this new capability, and how it has worked out. And, as always, I'm keen to hear if there are any problems still needed to be ironed out.