Making various ESP32/LORA  development units from different manufactures talk to each other.


Background

These notes are mainly for my own backup of my existing system. If you are making something similar do please comment in the discussion section below.

My house and garden network of ESP32 and Raspberry Pi nodes uses a WIFI mesh to carry data to a central Raspberry Pi with a monitor display on the kitchen wall. This works most of the time but the WIFI can die if the house power spikes or goes off. Raspberry Pis can crash even if rebooted on cron every night. I plan to add a battery backup and some form of watch dog circuit.

The objective of the experiments here is to see if the WIFI can be replaced with lora radio. It might also be possible to monitor the health of beehives that are behind a low hill and too distant for a reliable WIFI link.

So I am testing a variety of ESP32/LORA circuits from several manufacturers
The main challenge has been to have units from different manufacturers communicate with each other. There are many people having trouble with that!
ChatGPT has helped me troubleshoot a range of problems with different software designed for different LORA chips including SX1262 and SX1278. These have different supporting software on Github which handle the setting of the many LORA parameters differently. 
I have needed to explore using  heltec unofficial.h,  RadioLib.h  and LoRa.h.
My network has a central hub sending commands and receiving very short texts when requested from a variety of LORA systems.

NB - I am not expert in C or Python. I used to copy published examples, modify them and pray. But I now ask ChatGPT! I have found that it helps to add features one by one and test them before adding new ones.
The code presented here works but I have not yet fully understood all that the programs include.
Once I have bash, python and C programs performing various actions I use Blassic Basic on a raspberry Pi to glue the functions together. You can follow the logic in plain English!

The units tested so far.
The problem that needed a solution was to find the parameters that allow a
Heltec LoRa32 V3 using <heltec_unofficial.h>,

a
LILYGO® T3S3 ESP32-S3 using <RadioLib.h>

and a home built card with

ESR32 WROOM + SX1278 LORA
 
using <LoRa.h> 
to all communicate with each other.

The codes listed work but need some tidying
This code may be upgraded without notice.
The nodes have 5 character names.



Heltec LoRa32 V3 868MHz 915MHz Development Board  (LORA - SX1262)


heltec
FOR THE BEDROOM THERMOSTAT+TUNE BEEPER - node name BEDRM
-----------------------------------------------------------------=-------

DS18B20 on GPIO7 one-wire room thermometer
code need cleaning - was based on HOTBX code below - only one sensor in use now

GPIO6 relay pin as below

FOR THE HOTBOX - node name APPLE
---------------------------------------------------=---
DS18B20 thermometers use one-wire and normally use a single GPIO for all needed, ChatGPT gave them each a GPIO - at least you know which is which!
DS18B20 on GPIO7  (inside / control sensor for the hotbox)

DS18B20 on GPIO5  (for the  greenhouse temperature)
DS18B20 on GPIO4  (for the outside temperature)

GPIO6 connects via a 1Kohm resistor to the gate of a small transistor. The emitter goes to earth and the collector connects to the coil of a 10 amp 240 volt relay. A catching diode is wired across the coil. I now use quality relays and avoid the blue (so called) 10 amp relays on many Chinese project boards. The contacts can fuse into the "on" position.


(NB! ChatGPT can suggest a chip GPIO that is not wired to an output terminal pin)

1) BEDRM
   

-    using  <heltec_unofficial.h>

Used in a bedroom with one thermostat to control a wall convector fire  +  a beeper loudspeaker as alarm.
The central hub sets the thermostat temperature and hysteresis and receives data.
It also sends commands to play a tune as an alarm.

local copy
/Users/graham/Dropbox/SystemsinUse/46_office_lora/lora_esp32/GPT_TStat_tune_alarm_corrected_BEDRM_IDreplay/GPT_TStat_tune_alarm_corrected_BEDRM_IDreplay.ino


The same code from this website as backup
GPT_TStat_tune_alarm_corrected_BEDRM_IDreplay.ino.html
(to download select all, copy the text and paste into Arduino IDE with your file name)




2) HOTBX
-    using  <heltec_unofficial.h>

For the large hotbox for hydroponic strawberries etc in the big greenhouse

The central hub sets the thermostat temperature and hysteresis and receives data for gnuplot

local copy
Users/graham/Dropbox/electronics/Arduino/lora/heltec_tests/heltec1/slow_updates/heltec_t_command_send_one_DS18B20_temp3/heltec_t_command_send_one_DS18B20_temp3.ino

The same code from this website as backup
heltec_t_command_send_one_DS18B20_temp3.ino.html

(to download select all, copy the text and paste into Arduino IDE with your file name)

LILYGO® T3S3 ESP32-S3  868MHz 915MHz Development Board  (LORA - SX1262)  
Lilygo

(my version was LoRa32 V3 not V1, SX1262 not SX1280)

1) INCUB
-   using <RadioLib.h>
Chicken egg incubator in the workshop.

This is just a remote thermometer to monitor the built in thermostat

local copy
 /Users/graham/Dropbox/SystemsinUse/46_office_lora/Liligo_SX1262/LilygoT3S3_TX_INCUB_on_command_OLED_OK2/LilygoT3S3_TX_INCUB_on_command_OLED_OK2.ino
DS18B20 onewire thremometer  
     

The same code from this website as backup
LilygoT3S3_TX_INCUB_on_command_OLED_OK2.ino.html

(to download select all, copy the text and paste into Arduino IDE with your file name)
 
2) SEEDS
A bottom heated seed tray.
In progress


Home built ESR32 WROOM + SX1278 LORA cards with OLED display   

home build

1) BASE CONTROLLER -  using <LoRa.h>
Main receiver with WIFI link to Raspberry Pi at 192.168.1.46 (Office)
A Raspberry Pi python program sends a command string by WIFI that starts with the 5 character node name of the addressed node and adds a command string and data (thermostat set temperature and hysteresis etc).
The node replies with a LORA data string that the base controller sends to the python program which save the data in a table.
Under the control of cron timing Raspberry Pi creates gnuplots of the data and presents them as html web pages for local display in the house kitchen or remote display.

local copy

/Users/graham/Dropbox/SystemsinUse/46_office_lora/lora_esp32/ttgoOLED_TX_command_from_office_OK_251129/ttgoOLED_TX_command_from_office_OK_251129.ino
 

The same code from this website as backup
ttgoOLED_TX_command_from_office_OK_251129.ino.html
(to download select all, copy the text and paste into Arduino IDE with your file name)

2) HONEY
-  using <LoRa.h>
Home build ESR32 + SX1278 + OLED 
For a bee hive monitor with weather chip BME280 + 4 bee IR motion detectors. I hope to place these to detect an increase in the number of bees flying
or walking round the hive entrance. That happens when a swarm is about to leave. Or if placed on an empty hive it should first detect scout bees and then a swarm arriving.

local copy
/Users/graham/Dropbox/SystemsinUse/46_office_lora/lora_esp32/IR_Bee_GP_OLED_Remote_BME280_4IR_HONEY/IR_Bee_GP_OLED_Remote_BME280_4IR_HONEY.ino

The same code from this website as backup
IR_Bee_GP_OLED_Remote_BME280_4IR_HONEY.ino.html

(to download select all, copy the text and paste into Arduino IDE with your file name)

Raspberry Pi code is here