LoRa - Washing and Parking
What is LoRa?
LoRa (Long Range) is a spread spectrum modulation technique derived from chirp spread spectrum (CSS) technology and is the first low-cost implementation of chirp spread spectrum for commercial usage.[1] It was developed by Cycleo of Grenoble, France, and acquired by Semtech in 2012, a founding member of the LoRa Alliance.(Wikipedia).
What do I want to do?
We have a Washing Machine in the basement - and allways forget when its finished. So I want to build a LoRa module, stick it to the Washing Machine. A little sensor will check when it runs (by the movement). And when its finishing running (tumbling) - it will notify me with OpenHab. Aaah.. yes - and we have a garage (only 1 for 2 cars). So, how to know, if its already used by one car. Also an idea for LoRa.
Network Topology
LoRa consists of 4 parts:
- Nodes: Endpoint, e.g. measuring device
- Gateways: Bridge between the note and the internet, the number of channels that a gateway has is the number of nodes that it can talk to at once, node is not sending allays, e.g. a 1% duty cycle represents almost 15 minutes of combined
- Network Servers: direct packets between gateways and application servers. Since LoRaWAN™ allows for uplinks (messages to a server from a node) and downlinks (messages to a node from a server).
- Application Servers: Does actually do something with the data.
I will try first to get a P2P communication running, meaning just connecting 2 LoRa Endpoints calling Client and Server
Client and Server
As the "LoRa Server" I plan to use an ESP8266 (with WIFI) - to connect to RFM95.
As the Client I want to use a module (ready made) you can by in china for cheap money: LoRa Radio Node v1.0.
For both I will use the the LoRa-Library from Sandeepmistry.
The nifty Details
Server: ESP8266 with RFM95
The RFM95 Device
- Frequency used in Germany: Frequency Plan: EU863-870, 868 Mhz, you must use at least the 3 main channels you already mentioned (868.1, 868.3 & 868.5) with a duty cycle of <1%
- Device used: RFM95 868 MHz (my one does not have a "W" - RFM95 vs RFM95w)
- Antenna:cut a stranded or solid core wire the the proper length for the module/frequency: 868 MHz - 3.25 inches or 8.2 cm ((How to connect the antenna)
These different transceivers are using Semtech SX1276 chip.
The configuration and communication of the module is done via 4-wire SPI Bus, technically implemented in all microcontrollers.
- ANT is the antenna Pin.
- GND can be connected to any of the GND pad (connecting all is always better)
- DIO0 is used by RFM95w module to trigger RxDone/TxDone status.
- DIO1 is used by RFM95w module to trigger RxTimeout and other kind of errors status.
- NSS, MOSI, MISO, SCLK are for SPI communication. NSS is the chip select signal. Arduino is the master.
- Reset is resetting the RFM95w module.
Wiring
see gallery below for mapping RFM95 with ESP.
Serial interface and does not work, when pin 2 is connected. Pin can be connected after serial starts working.
Client with LoRa Radio Nove v1.0
As "LoRa Client (the module that is sending data, form a sensor) I am using the LoRa Radio Node v1.0
- Power supply: 3.7V 14500 Lipo battery Or 3.7-12V DC power(VCC GND: 2PIN 2510-I Type connect) and 3.3V regulator with 500mA peak current output
- ATmega328P @ 8MHz with 3.3V logic/power, 32K of flash and 2K of RAM, same usage as Arduino pro mini.
- Hardware Serial, hardware I2C, hardware SPI support
- 1 x PWM pins: D3
- 2 x analog inputs: A0 A1
- Pin #13 BLUE LED for general purpose blinking
- Reset button
Wiring
Nothing to wire at all. Connect Antenna, put in a 3.7V LiI-Ion Battery (e.g. Model 17500, 3.7V,850mAH) for operation and use a standard FTDI cable to program and test.
Pin Mapping between RFM95 and ATmega328P:
RFM_DIO0 = 2
RFM_NSS = 10
RFM_RESET 9
The ATMega and the RFM95 will be sent to Deep-Sleep to save power. Wake-up is possible via connecting RESET to GND.
First Results
Distance: Amazing, 3 level building with thick walls down into the cellar - still working. RSSI values from -23 (when close to together, down-to -99 on some distance). I am impressed by LoRa technology. It works for my use-case 🙂
Power-Consumption - Sending: A lot when sending - but only on peek times.
Power-Consumption - Sleeping: Using DeepSleep Library and sending the RFM95 via LoRa.sleep results in 0.08mA to 0.1mA, providing nearly a year of runtime with a 850mAh battery. Perfect