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
- CPU: ESP32 DOWDQ6
- 240 MHz dual core
- WiFi up to 150Mbps 802.11 b/g/n/e/i
- Bluetooth 4.2 (BLE)
- Size: 0.96″
- Driver: SSD1306
- Resolution: 128×64 px
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.
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: