-
1Install FDRS and Flash Your Devices
In this tutorial I will assume that you have already installed Arduino IDE and the latest ESP32/8266 board definitions.
Install FDRS
Download and extract 'range_testing.zip'. Copy the folder titled 'Farm-Data-Relay-System' into your Arduino 'libraries' folder.
Flash your devices
Gateway #1
The first gateway sends all received data to Node-RED, either by a USB-UART connection or ethernet. It can be any ESP module, but I recommend using a standard ESP8266 WeMos D1 Mini, an ESP32 Dev Kit, or the ThingPulse ESPGateway Ethernet.
If using ethernet, go to the attached 'fdrs_gateway_config.h', and uncomment the line that says:
#define USE_ETHERNET
Select the board you are using ('ESP32 Dev Module' for ThingPulse Gateway), choose the the COM port that your board is connected to, and press "Upload".
Gateway #2
The second gateway acts as an ESP-NOW/LoRa access point for sensors and controllers. It forwards any data that it receives directly to the first gateway.
Select the board "TTGO LoRa32-OLED", choose the the COM port that your board is connected to, and press "Upload".
GPS Node
The GPS node obtains its GPS coordinates and sends them via LoRa to the second gateway at ten second intervals.
To test your ESP-NOW coverage instead, switch the following two options in 'fdrs_node_config.h' to look like this:#define USE_ESPNOW //#define USE_LORA
Select the board "TTGO LoRa32-OLED", choose the the COM port that your board is connected to, and press "Upload".
-
2Prepare Node-RED
In this tutorial I will assume that you already have a Node-RED server up and running, as well as an MQTT broker if taking that option.
Add Contributed Nodes
Click the menu in the top right corner, then choose "Manage palette" (alt-shift-p). Click the install tab and find/install 'node-red-contrib-web-worldmap' and 'node-red-node-serialport' (if using UART).
Import Flow
Download 'gps_flow.json' and import it into Node-RED using the "Import" option from the menu (ctrl-i).
If you are using USB/UART:
- Double-click on the serial node, edit the configuration and choose the COM port that Gateway #1 is connected to.
If you are using ethernet/MQTT:
- Double-click on the MQTT node and enter the address of your MQTT broker.
-
3Prepare and Position Your Devices
Gateway #1
If you are using USB/UART:
- Gateway #1 will be plugged directly into the server that is running Node-RED via USB.
If you are using ethernet/MQTT:
- Gateway #1's ethernet will be connected to your network, and its USB to a wall outlet.
Gateway #2
This gateway will be listening for the GPS node, so it's important for it to be positioned in a spot where it will get good reception. A roof or attic window would be perfect. Keep in mind that while it can run off batteries for a few hours, this device will need to remain plugged into a power source for normal use.
GPS Node
There are three wires that should be connected between the GPS module and the LoRa module:
TTGO --- GPS Module
3V3 --- VCC
GND --- GND
GPIO13 --- TXD
To power the GPS node you can use your own battery with the TTGO's onboard battery circuit, or run it off of USB. -
4Build Enclosures
I recommend that you find some way to protect your LoRa modules and brace the antenna for easy positioning.
The enclosures I use were designed to interface with external sensor modules. I print them in PETG at 250°C for durability. The holes aren't perfectly matched to the antenna connector, so I just fill in the gap with hot glue.
There are lots of other DIY cases available for the TTGO LoRa32, most of which are really cool! -
5Get Walking!
Power up your GPS Node and wait while it establishes satellite communication. In the meantime go to 'server_root/worldmap' and zoom to your location on the Node-RED WorldMap. Once the GPS has established its position, you will see a pin dropped on your exact location. Pins will drop every 15 seconds and each pin will be visible for 24 hours before disappearing. You can connect extra nodes to log and save your data if needed.
On the OLED screen of the node, you will see a lot of information displayed very rapidly. If it ends with "Big Success!" you know that the packet made it to the gateway.
Head outside and move around your area with the GPS Node. To get a better idea of an area's reception, set the device down with its antenna elevated and wait for the next transmission attempt.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.