This guide will instruct you to create a DIY LoRaWAN node using ESP32, RFM95 module and RadioLib.

  • The guide is applicable to all ESP32 variant and RFM95 module with minor difference.
  • The guide uses ESP32 Dev Module and RFM95 for 915/923Mhz.
  • The node will support LoRaWAN 1.1.0, Class A and uplink/downlink feature. LoRaWAN 1.0.x is still backward supported. Class B and C are not supported yet.
  • Product link: ESP32 and RFM95. AIThinker Ra01/02/01h is supported too.
  • Source code: From Easy LoRaWAN. This source code has OTAA persistence compared to the sample code of RadioLib. OTAA persistence allows the node to increase OTAA counter during an OTAA join.

ESP32 Dev Module:

HopeRF RFM95

AI-Thinker ra01/02/01h

Step 1: To wire LoRa module to ESP32 as below

  •  LORA_SS              25 // Must have pull up resistor
  •  LORA_SCK           18 // Default SCK for VSPI in ESP32
  •  LORA_MOSI         23 // Default MOSI for VSPI in ESP32
  •  LORA_MISO         19 // Default MISO for VSPI in ESP32
  •  LORA_DIO0          26
  •  LORA_DIO1          35
  •  LORA_DIO2          34
  •  LORA_RESET       27

Step 2: Install softwares and libraries

  • To install Arduino IDE at here
  • To add Arduino support for ESP32: here
  • To install UART driver: Check section B2 here

Step 3: To import RadioLib library

Step 4: To download source code at the top of the guide

Step 5: To modify GPIOs  to fit your board wiring in config.h

  • To use SX1276 for EU868, US915, AU915, AS923, AS923_2, AS923_3 and AS923_4
  • To use Sx1278 for CN470

Step 6: To change your JOIN_EUI, APP_KEY, NWK_KEY and Region

Step 7: Upload the code to the node

Step 8: To configure your gateways and LoRaWAN server

Step 9: After step 8, you can see the node sending uplink data to server and receiving downlink data from the server.

Enjoy.

4.7 3 votes
Article Rating
Subscribe
Notify of
14 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

What should I choose OTAA or ABP?
ABP seems simpler.

Does this library support Class C?

Why my downlinks are pending a while in server before getting downloaded to the LoRaWAN node?
Thanks.

Thanks alot for the guides.
The OTAA is working great.

Does this code work with LoRaWAN 1.0.x?
Thanks a lot.

Will this DIY node work with my RAK gateway and Dragino gateway?
Thanks in advance.

Hi,
Do you have some guides to create a DIY LoRaWAN node using STM32 board?
Thanks a lot.

Want to test LoRaWAN?

Subscribe Easy LoRaWAN Cloud to try this guide on your LoRaWAN gateways and nodes.
We will help you to get started and troubleshooting.

Thanks for the guides?

If this guide saves your days, you can give us a cup of coffee.
This is one-time donation.
Thank you for supporting us.