Wednesday, May 18, 2016

Esp8266 meets LoRaWan

I guess that you don't have any doubts that ESP8266 can do LoRaWan.

For this project I've used two modules:

1.LoRaWan Single Channel Gateway

Single channel gateway ( to be compatible with LoRaWan you must have 8 channes) was made using the SX1276 module and a Raspberry Pi2. Comunication is done over SPI using wiringPi library.

Single channel gateway

2.LoRaWan node with ESP8266 

For node I've used the Witty module with the modifications from this post.
As a software I've used the ported LMICv1.51 and modified to send data to only one channel since the gateway is single channel ( I am using 868.1Mhz).

Lora Node with ESP8266

Now the gateway is enrolled in TTN ( and the data has started to arrive. I've managed to receive also data from other surrounding nodes.

On the gateway data looks like:

Packet RSSI: -107, RSSI: -105, SNR: -11, Length: 108

rxpk update: {"rxpk":[{"tmst":368384825,"chan":0,"rfch":0,"freq":868.100000,"stat":1,"modu":"LORA","datr":"SF7BW125","codr":"4/5","lsnr":-11,"rssi":-107,"size":108,"data":"Wqish6GVYpKy6o9WFHingeTJ1oh+ABc8iALBvwz44yxZP+BKDocaC5VQT5Y6dDdUaBILVjRMz0Ynzow1U/Kkts9AoZh3Ja3DX+DyY27exB+BKpSx2rXJ2vs9svm/EKYIsPF0RG1E+7lBYaD9"}]}

and data from my nodes:

Packet RSSI: -28, RSSI: -105, SNR: 12, Length: 31

rxpk update: {"rxpk":[{"tmst":1060664170,"chan":0,"rfch":0,"freq":868.100000,"stat":1,"modu":"LORA","datr":"SF7BW125","codr":"4/5","lsnr":12,"rssi":-28,"size":31,"data":"QGIH4AIAqgABvJNVF4DpUapp/xQN1REVnI+jYoR6Ig=="}]}

Next I'll have to add sensors to nodes and to run some tests for range and buy a real gateway.

More info about LMIC port and code here.


  1. Seems nice. Can you use LoRaWAN and WiFi communications at the same time? Or it is too much for the MCU?

  2. You can use both of them. You can build a mini LoRa gateway in fact with one ESP8266. The MCU can handle it without any problems.

  3. Excellent! Thank you very much!

  4. I want to use RFM95 LORA +8266 (ESP12E) and I have a sensor that works using I2C. I can not see pin#4,5 on ESP12 left for my use. Any suggestion?

    1. It's easy. Connect the DIO pins (5,4,3) to other pins like (12,13,3) and change the lmic_pinmap structure to reflect the new pins.

  5. How did you modified the lmic to send on only one channel?

  6. I've modified the library to use one channel, not to round robin them.