My goal is to collect data over a larger distance than achievable with protocols like Wifi. I need a large amount of nodes and I also want to power the senders with batteries for the simple reason I do not have electricity where I want to collect data. The object I want to monitor is a big farm with distances over 1 Km.
In short I need:
- Battery powered low-power nodes
- Long distance range
- Possibility to hook up several sensors like air temperature/humidity, soil temperature/humidity, amount of light and maybe CO2 levels
- Affordable since I may need a lot of nodes to do proper monitoring on several hectares. I am thinking about at least 8 nodes per hectare.
- A way to collect and present the data. For this purpose I am tinkering with open source domotic software like Domoticz.
However: first I need a proof of concept, and I just finished step one: sending data from a DHT22 sensor over LoRa to another LoRa board. The maximum distance I measured was 700 meters, a promising start.
I have recently bought two TTGO LORA32 V2.0 433/868/915 mhz ESP32 LoRa OLED 0.96 inch Sd-kaart Blue Display ESP-32 WIFI Bluetooth Modules at Aliexpress. I have also bought two LoRa32u4 boards from bsfrance.fr which I have not been able to get to work.
This instructable will enable you to make a simple proof of concept, but is far from finished as you can read below.
Step 1: My Setup
First you need to add "https://dl.espressif.com/dl/package_esp32_index.json" to File > Preferences > additional boards in the IDE. You can separate several entries with a comma.
I have uploaded the default "receiver" sketch with the Arduino IDE to one board.
I have adapted the default "sender" sketch to allow readings from de DHT22 sensor
The pinout is simple:
- VCC sensor > 5v on board
- GND sensor > GND on board
- Data sensor > pin 25 on board (I used pin 12 first but that gave very strange behaviour like reboots, not being able to upload with vcc connected etc.)
- A 10k Ohm resistor vcc<>data
Load the sketch in to the Arduino IDE, select your board (TTGO LoRa32-OLED V1 (appearently V2 is not yet available, but this worked for me)
Select your USB (com) port, compile and upload.
Succes!!! On powering up I see the data coming in on the OLED of the receiving board.
I have used the "SimpleDHT" library to connect the DHT to the board.
I can not use the ESP32 DHT library. The examples are way over my head; I am not a very good programmer.....
All sketches are included in this Instructable.
I am running into a few problems:
- SOLVED: The board keeps rebooting when the sensor is connected at powering up. Powering up and connecting the sensor to the 5v pin of the boards works. I solved this by switching the DHT data cable from pin 12 to pin 25
- How can I implement deep sleep to enable to nodes to run for many months on one battery?
- How do I get the data into the database of e.g. Domoticz? I suppose I need some sort of a gateway for that...
- It is irritating me that I can't get the LoRa32u4 II boards working.... In short: the proof of concept works, but there is much to be done. Any help or advise is greatly appreciated...