Microcontroller projects

LoRa P2P (LoRa without WAN)

last updated: 2024-02-14

Introduction

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:

Tutorial LoRa and LoRaWAN on weigu.lu

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.

The LoRa chips (boards)

SX1276 on the breakout board RFM95W

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.

lora breakout

lora breakout
Source: RFM95W-V2.0 specification document from hoperf

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).

Connections to ESP8266 or ESP32

RN2483 from Microchip

board

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.

LoRa P2P (SX1276) and ESP8266 or ESP32

LoRa P2P (SX1276) low power with ATmega328

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:

Low power and sleep tips and tricks with ATmega328PB

LoRa P2P (SX1276) low power sender (mega328P) with DS18B20 on a breadboard

board

By sending the temperature every 2 minutes we get over 2.3 years! for our battery life with a 1200mAh battery (2xAAA).

LoRa P2P (SX1276) low power sender with Promini LoRa board running on batteries

promini lora sender 1        current 1

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.

!!New!! LoRa P2P (SX1276) low power sender (key) with own PCB running on battery

Design of a small key with button running on a coin cell.

!!New!! LoRa P2P (SX1276) low power repeater with e-paper running on battery

Inkplate 5 e-paper with ESP32 as door sign and repeater.

!!New!! LoRa to MQTT Ethernet Gateway

Finally we also need a gateway to redirect infos to our house automation software. I use an Olimex board with ESP32 and Ethernet.

LoRa P2P with RN2483

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.

Interesting links: