Introduction: TTGO ESP32 LoRa Board With DHT22 Temperature and Humidity
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...
Question 1 year ago on Step 2
Hi,please I have problem with libary images.h.
Do you have some link fot it. Thank you very musch.
1 year ago
En reponse a votre probleme de mise en veille, j'ai touvé cette solution qui fonctionne parfaitement!
2 years ago
Thanks for the inspiration.
I am also playing around with this board, trying to get something out of it and to learn. I will try to give you two answers to your questions from my experience.
Regarding "deep sleep", I have read a lot and also measured, and it is not impressive on this board. Minimum 3 mA in deep sleep. I have therefore made another solution, where I use an Attiny85 to turn on/off the ESP32, and the Attiny85 use almost nothing when sleeping. I want to make an instructable one day, but it is with an Attiny85, TTGO ESP32 LoRa board, a P-channel MOSFET and NPN transistor, with a 3,7 V battery.
Regarding data into a database, I have setup a local SQL db, where you can connect from your Gateway "Receiver" on WIFI to SQL. (MySQL_Connector_Arduino Library). This way you can send from multiple "Senders" to the gateway/receiver, which inserts to the database. Then I use Grafana to show the data. I think that is a neat local setup. I have also tried TheThingsNetwork, and you connect with the board, but I think it is too complicated and overkill for local setup.
Question 3 years ago
Thanks for the build Peter, I have just ventured into programming and looking to build a similar project, however using Ultrasonic sensor for tank volume and then displaying with Blynk. However, at the moment I'm just playing/learning LoRa.
Can I ask, on your Sender Sketch, what image.h library have you installed?