last updated: 2024-02-14
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 LoRa
and LoRaWAN
in the following tutorial:
There you can find also code to access the Things Network via LoRaWAN
.
Here we will use radio communication via LoRa with our own sender and LoRa gateway forwarding the information via MQTT
.
There are now more chips on the market for cheap LoRa solutions with Arduino. One of the first was the radio chip SX1276
from SEMTECH
(q: Wer hats erfunden? a: les Français). The SX1276
communicates via the SPI interface with the microcontroller. One or more interrupts help to wake the microcontroller up from sleep.
This chip is accessible via the breakout board RFM95W
from hoperf (specification document). Unfortunately the board uses a 2 mm pin header pitch instead of the usually used 2.54 mm (0.1 in). So we need an additional breakout board to be able to use the chip on a breadboard.
The chip has no WAN stack implemented, so we need a library providing this if we want to use the chip for LoRaWAN
. 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).
Second we may use the chip RN2483
from Microchip. The RN2483 has an implemented WAN stack. So this chip is predominated to be used with LoRaWAN. But naturally the WAN stack can be deactivated for LoRa P2P
. The chips uses a classical serial connection to communicate with the microcontroller and so is facilitating the wiring. Even as it's only normal serial commands a library would made things easier. As I didn't find a library, I wrote one, that you can find on github.
One of the goals is to use LoRa devices with batteries. For this I decided to use the Arduino Uno microcontroller (ATmega328p or more recently ATmega328pb) without other external components draining the battery and running without crystal on internal RC oscillator. One of the first step was also to dive a little deeper into sleep modes, so that the devices could function on battery for a long time (min. 1 year). All the information on my research and the know how to use another bootloader can be found in the tips and tricks section and is important for some of the following circuits. So best is to read first:
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.
Design of a small key with button running on a coin cell.
Inkplate 5 e-paper with ESP32 as door sign and repeater.
Finally we also need a gateway to redirect infos to our house automation software. I use an Olimex board with ESP32 and Ethernet.
This chip is accessed by a classical serial interface facilitating the wiring. 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, that you can find on github.