Microcontroller projects

LoRa P2P (LoRa without WAN)

last updated: 2021-01-21

under heavy construction :)

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 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 chips

There are 2 major chips on the market for cheap LoRa solutions with Arduino.

RFM95W   ;  board

First we have the radio chip SX1276 from 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 LoRaWAN. The 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.

P2P with the SX1276

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

P2P with the RN2483

coming soon :)

LoRa low power

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 the following content:

http://weigu.lu/microcontroller/tips_tricks/sleep_tips_tricks/index.html

LoRa sender and receiver with DS18B20 temperature sensor on a breadboard

LoRa sender with DS18B20 temperature sensor on a breadboard

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.

board

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

LoRa sender with Promini LoRa board running on batteries

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.

LoRa gateway

soon