last updated: 2021-03-25
under heavy construction :)
LoRa is the first possibility to reach all devices in a house by radio without repeater (long range). The second cool feature is the minimal power needed to do so. We can power our devices with batteries for a long time. The disadvantage is the reduction of data that can be processed, but e.g. temperature control must not be that very quick.
You can find more about the theory and programming of
LoRaWAN in the following tutorial:
There you can find also code to access the Things Network via
Here we will use radio communication via LoRa with our own sender and LoRa gateway forwarding the information via
One of the goals is to use all my heating thermostats with LoRa. The first step was to dive a little deeper into sleep modes, so that the thermostat and other devices could function on battery for al long time (min. 1 year). This information can be found in the tips and tricks section and is needed to understand some the following content:
There are 2 major chips on the market for cheap LoRa solutions with Arduino.
First we have the radio chip
SEMTECH (q: Wer hats erfunden? a: les Français). This chip is accessible via the breakout board
RFM95W from hoperf. The chip has no WAN stack implemented, so we need a library providing this if we want to use the chip for
SX1276 communicates via the SPI interface with the microcontroller. An IRQ helps to wake up from sleep.
Second we may use the chip
RN2483 from Microchip. It has an implemented WAN stack that has to be deactivated for
LoRa P2P. This chips uses a classical serial connection to communicate with the microcontroller.
The chip is accessible via the breakout board
RFM95W from hoperf. We can use the cool LoRa library from Sandeep Mistry. Information about the library can be found in the corresponding LoRa Application Programming Interface (API).
To use a minimum on energy we run the mega328 chip (Arduino) on internal RC with a maximum of 4 MHz. To do so we have to burn an alternative bootloader. Then we can add the LoRa chip (SX1276) by using a breakout board RFM95W from hoperf. The board needs the SPI interface (MOSI, MISO, SCK, SS), a Reset (input) and an Interrupt DIO0, to signalize if data is received.
The next step was to use a PCB and I found the TTGO
promini lora board from LILYGO which was really cheap and contained an Arduino (mega328p) and the SX1276 chip. I use the 868 MHz version (Europe) and the board came in version 2. Pictures showed the older version, and there was no circuit available. To understand the board, I had to draw the circuit and to reduce the power consumption to strip some components from the board.
The first LoRa sender will be an Arduino
mega328p driven temperature and humidity sensor, running on 2 AAA alkaline batteries.
The RN2483 from Microchip has an implemented WAN stack. So this chip is predominated to be used with LoRaWAN. But... The chip is accessed by a classical serial interface facilitating the wiring. And my hacked thermostat (HR20 from Honeywell) that I want to use with LoRa has a serial interface, so perhaps I can pimp the thermostat without even opening the housing.
To use the chip in LoRa P2P mode the WAN stack has to be deactivated. Even as it's only normal serial commands a library would made things easier. As I didn't find a library, I wrote one.