Introduction: ESP32 LoRaWAN Mote

About: Electronic and Computer Engineering student University of Limerick.

In this project we will be using the ESP32 Heltec WiFi LoRa OLED board from Banggood to build a LoRaWAN Mote (end node) to send data from an DHT22 sensor to The Things Network(TTN) and display the sensor values. The code and libraries used in the project can be found on GitHub. You will also need to purchase an antenna and pig tail connector (U.FL to SMA). An TTN account is also needed to register the Mote and application.

This project assumes some knowledge of the Arduino IDE, LoRaWAN and of ESP32 in general. Some soldering skills are also required to attached the header pins to the ESP32 board. A working LoRa Gateway connected to The Things Network will also be needed.

If you do not have an LoRa Gateway up and running you can follow my other tutorial setting up an 1_CH LoRa Gatway using this Heltec board. This type of Gateway is only for development on the bench and is not a full LoRa Gateway.

This project will also work using other ESP32 development board’s with WiFi, LoRa and OLED but pin_mapping will be different and will require good knowledge of how to follow schematics and pin_out diagrams of the selected board

For a full walk through with step by step pictures vist here.

Step 1: About the Heltec Board

Specifications:

  • CPU: ESP32 DOWDQ6
    • 240 MHz dual core
    • WiFi up to 150Mbps 802.11 b/g/n/e/i
    • Bluetooth 4.2 (BLE)
  • Flash: 4MB (32Mbit)
  • USB-Serial Converter: CP2102
  • Radio: Semtech SX1276
  • Antenna connector: IPX (U.FL)
  • OLED Screen:
    • Size: 0.96″
    • Driver: SSD1306
    • Resolution: 128×64 px
  • Li-Ion/Li-Po charging circuit
  • Battery socket: 2pin raster 1.25 mm
  • Size: 52 x 25.4 x 10.3 mm

Step 2: Setting Up the Arduino IDE for ESP32

Important: before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work. The ESP32 is currently being integrated with the Arduino IDE just like it was done for the ESP8266. This add-on for the Arduino IDE allows you to program the ESP32 using the Arduino IDE and its programming language.

IMPORTANT NOTE:

If this is your first time installing the ESP32 on the Arduino IDE, simply follow the installation procedure described below.
If you’ve already installed the ESP32 add-on using the old method, you should remove the espressif folder first. Go to the end of this part to learn how to remove the espressif folder by following Part 1 Note#1.
Never power on the board without connecting the antenna first as you may damage the radio chip on board.

Step 3: Installing the ESP32 Board

To install the ESP32 board in your Arduino IDE, follow these next instructions:
1) Open the preferences window from the Arduino IDE. Go to File > Preferences
2) Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button.
Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:
https://dl.espressif.com/dl/package_esp32_index.json,
http://arduino.esp8266.com/stable/package_esp8266com_index.json