ESP32 LoRa Tutorial
This article based on heltec WiFi Kit 32. This a board based on ESP32 with WiFi, Bluetooth, LoRa. In the post “ESP32 LoRa Tutorial” you can learn how to use Lora with ESP32. Remember : LoRa is not available in Every ESP32 Board. I used Heltec WiFi 32 and TTGO LoRa 868 Boaard in this tutorial.
WIFI LoRA 32 (V2) overview：
- WiFi + bluetooth + LoRa – Support WIFI802.11 b/g/n/e/i ,Traditional bluetooth and BLE low-power dual-mode bluetooth. Provide exclusive LoRaWAN protocol source code running on ESP32 and provide technical support.
- Highly integrated – Integrate the functions of MCU, SX125x LoRa chip, radio frequency loop switch, radio frequency circuit, lithium battery management, USB to serial port, etc. Users only need a Micro USB connection to get complete wi-fi, bluetooth and LoRa functions.
- Better low power consumption design – The ESP32 chip has a high level of low-power performance in the industry, including fine resolution clock gate control, power saving mode and dynamic voltage regulation.Designed for mobile devices, wearable electronics and Internet of things applications.Resting current 800uA ± 50uA(the instructions executed by MCU need to be read from the FLASH chip used on the board, so the power consumption cannot be reached to the limit)
- More stable performance – The new version of WIFI LoRa 32 has redesigned the circuit part and upgraded the safety and stability of the circuit on the premise of keeping the pin order and the previous generation unchanged.Including better impedance matching and more scientific power supply circuits. Work at 30 ° C to + 80 ° C temperature range.
- Perfect for the LoRaWAN protocol – The LoRa + LoRaWAN protocol is the most mature and stable narrowband Internet of things communication technology.
- The long distance – LoRa spread spectrum communication has the characteristics of long communication distance. Under the premise of good impedance matching and sufficient power supply, in the open area, our communication distance can reach 3Km.
- The large capacity – On the premise of cooperating with LoRa Gateway，A gateway can communicate with more than 1,000 nodes.
- Security – LoRaWAN is the first Internet of things to propose double encryption, preventing the possibility of radio eavesdropping.
- Low power consumption – On the basis of the LoRaWAN source code provided by Semtech, we made a lot of improvements to the low-power part of the code. Within one transmission cycle of the system, only a few milliseconds were in the working state, and the rest of the time was in the deep sleep state.For example, if my application sends a set of data in 8 hours, the whole system runs in milliseconds during those 8 hours, and the rest of the time is in deep sleep.This can greatly reduce the use of batteries.
Heltec successfully transplanted the LoRaWAN protocol to the ESP32 + Arduino platform, using internal RTC, and supporting deep sleep.Users only need a simple configuration to complete the application of LoRaWAN.
- Frequency： 240MHz
- The processor： 2个Tensilica LX6 + 1个ULPThe processor
- Main control chip：ESP32
- LoRachip support frequency band： SX1276（868-915、923MHz）；SX1278(433-510MHz)
- Open communication distance：3KM
- Computing power：As high as 600 dmips
- Dual mode bluetooth： Traditional bluetooth and BLE low power bluetooth
- The development environment：Perfect support for Arduino
- Working voltage： 3.3v~ 7v
- Operating range temperature：-40~80℃
- Receiver sensitivity：-139dbm（SF12, BW125KHz）
- UDP continuous throughput：135Mbps
- USB-to-UART bridge chip：CP2102
- WIFI Support mode：sniffer、Station、softAP和Wi-Fi Direct
Recommended : Dynamic WLAN configuration for ESP32 Board | AutoConnect
Installation Instructions using Arduino IDE
Based on Arduino source codes and toolchain for WiFi_Kit_series made by HelTecAutomation. Visit this github link https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.
Tested on 32 and 64 bit Windows 10 machines
- Download and install the latest Arduino IDE
Windows Installerfrom arduino.cc
- Download and install Git from git-scm.com
- If you don’t install Git,you choose
dowload zipfrom the home page and Unzip the file to
/Documents/Arduino/hardware/heltec,Skip steps three to step four
- Execute the command under the \Documents\Arduino\hardware path Start
Git Bashand run through the following steps:
git clone https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.git heltec
get.exefinishes, you should see the following files in the directory
- Plug your ESP32 board and wait for the drivers to install (or install manually any that might be required)
- Start Arduino IDE
- Select your board in
Tools > Boardmenu
- Select the COM port that the board is attached to
- Compile and upload (You might need to hold the
PRGbutton while uploading)
How to update to the latest code
Git Bashand input
- Wait for git to pull any changes and close
Installation instructions for Debian / Ubuntu OS
- Install latest Arduino IDE from arduino.cc
- Open Terminal and execute the following command (copy->paste and hit enter):
sudo usermod -a -G dialout $USER && \ sudo apt-get install git && \ wget https://bootstrap.pypa.io/get-pip.py && \ sudo python get-pip.py && \ sudo pip install pyserial && \ mkdir -p ~/Arduino/hardware && \ cd ~/Arduino/hardware && \ git clone https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.git heltec && \ cd heltec/esp32 && \ git submodule update --init --recursive && \ cd tools && \ python get.py && \ cd ~/Arduino/hardware/heltec/esp8266 && \ git submodule update --init --recursive && \ cd tools && \ python get.py
- Restart Arduino IDE
- If you have Arduino.app installed to /Applications/, modify the installation as follows, beginning at
mkdir -p ~/Arduino...:
cd /Applications/Arduino_*/Contents/java/ mkdir -p hardware && \ cd hardware && \ git clone https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.git heltec && \ cd heltec/esp32 && \ git submodule update --init --recursive && \ cd tools && \ python get.py && \ cd /Applications/Arduino_*/Contents/java/hardware/heltec/esp8266 && \ git submodule update --init --recursive && \ cd tools && \ python get.py
WiFi LORA 32 V2 Pinout Diagram
ESP32 LoRa Tutorial
What is LoRa?
LoRa is a wireless data communication technology that uses a radio modulation technique that can be generated by Semtech LoRa transceiver chips. LoRa allows long range communication of small amounts of data (which means a low bandwidth), high immunity to interference, while minimizing power consumption. So, it allows long distance communication with low power requirements.
LoRa uses unlicensed frequencies that are available worldwide. These are the most widely used frequencies:
- 868 MHz for Europe
- 915 MHz for North America
- 433 MHz band for Asia
Because these bands are unlicensed, anyone can freely use them without paying or having to get a license. Check the frequencies used in your country.
You can also build a LoRa network using LoRaWAN. The LoRaWAN protocol is a Low Power Wide Area Network (LPWAN) specification derived from LoRa technology standardized by the LoRa Alliance. We won’t explore LoRaWAN in this tutorial, but for more information you can check the LoRa Alliance and The Things Network websites.
Now i have TTGO lora 868. you can use this board If you successfully installed WiFi 32 kit. because this compatible with above configuration.
How to Use Lora 868 Module with Arduino IDE
- Open Arduino IDE
- Click Tools Tab and select “WiFi_Lora_32”Board.
- Click Tools tab and Select Port.
- Now Go to File>Example> Lora Library and select Lora Sender example program and Flash it.
- Now Flash Lora Receiver Program in another Board.
- Open Serial Monitor For logs.
Similarly you can try another Examples.
I hope you like this post “ESP32 LoRa Tutorial”. If have a query related to this post “ESP32 LoRa Tutorial”. Do you have any questions? Leave a comment down below!Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.
3 thoughts on “ESP32 LoRa Tutorial”
there doesn’t appear to be a .ino file to download in this article
In this article, i am using examples that provided by lora library.
Pingback: GPIO Pins of ESP32 | ESP32 Tutorials - IoTbyHVM - Bits & Bytes of IoT