Lorawan esp32

Lorawan esp32 DEFAULT

The Overview


To install this library:

  • install it using the Arduino Library manager ("Sketch" -> "Include Library" -> "Manage Libraries..."), or
  • download a zip file from GitHub using the "Download ZIP" button and install it using the IDE ("Sketch" -> "Include Library" -> "Add .ZIP Library..."
  • clone this git repository into your sketchbook/libraries folder.

For more info, see https://www.arduino.cc/en/Guide/Libraries

The library provides a fairly complete LoRaWAN Class A and Class C implementation. The latest update (February 10th, 2020) has full region support (KR920, AS923, US915, etc.).

The following functions are included:

  • LoRaWAN protocol V1.0.2 Class A and Class C;
  • Use ESP32's internal RTC (15KHz);
  • All ESP32 + LoRa boards made by Heltec Automation(TM) can use this library;
  • Support deep sleep and stop mode;
  • Receive and print downlink payload;
  • Print and OLED show downlink data length and RSSI;
  • An unique license related to Chip ID is needed, you can check your license here: http://www.heltec.cn/search/

working bandstatus
EU433not test
CN470work well
EU863work well
US915work well
AU916work well
CN779not test
AS923not test
KR920not test
IN865not test
US915_HYBRIDnot test

What certainly works:

  • Sending payload to a LoRa gateway via LoRaWAN protocol;
  • Encryption and message integrity checking;
  • Over-the-air activation (OTAA / joining);
  • Deep sleep and wake up;
  • Class A operation;
  • Class C operation;
  • ABP mode.

What has not been tested:

  • Receiving downlink packets in the RX2 window.

The only different with a common Arduino library is need a unique license. It's relate to ESP32 Chip ID.

How to get your board's Chip ID?

How to get the unique license?

Only the boards made after August 2018 can be checked from this page, if you have a former version, you can mail to [email protected] and improve you already have a Heltec Automation made board.

Choose the right working band you need

Choose working band you need In the Arduino tools menu:

For more details about how to use this library, please refer to this document:

ESP32 LoRaWAN library usage.

How to Use This Library in Platform.io?

The options in the Tools menu is relate to the Heltec ESP32 development framework, but in the Platform.io, it's use original Espressif ESP32 framework. So we need additional definition the in file.


Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labeled as for reference.

Also you can talk in our forum: http://community.heltec.cn/

Sours: https://github.com/HelTecAutomation/ESP32_LoRaWAN

ESP32 LoRa 1-CH Gateway, LoRaWAN, and the Things Network



Note: Please note that this tutorial is for SPX-14893. If you are using this with latest version [WRL-15006 ] please refer to the SparkFun LoRa Gateway 1-Channel Hookup Guide.

Experimental Products:SparkX productsare rapidly produced to bring you the most cutting edge technology as it becomes available. These products are tested but come with no guarantees. Live technical support is not available for SparkX products.

The ESP32 LoRa 1-CH Gateway combines an ESP32 -- a programmable microcontroller featuring both WiFi and Bluetooth radios -- with an RFM95W LoRa transceiver to create a single-channel LoRa gateway. It's a perfect, low-cost tool for monitoring a dozen-or-so LoRa devices, and relaying their messages up to the cloud.

Complete with a Qwiic connector and a breadboard-compatible array of ESP32 pin-breakouts, this board can can also serve as a general-purpose ESP32/RFM95W development platform. So, instead of using it as a LoRaWAN gateway, you can turn it into a LoRa device, and use the powerful ESP32 microcontroller to monitor sensors, host a web server, run a display or more.

These boards are a great way to begin dipping your toes into the world of LoRa and LoRaWAN. Not only can they be programmed as versatile single-channel gateway, but they can also be used as a LoRa device, or a general ESP32/RFM95W development board.

The goal of this tutorial is to get you quickly up-and-running with the ESP32 LoRa 1-CH Gateway. It'll explain how to program the board in Arduino, how to our recommended gateway firmware, and even how to turn the board into a LoRa device.

Required Materials

The ESP32 LoRa Single-Channel Gateway is designed to be a nearly-complete LoRa gateway. There are just a few extra components you may need to get it up-and-running. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

To power and program the board, you'll need a micro-B USB cable and a computer with Arduino installed. To boost your LoRa radio's signal, you'll also need an antenna. You can either use the included U.FL connector -- with a U.FL-to-SMA adapter and 900 MHz SMA antenna -- or solder on a ~3-inch strip of wire.


You will need a soldering iron, solder, and general soldering accessories.

Suggested Reading

If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing.

Hardware Setup

The ESP32 LoRa 1-CH Gateway includes almost everything you need to set up either a LoRaWAN gateway or device. You may not even have to solder anything to it to get started! Here's a quick rundown of the bare minimum you'll need to get started with the board.


To allow the board to communicate with other LoRa devices, you'll need to add an antenna. This can be attached to either the U.FL connector or the ANT pin on the board.

The U.FL connector can be attached to an SMA to U.FL adapter cable, which can then be paired with a 900 MHz Duck Antenna.

ESP32/LoRa board with wire antenna soldered in

3.07" strip of 22-AWG solid-core wire soldered to the ANT pin. Use the hole adjacent to the ANT pin for strain relief!

In lieu of a U.FL antenna, a strip of wire soldered to the ANT pin and sticking straight up will work as well. Here are wire lengths for quarter-wave antennas at 915MHz and 434MHz:

FrequencyLength (inches)Length (mm)
915 MHz3.07" (3 + 1/16")78mm
434 MHz6.47" (6 + 1/2")164mm

Powering the Board

The board is nominally powered via the on-board micro-USB connector. The other end of your USB cable can be plugged into either a computer, wall adapter, or a USB battery pack.

Examples power supplies -- USB or 3.3V

Alternatively, the board can be powered using a regulated 3.3V power supply. This supply should be applied to the 3.3V and GND pins.

Under normal operation the ESP32 LoRa 1-CH Gateway consumes between 50-100mA. (Running the ESP-sc-gway sketch.)

Arduino IDE Setup

To set up the gateway software you'll need to install the ESP32 Arduino core as well as the library dependencies of the ESP32 LoRa Gateway sketch.

Arduino Board Setup

The example code and libraries for this board are all written for the Arduino IDE. If you haven't already done so, you'll need to install the Arduino core for ESP32. The ESP32 Arduino core must be installed manually. You can find the core files on espressif's GitHub: https://github.com/espressif/arduino-esp32. Follow the Installation Instructions to add the core to your Arduino IDE.

Adding a Custom Board

Although it's possible to upload code to the board using the standard board definitions, we recommend customizing the core to add support for the SparkX ESP32 LoRa Gateway.

To add the custom board, begin by downloading the board's variant file here below.

Download the SparkX ESP32 LoRa Arduino variant definition (ZIP)

Then unzip the contents into ...{Arduino Sketchbook}/hardware/espressif/esp32/variants.

Variant install location

The "sparkx_esp32_lora" folder should live in the "variants" folder of your ESP32 hardware directory.

Next, copy the text below and add it to the bottom of ...{Arduino Sketchbook}/hardware/espressif/esp32/boards.txt:

This custom board file specifies the SPI and built-in LED pins. Without it, you'll need to re-define them in your sketch.

Once the custom board has been added to the ESP32 core, open Arduino and select "SparkX ESP32 LoRa Gateway" under the Tools > Board > ESP32 Arduino menu.

SparkX ESP32 LoRa board in Arduino

Single-Channel LoRaWAN Gateway Code

The ESP32 single-channel gateway example code is hosted by things4u on GitHub. Download it from their repository.

GitHub: ESP-1ch-Gateway-v5.0 (ZIP)

This repository includes both the Arduino sketch and the libraries it depends on. Before compiling the sketch you'll need to extract all libraries from the repository's "library" folder into your Arduino sketchbook's "libraries" folder. For more help installing the libraries, check out the Getting Started section of the README.

To open the example code, open the ESP-sc-gway.ino file. When the IDE loads, it should include another dozen-or-so tabs -- it's a hefty, but well-segmented sketch!

Configure the Gateway Sketch

Before uploading the ESP-1ch-Gateway sketch to your board, you'll need to make a handful of modifications to a couple of files. Here's a quick overview:


This file is the main source of configuration for the gateway sketch. The definitions you'll probably have to modify are:

  • Radio
    • -- This sets the frequency range your radio will communicate on. Set this to either (Asia), (EU), or (US)
    • -- This sets the LoRa spread factor. , , , , , or can be used. Note that this will affect which devices your gateway can communicate with.
    • -- Channel Activity Detection. If enabled (set to 1) CAD will allow the gateway to monitor messages sent at any spread factor. The tradeoff if enabled: very weak signals may not be picked up by the radio.
  • Hardware
    • -- This board does not include an OLED, set this to 0.
    • -- This configures the SPI and other hardware settings. Set this to 6, we'll add a custom hardware definition later.
    • -- Ensure this is defined and CFG_sx1272_radio is not. This configures the LoRa radio connected to the ESP32.
  • The Things Network (TTN)
    • -- The server for your LoRa router. E.g. or
    • -- is the standard port for TTN
    • -- Customize the name of your gateway
    • -- Your email address, or that of the owner of the gateway
    • and _ -- GPS coordinates of your gateway
  • WiFi
    • Add at least one WiFi network to the array, but leave the first entry blank. For example:

There are a lot of other values which can all optionally be configured. For a complete rundown, check out the Editing the ESP-sc-gway.h part of the README.


This file defines how the LoRa modem is configured, including which frequency channels it can use and which pins the ESP32 uses to communicate with it. Be careful modifying most of the definitions in here, but one section you will have to modify is the declarations.

First, find the line that says and delete it. Then copy and paste these lines in its place (between the and ):

The array can be adjusted, if you want to use different subbands, but, beyond that, there's not much else in here we recommend modifying.

Upload the Sketch

With your modifications made, try compiling and uploading the sketch to your ESP32. After it's uploaded, open up your serial monitor and set the baud rate to 115200. Debug messages here can be very handy, and finding your gateway's IP address is critical if you want to monitor the web server.

The sketch may take a long time to set up the first time through -- it will format your SPIFFS file system and create a non-volatile configuration file. Once that's complete, you should see the ESP32 attempt to connect to your WiFi network, then initialize the radio.

After the ESP32 has connected, look for it to print out an IP address. Open up your computer's web browser and plug that into the address bar. You should be greeted by the ESP Gateway Config web portal:

ESP Gateway Config served by the ESP32

Config and log page served by the ESP32.

This web page can be used to monitor messages coming through and what frequencies and spread factors they came in on. It can also be used to change your gateway's configuration on-the-fly. You can adjust the channel or spread factor, or turn CAD on/off, or even turn on simplistic frequency-hopping.

Of course, to see any messages get through you'll need a LoRa device (or device_s_) set up to communicate with your gateway. Check out the next section for a quick guide on setting up a second ESP32 LoRa board as a LoRa device.

Turning a Gateway Into a Device

If you have a pair of ESP32 gateway's you can use one of them as a LoRaWAN device. This section will get you set up with our preferred LoRaWAN Arduino library and a simple example sketch to get started.

Get the Arduino-LMIC Library to Set Up a Device

If you have a pair of ESP32 Gateways and want to set one of them up as a LoRa device, we recommend using the Arduino-LMIC library. There seem to be many versions of the Arduino-LMIC library hanging around, we've had good success with the library forked by mcci-catena:

mcci-catena: arduino-lmic

To install the library, download the ZIP file from GitHub. Then use the Arduino's "Add ZIP library" feature (Sketch > Include Library > Add .ZIP Library) to import the zip file into your Arduino sketchbook.

Configure LMIC

Before can use an example sketch in the LMIC library, you'll need to configure it. To configure the library, navigate to the "arduino-lmic" library in your ..{Arduino Sketchbook}/libraries folder. Then go to project_config and open lmic_project_config.h.

Here you'll define which frequency bands your LoRa device will use. You can also turn on debugging and enable/disable a host of features with definitions in this file.

Make sure you uncomment one-and-only-one of the "CFG..." declarations. If you're in the USA, uncomment . Ultimately, this frequency should match what you set in the gateway.

Below is my config file -- I've turned on debugging, because I'm a log junkie.

If you try to use the "raw" example in this library, you'll need to uncomment , otherwise keep it commented-out.

Modify the "SPI.begin" call

Just to be sure your pin definitions are correct, I recommend modifying the line in arduino-lmic/src/hal/hal.cpp (line 136 as of this commit) to:

This will ensure that your SPI pins are set correctly -- this may only be necessary if you're not using the custom "SparkX ESP32 LoRa Gateway" Arduino board.

Load the Single-Channel Device Example

We've taken one of the examples in the Arduino-LMIC library and modified it to work more reliably with a single-channel gateway.

Click the button below to download the example. Then open up ESP-1CH-TTN-Device-ABP.ino:

Download the single-channel LoRaWAN device example (ZIP)

Among the modifications in this example are the pin map between radio and ESP32 -- set with these lines:

We've also modified the enabled channels to only use a single channel with the lines below (note this modification hasn't yet been tested on non-US frequency bands).

The spread factor is set near the end of setup() with the line. This can be replaced with , , or at the default 903.9MHz frequency.

But wait! Before uploading this example, there's one more modification you need to make: your LoRaWAN application, network session, and device keys! For that, and an application server, we recommend The Things Network.

Routing to The Things Network

The final components to a LoRaWAN network are a server and application. You can set up a LoRaWAN server of your own, but, for prototyping at least, The Things Network is a great, free tool for authenticating and routing your data.

Single-Channel Blues

At the trade-off of being low-cost, this gateway is only capable of monitoring a single LoRa channel on a limited set of spread factors. Single-channel gateway's don't get much support from LoRaWAN platforms like The Things Network, as they are not, necessarily, LoRaWAN-compliant. They are, however, a great way to begin exploring the world of LoRa and LoRaWAN!

If you haven't already, head to thethingsnetwork.org and create an account. Once that's done, go to your Console.

The Things Network

Create an Application

In order to create a device, you first need to create an application to house it under. In the console, click "Applications" then click "add application".

Fill out any ID and description you'd like. The Application EUI will automatically be generated when you create the application. You can also pick your preferred handler for the application (e.g. ttn-handler-us-west).

Creating a TTN application

Create and Configure a Device

Next create a device in your application. Under the "Devices" section, click "register device".

This is again pretty simple. Fill out a unique device ID, click the "generate" button under "Device EUI" to automatically generate a EUI. Then click "Register."

Creating a TTN device

This example sketch only supports ABP activation, so you'll need to modify that in the device settings. In the "Device Overview" page, click "Settings". From there, under "Activation Method" click ABP. I also recommend disabling Frame Counter Checks. The gateway is capable of frame-counter checks, but it can get out of sync -- especially if you have another gateway nearby.

Modifying TTN device settings

Save the settings and go back to your "Device Overview" page. You should see new keys, including "Network Session Key", "App Session Key", and "Device Address." These will need to be plugged into the device sketch and uploaded to the device.

Update the Example Code

With your application, network session, and device keys in-hand, you're ready to finish configuring the ESP32 LoRa device sketch and start posting data!

On the "Device Overview" page, click the "code" symbol () next to "Network Session Key" and "App Session Key" -- this will make the key visible and display it as a 16-byte array. Copy each of those keys, and paste them in place of the place-holders. "Network Session Key" should be pasted into the variable and "App Session Key" should be pasted into the variable.

The variable expects a single 32-bit variable, so copy the "Device Address" key as shown and paste that into the placeholder.

Grabbing your device keys

Here's an example of what your three constants should look like once done:

And that's it! Now upload the code to your ESP32 LoRa board.

Testing the Code

After setup, the device should immediately send a "Hello, World" message. It'll continue to send a message every minute or any time the "0" button on the board is pressed.

To check if your gateway is receiving the message, you can either check the Serial Monitor or monitor the ESP Gateway Config page served by the gateway. Every time a message is received it should be added to the "Message History" table.

If messages are getting through to your gateway, click the "Data" tab on your device to check for new messages.

TTN device data visible

The message's payload -- which was encrypted between leaving the device and getting to the router -- should be a series of hex values adding up to "Hello, world".


If messages are not getting to your gateway, first make sure the channel and spread factor match up. Left unchanged, the device example code should be sending data out on the 903.9MHz channel at a spread factor of 7 (That's assuming you've set the LMIC library to . If it's set to a European frequency spectrum, it'll be 868.1MHz, SF7).

You can use the gateway's web server to adjust these setting on the fly. Note that the channel numbers should sequentially match the array in loraModem.h -- e.g. channel 0 should be 903.9MHz (again, assuming US frequencies).

If messages are getting to your gateway, but not showing up on your TTN device console, consider changing the variable in "ESP-sc-gway.h". I haven't had success with the us-west router, but has worked perfectly (even in the US).

Resources and Going Further

Thanks for coming on this single-channel LoRaWAN gateway journey with us! Here are a few links and documents that might prove handy as you continue exploring the world of LoRa with this board:

Sours: https://learn.sparkfun.com/tutorials/esp32-lora-1-ch-gateway-lorawan-and-the-things-network/all
  1. Southern pride dobermans
  2. How do na vi reproduce
  3. Medium sized tv

Big ESP32 + SX127x topic part 3


For previous parts of this topic see:
Big ESP32 / SX127x topic part 1
Big ESP32 + SX127x topic part 2

[Last updated: 2021-10-10]

The ESP32 microcontroller and SX127x LoRa transceivers

The ESP32 has built-in support for Wifi and Bluetooth communication but not for LoRa. A SX127x (or compatible e.g. RFM9x) LoRa transceiver adds support for LoRa and the LoRaWAN protocol that are needed for The Things Network.

Semtech SX127x LoRa transceivers and HopeRF RFM9x LoRa transceivers are identical. They come in different variants, depending on the targeted frequency band (433, 868 and 915 MHz). Which frequencies are used depends on the geographic region and local ISM band regulations. (HopeRF module numbers usually end with W which stands for ‘international version’.)

The ESP32 and the LoRa transceivers come in several forms:

  • On modules.
    Modules contain additional components required for making the chips work. The modules use 1.27mm or 2mm pin spacing. For use with breadboards and prototyping PCB with 2.54mm spacing adapters are required. Examples: ESP-WROOM-32 ESP32 module, SX1276 and RFM95 LoRa modules.
  • On development boards.
    Development boards (often) convert to 2.54mm spacing and add additional functionality like power converter, buttons and LEDs. Development boards use either standard modules or separate components. Examples: ESP32 Dev board, Lolin32 and NodeMCU-32S. A pure adapter is the HopeRF RFM95 adapter.
  • On custom boards which combine ESP32 with a LoRa transceiver.
    Custom boards can use standard modules, separate components or a combination of both.
    Examples: Heltec Wifi LoRa 32 and TTGO LoRa32.

IDE’s and Development Frameworks

There are two frameworks that can be used for ESP32 development: ESP-IDF and Arduino. ESP-IDF is a dedicated for the ESP32 and best supports all ESP32 features. Arduino is very popular because it is cross-platform, has wide community support and has many libraries available. ESP32 Arduino core which is used for Arduino development is based on the ESP-IDF.
PlatformIO will install support for ESP32 automatically. For the Arduino IDE this will have to be done manually: See Installing ESP32 support for Arduino IDE.

LoRaWAN library

In addition to the hardware, software is needed for implementing the LoRaWAN protocol. The SX127x LoRa tranceiver provides LoRa radio modulation but it does not implement the LoRaWAN protocol. The protocol has to be implemented in software that needs to run on the ESP32.
MCCI LMIC is the preferred LoRaWAN library for Arduino development. It is the most mature, most complete LMIC library for Arduino and it is actively maintained. Do read its README.mdfirst and be aware that the library is default configured to use the us915 frequency plan so most people will need to change its configuration. It’s predecessor library Classic LMIC is no longer maintained.

Examples - Get the basics working first

See [update] below.

Always get the basic examples working first because this will make it much easier to troubleshoot LoRaWAN issues and beginner mistakes.
Only after the essential basics are working should you start adding more features (e.g. add support for reading and uploading sensor data, send output to OLED display etc.).

The library includes two essential basic examples: and . These are the ‘Hello World’ type examples for The Things Network. uses OTAA activation (preferred) and uses ABP activation.

For TTN V2 it was advised to:
Get the example working first because V2 does not require downlink support for ABP (V3 does), the example uses uplink messages only and is therefore simpler to test . If that works continue with the example. Latter also uses uplink messages only but OTAA requires downlinks to work otherwise the join will fail.

For V3 (The Things Stack V3) things have changed:
In V3 registering an ABP node is more complex and requires more details to be specified for an ABP device than for an OTAA device and requires more LoRaWAN knowledge. Therefore it will be easier to try first and if that works just skip . Latter can still be useful for helping detect downlink issues but registering an ABP device is more complex and for proper LoRaWAN operation V3 actually also requires downlink support for ABP devices.

Use of OTAA is strongly preferred. OTAA and ABP require different settings. See TTN Console and remarks in the examples for more information.


It is preferred to try the very complete cross-platform example LMIC-node instead of the above described and examples that are included with the LMIC library. LMIC-node is more advanced and supports most boards that are described here out of the box. It is well documented, provides useful status information (to serial monitor and onboard display) and does not require programming or changing source code to get your node up and running. You can find LMIC-node here:


GitHub - lnlp/LMIC-node: LMIC-node | One example to rule them all. LMIC-node...

LMIC-node | One example to rule them all. LMIC-node is an example LoRaWAN application for a node that can be used with The Things Network. It demonstrates how to send uplink messages, how to receiv...

In addition you can find pinout diagrams for most boards here:


GitHub - lnlp/pinout-diagrams: This repository contains a collection of...

This repository contains a collection of pinout diagrams for popular microcontroller development boards and LoRa development boards. - GitHub - lnlp/pinout-diagrams: This repository contains a coll...

OLED Display library

A popular library for monochrome OLED displays is: U8g2
This library is easy to use and supports primitive graphics operations and different fonts.
It is well-documented and contains several examples. It also contains U8x8 which is a subset that only supports text, 8x8 fonts and custom definable characters. U8x8 uses less memory and CPU resources.

Some popular ESP32 LoRa development boards

The following boards are popular for prototyping because they combine an ESP32, a LoRa tranceiver and LiPo/Li-Ion battery support with charging in one small package. The LoRa32 models also have a an 128x64 OLED display and can be used on a breadboard.

  • Heltec Wifi LoRa 32
  • Heltec Wireless Stick (Lite)
  • Heltec Wireless Shell
  • TTGO LoRa32
  • TTGO T-Beam
  • Pycom Lopy4

These boards come in different versions and there are separate versions for 433/470MHz and 868/915MHz.

LoRa antenna: external, connected via cable with I-PEX connector. TTGO LoRa32 V2.1.x versions use an SMA connector so the antenna can be directly mounted to the board.
Battery connector: 2-pin Molex PicoBlade (1.25mm spacing). Compatible connectors: ‘JST 1.25mm’ sold on AliExpress and eBay (sold as JST-PH 1.25mm but it is not PH because PH uses 2.0mm spacing).
Take care with battery cables (that were not included with the board): check first if the colors of the cable match the polarity of the battery connector on the board (the colors may fool you). Connecting the battery reversed can destroy the board.

Important: Over time new versions of existing boards have been and will be released. This usually includes changes in pin layout, changes in functionality and remapping of GPIOs for different functions.
Often, especially with older boards, it is not be possible to easily determine the product version on the outside because a product/version label is missing on the PCB.
Always check the type and version of your board and compare it with what is currently documented.
Using incorrect settings for your board will not make it work properly and using an incorrect pin layout (because layout changes were introduced in a new version, usually without any warning) could possibly damage your board and/or connected hardware.

Disclaimer: Information in this rticle is composed with best efforts and comes from different sources. Documentation is sometimes unavailable or not always reliable (TTGO) and not all boards were available for testing.
If you have any additional information about these boards then please share below.
If you find any errors then please leave feedback so this can be fixed.

LoRa Development Boards

All below ESP32 LoRa development boards support LoRa, Wi-Fi and Bluetooth and all are breadboard friendly.

Heltec Boards

The ‘LoRa’ boards have a white PCB and the ‘Wireless’ boards have a black PCB. These boards come in different versions:

  • Heltec Wifi LoRa 32 V1:
    Has on-board PCB WiFi/Bluetooth antenna. Appears to be available for 433MHz only.

  • Heltec Wifi LoRa 32 V1.2:
    Has small on-board helical antenna (has a PCB antenna on the bottom but that is not connected). (Note that V1.2 is not an official Heltec version number).

  • Heltec Wifi LoRa 32 V2:
    Similar to V1.2 but has some improvements and DIO pin mappings have changed.
    V2 can be recognized by a “V2” label near the IPEX antenna connector.

  • Heltec Wireless Stick:
    One of the newer Heltec ESP32 boards that is better optimized for low power batteryusage. It has a tiny 0.49" OLED display, an external LoRa antenna connected via U.FL antenna connector and on-board Wifi antenne. Advertised deep sleep current is 800 uA. More information is currently not provided in this topic (see Heltec site for more information).

  • Heltec Wireless Stick Lite:
    One of the newer Heltec ESP32 boards that is better optimized for low power battery usage. It has no display, an external LoRa antenna connected via U.FL antenna connector and on-board Wifi antenne. Advertised deep sleep current is 30 uA. More information is currently not provided in this topic (see Heltec site for more information.

  • Heltec Wireless Shell:
    One of the newer Heltec ESP32 boards that is better optimized for low power battery usage. It has no on-board USB to serial, no display, and no on-board antennas. The external LoRa and Wifi antennas are connected via U.FL antenna connectors. Advertised deep sleep current is 10 uA. More information is currently not provided in this topic (see Heltec site for more information.

TTGO Boards

These boards all have a black PCB and come in different versions:

  • TTGO LoRa:
    Has on-board PCB Wifi/Bluetooth antenna on top. Uses SX1278, 433MHz only. Also available without the display.

  • TTGO LoRa32 V1.0:
    Has on-board metal Wifi/Bluetooth antenna on bottom. Uses SX1276. I-Pex connector located on top. LilyGO now appears to call this board TTGO LoRa V1 (without the 32).

  • TTGO LoRa32 V1.3:
    A while ago (after V2.x was already released) LilyGO introduced a new version: V1.3. Compared to V1.0 it has the following improvements:
    1.Product low power design
    2.Optimize LORA RF circuit
    3.Add battery voltage detection Pin IO35
    I’m not aware if V1.3 has introduced any pin layout changes.

  • TTGO LoRa32 V2.0 (aka LoRa32 V2):
    There is no version label on the PCB.
    Has on-board metal Wifi/Bluetooth antenna on bottom (in a better location than V1).
    Uses ESP32-Pico-D4 (with integrated flash memory) instead of ESP32, uses a (shielded) SX1276 LoRa module, I-Pex connector located on the bottom, micro-USB connector is rotated 90 degrees, in addition has a microSD card slot on the bottom and an on/off switch for the battery next to the micro-USB connector. Switches the battery only so not possible to switch the board off when connected to USB for charging the battery.
    User LED is connected to GPIO25 which is useless because that is already used for the display and all LEDs are on the bottom side. DIO1 and DIO2 have a separate pins and are not wired on the PCB to a GPIO port so must be manually wired. The LoRa modules are HPD13A and HPD14A from HPDTek.
    Pinout diagram: TTGO LoRa32 V2.0 Pinout v3.0.pdf

  • TTGO LoRa32 V2.1.5 (aka T3 V1.5, aka LoRa32 V2.1 release 1.5):
    Is labeled V1.5 on the PCB (apparently without a date).
    Similar to V2.0 with changes and improvements:
    Changes in pins / GPIOs, uses GPIO12 for LoRa RST.
    SMA LoRa antenna connector, different battery charging chip, different switch.

  • TTGO LoRa32 V2.1.6 (aka T3 V1.6, aka LoRa32 V2.1 release 1.6):
    Is labeled T3 V1.6, 20180506 on the PCB.
    Similar to V2.1.5 with changes and improvements:
    Changes in pins / GPIOs. Uses GPIO23 for LoRa RST. Uses GPIO25 for onboard LED. Uses GPIO35 as ADC for battery voltage measurement (uses 100k/100k divider).

  • TTGO T-Beam versions V0.6, V0.7, V1.0 and V1.1 (aka TTGO T22):
    In addition to the above TTGO boards the T-Beam has on-board GPS, 18650 Li-ion cell battery holder and SMA antenna connector. It does not have an on-board display.
    Versions V1.0 and V1.1 use a programmable AX192 power management chip. The AXP needs to be configured in code to enable power and the correct voltages to elements on the board. Without configuring the AXP many things will not work. See the TTGO T-Beam topic topic for more information.

    Until recently the T-Beam boards were standard fitted with a SX127x LoRa tranceiver. However, since 2020 Q4 there also exist T-Beam (V1.1) boards that come fitted with the newer SX1262 LoRa tranceiver. Both configurations are called T-Beam V1.1 so be aware what you buy when ordering a board. There is still very limted SX1262 support for the Arduino framework.

    :warning:Warning:The SX1262 is (currently) NOT supported by MCCI LMIC or Classic LMIC.
    The T-Beam with SX1262 requires a different LoRaWAN library that supports the SX1262 and is not covered in this topic.

Pycom Boards

Pycom boards are designed for use with MicroPython but they can be programmed with C/C++.
For C/C++ development they are not developer friendly because:
(1) There is no on-board USB.support nor a separate serial connector for connecting a USB to Serial adapter. (2) The boards must be put manually in firmware upload mode but even a GPIO0 button is missing which makes things even less practical. Pycom sells an Expansion Board that provides on-board USB to Serial but it lacks both an auto firmware upload mode and a GPIO0 button.

  • Lopy4:
    Has no onboard antennas. Both LoRa and Wifi antennas are external and connected via U.FL antenna connector. It has no display. Has on-board WS2812 RGB LED. In addition to LoRa the Lopy4 also supports Sigfox. More information is currently not provided in this topic (see Pycom site for more information.

Arduino Board Definitions

In the ESP32 Arduino Core at least the following ESP32 LoRa boards are defined:

BoardArduino IDE nameArduino board IDPlatformIO board ID
Heltec Wifi LoRa 32Heltec
WiFi LoRa 32
heltec_wifi_ lora_32
Heltec Wifi LoRa 32 V2Heltec
WiFi LoRa 32(V2)
heltec_wifi_ lora_32_v2
LoRa32-OLED V1
LoRa32-OLED V1
TTGO T-Beam V0.xT-BeamARDUINO_T_Beamttgo-t-beam
TTGO T-Beam V1.xT-BeamARDUINO_T_Beamttgo-t-beam
Pycom LoPyLoPyARDUINO_LoPylopy
PyCom LoPy4LoPy4ARDUINO_LoPy4lopy4

For TTGO LoRa32 V2.0, V2.1.5, V2.1.6 and T-Beam V1.0, V1.1 currently no separate board definitions exist. Use the board definition that best matches your board (in name and version).

GPIO Pin Mappings

Heltec Wifi LoRa 32, TTGO LoRa, TTGO LoRa32 V1.0, TTGO LoRa32 V1.3:

  1. Similar to DIO0, DIO1 and DIO2 are already hardwired on the board.
    For some other versions off TTGO boards DIO1 and DIO2 have to be manually wired.
    I assume this are already hard wired for the newer TTGO LoRa32 V1.3, but like for
    TTGO LoRa32 V1.0 there is no documentation from LilyGO that documents this.
  2. It is assumed that GPIO25 is also used for LED for the newer TTGO LoRa32 V1.3,
    but as is often the case with LilyGO products this is not (clearly) documented.

Heltec Wifi LoRa 32 V2:

TTGO LoRa32 V2.0:

  1. Required. Not wired on PCB, must be manually wired.
  2. Optional (needed for FSK only). Not wired on PCB.
  3. GPIO22 is already used for SCL therefore LED cannot be used without conflicting with I2C and display.

TTGO LoRa32 V2.1.5:

  1. Required. Unknown if this already wired on PCB or must be manually wired.
  2. Optional (needed for FSK only). Unknown if this already wired on PCB.

TTGO LoRa32 V2.1.6:

TTGO T-Beam V0.x, V1.0 and V1.1:

  1. Not sure / not checked if true for T-Beam V1.1

Software Configuration

Configure LMIC pin mappings for the LoRa tranceiver:

Configure the U8g2 library for the OLED display:

Example hardware

Below pictures are provided as examples to give an impression. Below pictures do not include all the latest new versions and new models. Below pictures all have the same size ratio.

ESP32 modules / boards

ESP32 modules and boards

LoRa Tranceiver modules

LoRa transceiver modules 690x126

Heltec boards

Errata: Note that the V2 version labels shown in the captions of below Heltec boards are incorrect and should be read as V1.2 instead.

Heltec did actually not use any official version number up until they came with a new version of the board that has explicitly been labeled V2 (near the IPEX antenna connector).
The official V2 is not shown in the images below but looks similar to V1.2 (except that some chips are arranged differently on the PCB). The official V2 uses different DIO pin mappings.

Heltec boards 1 test 690x368
Heltec boards 2 690x183

TTGO boards

TTGO boards 1 690x236
TTGO boards 1 test 690x384

Useful links


Sours: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436
TTGO ESP32 LoRaWAN OTAA Method Example

In this tutorial we’ll explore the basic principles of LoRa, and how it can be used with the ESP32 for IoT projects using the Arduino IDE. To get you started, we’ll also show you how to create a simple LoRa Sender and LoRa Receiver with the RFM95 transceiver module.

Introducing LoRa

For a quick introduction to LoRa, you can watch the video below, or you can scroll down for a written explanation.

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.

This modulation technique 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 Frequencies

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.

LoRa Applications

LoRa long range and low power features, makes it perfect for battery-operated sensors and low-power applications in:

  • Internet of Things (IoT)
  • Smart home
  • Machine-to-machine communication
  • And much more…

So, LoRa is a good choice for sensor nodes running on a coil cell or solar powered, that transmit small amounts of data.

Keep in mind that LoRa is not suitable for projects that:

  • Require high data-rate transmission;
  • Need very frequent transmissions;
  • Or are in highly populated networks.

LoRa Topologies

You can use LoRa in:

  • Point to point communication
  • Or build a LoRa network (using LoRaWAN for example)

Point to Point Communication

In point to point communication, two LoRa enabled devices talk with each other using RF signals.

For example, this is useful to exchange data between two ESP32 boards equipped with LoRa transceiver chips that are relatively far from each other or in environments without Wi-Fi coverage.

Unlike Wi-Fi or Bluetooth that only support short distance communication, two LoRa devices with a proper antenna can exchange data over a long distance.

You can easily configure your ESP32 with a LoRa chip to transmit and receive data reliably at more than 200 meters distance (you can get better results depending on your enviroment and LoRa settings). There are also other LoRa solutions that easily have a range of more than 30Km.


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.

How can LoRa be useful in your home automation projects?

Let’s take a look at a practical application.

Imagine that you want to measure the moisture in your field. Although, it is not far from your house, it probably doesn’t have Wi-Fi coverage. So, you can build a sensor node with an ESP32 and a moisture sensor, that sends the moisture readings once or twice a day to another ESP32 using LoRa.

The later ESP32 has access to Wi-Fi, and it can run a web server that displays the moisture readings.

This is just an example that illustrates how you can use the LoRa technology in your ESP32 projects.

Note: we teach how to build this project on our “Learn ESP32 with Arduino IDE” course. It is Project 4 on the Table of Contents: LoRa Long Range Sensor Monitoring – Reporting Sensor Readings from Outside: Soil Moisture and Temperature. Check the course page for more details.

ESP32 with LoRa

In this section we’ll show you how to get started with LoRa with your ESP32 using Arduino IDE. As an example, we’ll build a simple LoRa Sender and a LoRa Receiver.

The LoRa Sender will be sending a “hello” message followed by a counter for testing purposes. This message can be easily replaced with useful data like sensor readings or notifications.

To follow this part you need the following components:


Instead of using an ESP32 and a separated LoRa transceiver module, there are ESP32 development boards with a LoRa chip and an OLED built-in, which makes wiring much simpler. If you have one of those boards, you can follow: TTGO LoRa32 SX1276 OLED Board: Getting Started with Arduino IDE.

ESP32 built-in LoRa and OLED

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Preparing the Arduino IDE

There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. Follow one of the next tutorials to prepare your Arduino IDE to work with the ESP32, if you haven’t already.

Installing the LoRa Library

There are several libraries available to easily send and receive LoRa packets with the ESP32. In this example we’ll be using the arduino-LoRa library by sandeep mistry.

Open your Arduino IDE, and go to Sketch > Include Library > Manage Libraries and search for “LoRa“. Select the LoRa library highlighted in the figure below, and install it.

Getting LoRa Tranceiver Modules

To send and receive LoRa messages with the ESP32 we’ll be using the RFM95 transceiver module. All LoRa modules are transceivers, which means they can send and receive information. You’ll need 2 of them.

You can also use other compatible modules like Semtech SX1276/77/78/79 based boards including: RFM96W, RFM98W, etc…

Alternatively, there are ESP32 boards with LoRa and OLED display built-in like the ESP32 Heltec Wifi Module, or the TTGO LoRa32 board.

Before getting your LoRa transceiver module, make sure you check the correct frequency for your location. You can visit the following web page to learn more about RF signals and regulations according to each country. For example, in Portugal we can use a frequency between 863 and 870 MHz or we can use 433MHz. For this project, we’ll be using an RFM95 that operates at 868 MHz.

Preparing the RFM95 Transceiver Module

If you have an ESP32 development board with LoRa built-in, you can skip this step.

The RFM95 transceiver isn’t breadboard friendly. A common row of 2.54mm header pins won’t fit on the transceiver pins. The spaces between the connections are shorter than usual.

There are a few options that you can use to access the transceiver pins.

  • You may solder some wires directly to the transceiver;
  • Break header pins and solder each one separately;
  • Or you can buy a breakout board that makes the pins breadboard friendly.

We’ve soldered a header to the module as shown in the figure below.

This way you can access the module’s pins with regular jumper wires, or even put some header pins to connect them directly to a stripboard or breadboard.


The RFM95 transceiver chip requires an external antenna connected to the ANA pin.

You can connect a “real” antenna, or you can make one yourself by using a conductive wire as shown in the figure below. Some breakout boards come with a special connector to add a proper antenna.

The wire length depends on the frequency:

  • 868 MHz: 86,3 mm (3.4 inch)
  • 915 MHz: 81,9 mm (3.22 inch)
  • 433 MHz: 173,1 mm (6.8 inch)

For our module we need to use a 86,3 mm wire soldered directly to the transceiver’s ANA pin. Note that using a proper antenna will extend the communication range.

Important: you MUST attach an antenna to the module.

Wiring the RFM95 LoRa Transceiver Module

The RFM95 LoRa transceiver module communicates with the ESP32 using SPI communication protocol. So, we’ll use the ESP32 default SPI pins. Wire both ESP32 boards to the corresponding transceiver modules as shown in the next schematic diagram:

Here’s the connections between the RFM95 LoRa transceiver module and the ESP32:

  • ANA: Antenna
  • GND: GND
  • DIO3: don’t connect
  • DIO4: don’t connect
  • 3.3V: 3.3V
  • DIO0: GPIO 2
  • DIO1: don’t connect
  • DIO2: don’t connect
  • GND: don’t connect
  • DIO5: don’t connect
  • RESET: GPIO 14
  • NSS: GPIO 5
  • SCK: GPIO 18
  • MOSI: GPIO 23
  • MISO: GPIO 19
  • GND: don’t connect

Note: the RFM95 transceiver module has 3 GND pins. It doesn’t matter which one you use, but you need to connect at least one.

For practical reasons we’ve made this circuit on a stripboard. It’s easier to handle, and the wires don’t disconnect. You may use a breadboard if you prefer.

The LoRa Sender Sketch

Open your Arduino IDE and copy the following code. This sketch is based on an example from the LoRa library. It transmits messages every 10 seconds using LoRa. It sends a “hello” followed by a number that is incremented in every message.

View raw code

Let’s take a quick look at the code.

It starts by including the needed libraries.

Then, define the pins used by your LoRa module. If you’ve followed the previous schematic, you can use the pin definition used in the code. If you’re using an ESP32 board with LoRa built-in, check the pins used by the LoRa module in your board and make the right pin assignment.

You initialize the counter variable that starts at 0;

In the setup(), you initialize a serial communication.

Set the pins for the LoRa module.

And initialize the transceiver module with a specified frequency.

You might need to change the frequency to match the frequency used in your location. Choose one of the following options:

LoRa transceiver modules listen to packets within its range. It doesn’t matter where the packets come from. To ensure you only receive packets from your sender, you can set a sync word (ranges from 0 to 0xFF).

Both the receiver and the sender need to use the same sync word. This way, the receiver ignores any LoRa packets that don’t contain that sync word.

Next, in the loop() you send the LoRa packets. You initialize a packet with the beginPacket() method.

You write data into the packet using the print() method. As you can see in the following two lines, we’re sending a hello message followed by the counter.

Then, close the packet with the endPacket() method.

After this, the counter message is incremented by one in every loop, which happens every 10 seconds.

Testing the Sender Sketch

Upload the code to your ESP32 board. Make sure you have the right board and COM port selected.

After that, open the Serial Monitor, and press the ESP32 enable button. You should see a success message as shown in the figure below. The counter should be incremented every 10 seconds.

The LoRa Receiver Sketch

Now, grab another ESP32 and upload the following sketch (the LoRa receiver sketch). This sketch listens for LoRa packets with the sync word you’ve defined and prints the content of the packets on the Serial Monitor, as well as the RSSI. The RSSI measures the relative received signal strength.

View raw code

This sketch is very similar to the previous one. Only the loop() is different.

You might need to change the frequency and the sycnword to match the one used in the sender sketch.

In the loop() the code checks if a new packet has been received using the parsePacket() method.

If there’s a new packet, we’ll read its content while it is available.

To read the incoming data you use the readString() method.

The incoming data is saved on the LoRaData variable and printed in the Serial Monitor.

Finally, the next two lines of code print the RSSI of the received packet in dB.

Testing the LoRa Receiver Sketch

Upload this code to your ESP32. At this point you should have two ESP32 boards with different sketches: the sender and the receiver.

Open the Serial Monitor for the LoRa Receiver, and press the LoRa Sender enable button. You should start getting the LoRa packets on the receiver.

Congratulations! You’ve built a LoRa Sender and a LoRa Receiver using the ESP32.

Taking It Further

Now, you should test the communication range between the Sender and the Receiver on your area. The communication range greatly varies depending on your environment (if you live in a rural or urban area with a lot of tall buildings). To test the communication range you can add an OLED display to the LoRa receiver and go for a walk to see how far you can get a communication (this is a subject for a future tutorial).

In this example we’re just sending an hello message, but the idea is to replace that text with useful information.

Wrapping Up

In summary, in this tutorial we’ve shown you the basics of LoRa technology:

  • LoRa is a radio modulation technique;
  • LoRa allows long-distance communication of small amounts of data and requires low power;
  • You can use LoRa in point to point communication or in a network;
  • LoRa can be especially useful if you want to monitor sensors that are not covered by your Wi-Fi network and that are several meters apart.

We’ve also shown you how to build a simple LoRa sender and LoRa receiver. These are just simple examples to get you started with LoRa. We’ll be adding more projects about this subject soon, so stay tuned!

You may also like reading:

This is an excerpt from our course: Learn ESP32 with Arduino IDE. If you like ESP32 and you want to learn more, we recommend enrolling in Learn ESP32 with Arduino IDE course.

Thanks for reading.

Sours: https://randomnerdtutorials.com/esp32-lora-rfm95-transceiver-arduino-ide/

Esp32 lorawan

How to build an outdoor Single Channel LoRaWAN Gateway based on Heltec ESP32 LoRa dev board

12 Oct , 2020 IoT

How to build an outdoor Single Channel LoRaWAN Gateway based on Heltec ESP32 LoRa dev board

Two years ago I began my adventure in the Wireless Sensors Network (WSN) world and, among the main existing wireless protocols, one of the most widely used is, of course, LoRaWAN. In this tutorial I going to show you how to build an outdoor Single Channel LoRaWAN Gateway based on one of the cheapest ESP32 development board available on internet: the Heltec ESP32 LoRa V2 dev board.

A Single Channel LoRaWAN Gateway based on an ESP32 dev board is a very affordable starting point to begin LoRaWAN prototyping without the need to buy a full LoRaWAN Gateway, which has eight working channels and a more complex transceiver, thus an higher cost (but you’ll need it once you’ll work with multiple LoRaWAN end nodes, given the Single Channel solution limitations).

First, I’m going to explain a bit, what is LoRaWAN (HERE a detailed explanation) and what is the difference with LoRa. Then, I’m going to explain step by step what you need to create a Single Channel LoRaWAN Gateway to place outdoor, maybe on a roof like mine, because if you will use LoRaWAN, you’ll use it for Long Range Communication between one or more end nodes and the gateway, so, the higher you place it, the wider the radius of coverage will be. Finally, I’ll show you some range tests and explain which are the limitations of such system.

A Single Channel LoRaWAN Gateway based on Heltec ESP32 LoRa dev board

What is LoRaWAN?

I already answered in a detailed way to this question in a dedicated article (you can find it HERE). However, here you are a short description: LoRaWAN is a Long Range communication protocol often used to create Low Power Wide Area Networks (LPWANs) with an operating range that goes from 300 meters up to 10 kilometres. It is based on LoRa modulation while the Medium Access Control (MAC) layer is an open network architecture regulated by the LoRa Alliance. LoRaWAN end nodes can also be classified into three categories: Class A, B, and C. All LoRaWAN devices must implement Class A, whereas Class B and C are extensions of Class A devices. These classes, defines the behaviour about downlink packets from gateways to end nodes. Usually LoRaWAN gateways acts as Class C devices, since they are constantly listening for incoming transmission.

In order to transmit and receive data over LoRaWAN network, LoRaWAN end nodes must be registered and enabled on the Application Server provider, which manages the open network gateways. That’s why, in the last part of this tutorial, we will register our gateway on the things Network.

Single Channel LoRaWAN Gateway Requirements

We need many components plus the ESP32 with Semtech SX1276 LoRa modem development board. In my case, I decided to use the Heltec ESP32 LoRa V2 board based on the ESP32 microcontroller. There are two version of it: the first one has a SX1276 LoRa modem and is suitable for 868/915 MHz EU/US LoRaWAN carriers, while the second one is based on the Semtech SX1278 modem and is suitable for 433 MHZ CN bandwidth. So be sure to buy the right one based on your development board connector. Finally, You’ll need a pole where to fix the IP65 waterproof box, a power supply able to deliver up to 1A at 5 Volt through a typical USB connector, and a USB-to-microUSB cable (at least five meters) to deliver power to the board placed on the roof while keeping the power supply in a dry and secure environment. You will also need many screws to fix the IP65 box to the pole. I also used some Lego bricks to fix the board inside the box … but you can use different solutions.

Summarising, you need:

  • one ESP32 development board with a built-in LoRa modem and antenna connector;
  • one external antenna with the right connector and length for your frequency and dev board;
  • an IP65 box;
  • a pole;
  • a 5 Volt 1A USB power supply;
  • a USB-to-microUSB cable, with a length of at least 5 meters, depending also on your installation;
  • something to fix the board inside the box;
  • many screws and rods to fix the box to the pole.

Total cost should be around 30-35$.

The ESP32 SoC

ESP32 is a cheap and low power SoC which integrates an IEEE 802.11 a/b/g/n and both Bluetooth Classic and BLE IEEE 802.15.1 radio equipments. It is widely used for many industrial applications and also IoT products, since the whole SoC with a 2.4 GHz Printed Circuit Board (PCB) antenna has a package size of seven for seven millimetres and a low price. Also, many IoT manufacturers have released different kind of development boards based on ESP32 SoC, allowing developers to chose the right solution based on their needs. In fact, different boards could have various PCB layouts with pre-installed sensors, relays, RGB LED, display, external antennas connectors, LoRa modem (such as the Heltec ESP32 Lora V2, used in this project), GPS receivers, batteries and even cameras for almost any application. Its high integration also, ensures that it is reliable and resistant to extreme operating temperatures (between -40°C and +85°C), making it suitable for applications in harsh environments. ESP32 SoC is made by the Chinese company Espressif Systems, and it is the successor of the Wi-Fi-only ESP8266 SoC, which i have used in another project. It integrates a Tensilica Xtensa LX6 dual-core 32-bit CPU whit a clock that can achieve up to 240 MHz. There is also an Ultra Low Power (ULP) co-processor and a Real Time Clock (RTC) to enable deep-sleep functionalities, useful for battery powered devices with long stand-by times. Then there are 520 KB of SRAM, followed by 448 KB of ROM for booting and core functions, and up to 16 MB of embedded ash memory, which is plenty for almost any end node implementation. The SoC also integrates all the radio components needed for the functioning, since clock generator, receiver, transmitter, balun and antenna, are all inside the same package, making it a ready to use solution. Full Wi-Fi and Bluetooth protocol stack are also supported, making it easer to develop application based on these interfaces. The whole chip is manufactured by TSMC foundries using a 40 nanometres process, which ensures a good trade-off between costs and integration, thus low power consumption. All the SoC integrated components are shown in the following figure.


Hardware setup: connecting the Heltec ESP32 to the antenna

In this project there isn’t much to do on the hardware side. We just have to connect the development board – in this case the Heltec ESp32 LoRa V2 – to the antenna using the bundled SMA connector. I decided to replace the bundled antenna with a “bigger one”, in order to achieve an higher gain (5 dBi). Also, the antenna adopted can be tilted, so that I can place it in a vertical position without waterproofing issues. Once this operation has been done, we can go go to the software flashing. It’s strongly suggested to use the Heltec ESP32 LoRa with the antenna connected, otherwise you can burn the built-in modem. This applies also for any other external antenna device, so be careful!

LoRaWAN Heltec ESP32 Gateway

Software setup: compile and flash the LoRaWAN Single Channel Gateway implementation of the Heltec ESP32

At this point, we have to work on the software part. I use the Arduino IDE to program my ESP32 and 8266 boards. However, you can use any other IDE you want. If you decide to use Arduino IDE, be sure to import the right libraries and COM ports driver. You can check this tutorial.

Now we have to simply compile and flash the firmware to our LoRaWAN ESP32 development board. Initially, we have to download the LoRaWAN Single Channel Gateway implementation for ESP32 and Semtech-based dev boards, like the one used in this tutorial. As already stated, I’m not the developer of the LoRaWAN implementation, so I’ll link the original author (Maarten Westenberg) of the code, where you will also find the updated version of the code: GitHub repository.

Clone or download the whole repository, decompress it and go to the “src” folder, where you will find the source code of the LoRaWAN Single Channel Gateway implementation for any ESP32 board with a Semtech Lora modem.

There are many files in this folder. Among them, we have to modify at least the “configNode.h” file, where we have to place our Wi-Fi network SSID and password. You can place more than one Wi-Fi SSID, so that if it can’t be found, the LoRaWAN Gateway will fall back on the second or third Wi-Fi network in the list. If you are using a different ESP32 development board, you also have to change your hardware configuration inside the “configGway.h” file, where you have to specify your pin configuration and the OLED display installed on your development board. You can also act on other parameters such as Spreading Factor, Channels, Carrier frequency based on your country (EU is 868 MHz, USA is 915 MHz, pay attention to this parameter!) and so on, but in my case, I only had to set the OLED display to 1, which is suitable for the Heltec ESp32 LoRa V2 board.

LoraWAN Heltec ESP32 Gateway
LoraWAN Heltec ESP32 Gateway


Safe the configurations and then open with your Arduino IDE the “ESP-sc-gway.ino” file. A pletora of additional files will be opened inside the IDE, but you don’t have to touch them. Now, if you have already installed all the ESP32 libraries, you can now import the additional libraries which have been downloaded together with the source code from the repository. You just have to import them using the “Sketch menu option” inside Arduino IDE. Select all the libraries inside the downloaded “lib” folder and import them. Now you should be able to compile the firmware without any dependency error.

To do this, you have to select your ESP32 LoRa development board inside “Tools” menu inside Arduino IDE. Then, connect it to your computer using the right cable and select from “Tools” menu the right port. At this point, you can press the compile and flash button. If all goes well, your ESP32 board will restart after a couple of minutes as a LoRaWAN Single Channel Gateway. You can monitor it both using the serial monitor function or directly from your browser (of course, both the PC and the GW should be connected to the same network) by typing the device IP in your browser URL bar. The IP is printed on the serial monitor console each time the Gateway reboots, or you can look for it using many network tools or by checking your DHCP server.

I also have to say that I made some changes in the original code, because I implemented a different kind of OTA update and an additional DHT11 sensor, in order to measure the temperature over the roof of my house. Finally, I overcome the maximum payload limit of the received messages, which is, by default, set to 64 bytes, replacing the HEX value to the 184 bytes equivalent, since over this value the system seems to truncate the messages.

Software setup: LoRaWAN Single Channel Gateway web interface & settings

The LoRaWAN Single Channel Gateway comes with a rich and useful web server which can be accessed through the IP address of the device over the same LAN. The web server interface provides many useful information for debugging and statistics. For example, it is possible to see the last received message’s SF, device’s classes, RSSI, node identifier and other statistics, as visible below, which represents a portion of the default web server page.

LoRaWAN Heltec ESP32 Gateway

In the same web page all the LoRaWAN Gateway parameters can be seen, such as the IP address of the device, the LoRaWAN router IP and URL, the connected Wi-Fi SSID and the GW ID, which is needed for the registration on The Things Network, as we’ll see later. There are also many information useful for system debugging, such as the number of Wi-Fi connection attempts and the available free memory. It is even possible to enable a logging system which can then be download through the web interface. The Web interface not only provides statistical tools, but also many controls, since there are buttons to enable/disable some features and to change GW settings. For example, it is possible to enable or disable Channel Activity Detection (CAD), needed for enabling the reception of messages with different Spreading Factor over the same channel.

LoRaWAN Heltec ESP32 Gateway

Then, it is possible to manually change the channel form the default one or to setup an automatically frequency hopping to change the LoRaWAN channel among those available. Thus, it is possible to reset board statistics, change the debug level and I decided to add a button to reboot the Gateway remotely. All these remote control solution are mandatory in a context where the GW is not easily accessible, such as in my final installation, where the LoRaWAN ESP32 GW is placed over the roof of my house.

Software setup: the Things Network Gateway registration

If you want to use the developed system, you have one last easy step to do: register on The Things Network (TTN) and connect the Heltec ESP32 GW to it. In order to do this, simply go HERE.

TTN is a free to use network infrastructure with the goal to provide free LoRaWAN network coverage around the world. Thanks to its community, The Things Network is the biggest and most used LoRaWAN network, since there are more than 10’000 LoRaWAN Gateways around the world and about 108’000 community members. TTN provides a set of software tools which allows users to create their own LoRaWAN application or to simply setup a GW. Therefore, any LoRaWAN nodes (both GWs and end nodes) must be registered on TTN platform in order to operate correctly.

LoRaWAN Gateway

The developed LoRaWAN Heltec ESP32 GW can be easily registered on the network thought the console section, where the user simply has to add a new LoRaWAN Gateway by clicking on the “register device” label.

LoRaWAN Gateway

Then, you have to chose a name and the right parameters. You will also need one parameter, which is the Gateway ID and it is uniquely related to the LoRa modem onboard, so that each node has a unique ID. You can find it inside the LoRaWAN Web server interface under the voice “Gateway ID“, and it’s a 16 characters string. Put it into the right TTN field and complete the registration process, then your GW is ready to provide LoRaWAN connectivity to yours applications.

The final installation

If you arrived here, you can already use your LoRaWAN Single Channel Heltec ESP32 Gateway but … in order to reach better performances, there is one more thing to do: place it as high as you can. I know, it’s not a simple process but, thrust me, it is well worth, since it’s the only way to reach a coverage of more then 3-4 kilometres.

To do this, I placed the board inside an IP65 box, while the antenna has been placed and isolated on the side, in order to keep the system as waterproof as possible. Here below you can see some pictures of the system and some details of the IP65 adaptation.

LoRaWAN gateway

In order to fix the board inside the box, I used some Lego bricks, and I finally placed the power cable on the bottom side, where it has been fixed. In the picture you can also see the DHT11 sensor located in a bottom hollow.


Finally, I placed it over the roof of my house, fixing it to the TV antenna pole, at about 14 meters height from the ground.

LoRaWAN Heltec ESP32 Gateway

The system is up and it’s running since late February 2020 (yes, it survived a pandemic). It has seen snow, ice, frozen winds, heavy rains, hail (what a hail!) and many thunderstorms, but it’s up and it’s running flawlessly.

Closing thoughts: achieved operating ranges!

In this section I’ll briefly show you what kind of coverage I can reach with this system. I live in a very small town, with less than 700 inhabitants, so there are a few houses, mostly 2 or 3-floors houses, so there is any tall building between my LoRaWAN Single Channel gateway and the two final LoRaWAN end nodes I installed in the country side.

Using the lowest LoRa Spreading factor – SF7 -, I can easily cover one node (A in the picture) placed at 1.25 Km from the GW, across the “city”, and a second one (B in the picture) placed in the countryside behind my house ad 1.92 Km.


The first node is in Non Line-of-Sight (NLOS) setup, given the sub-urban environment with many buildings and trees between the two devices. The partial urban environment with its buildings limit the operating range of LoRaWAN communication, since the observed Received Signal Strength Indicator (RSSI) is near at the minimum acceptable level for SF7, with a mean value around -118 dBm. Therefore, only 83% of the messages are successfully received by the GW, but, for this kind of application (a weather station) it’s enough.

The second node is in an almost obstacles free environment, with a direct Line-of-Sight (LOS) between the two devices. the result is a “good” RSSI of about -115 dBm, which should allow a greater distance on such environment. That’s enough to reach a 98%+ correct packets reception, achieving a reliable Long Range communication.


As stated in the introduction, this system is cheap, works well and can be used for two, three and even more LoRaWAN end nodes but … there are many limits. First of all, all the end nodes must use the same channel, so if you’re gonna send a lot of messages, you gonna have some collisions problems and lose them. Second, it’s not a fully compliant full LoRaWAN Gateway, because it has only one operating channel and because the uplink operations have some issues, since too many uplink messages makes my gateway reboot. Also, a gateway like this won’t really help the LoraWAN community, since it has only one channel, so please, consider a powerful and complete one once your prototyping is complete and you’re going to deploy your applications. Finally, there is another “serious” issue which explain why I decided to fix the system with a Spreading Factor equal to seven (SF7) to both the end nodes and the gateway itself. If you enable Channel Activity Detection (CAD), you will be able to receive messages with different SF on the same channel, but your sensitivity on chirps with higher spreading factor will decrease a lot, so the system performance for Long Range applications will be awful. That’s one of the reason I decide to keep the system fixed to SF7. However, you can fix the LoRaWAN gateway to SF9 of higher for longer distance applications, and you will easily reach 3-4 km (I can easily get 5 Km with SF12) and more. So, once my prototypes will be complete, I think I’ll switch to a complete LoRaWAN Gateway, because these limitations are getting harder to accept.

That’s all!


Sours: https://emanuelepagliari.it/2020/10/12/how-to-build-lorawan-gateway-heltec-esp32-lora/
TTGO- LoRa Esp32 - Range Test (6.5km)

ESP32 LoRaWAN node with Arduino

Things used in this project


To test out the recent addition in my lab that is the LoRa gateway, I needed one LoRa node also. LoRa modules are available to be used with Arduino as well as Raspberry Pi and are pretty cheap too. However, you can get complete LoRa module with ESP32 and OLED display at pretty low price from Banggood, and they fit the purpose. And by using these, you don't need to jumble around jumpers. In this post, I have covered how to make a simple, cheap LoRa node that can send data to The Things Network(TTN). Before getting into set up regarding LoRa first thing that has to be done is add support for ESP32 module to your Arduino IDE. I have covered that in an earlier post and you can check that out here.  Now after that lets dive into setting up Arduino IDE for LoRa communication.

About the Module: The module I have used for testing is the ESP32 LoRa module by Heltec, and you can buy it from here. The module that I have got is meant for 868MHz and choose the module depending upon the frequency plan supported in your country for LoRa. This module comes with  SX1276 (Datasheet: http://bit.ly/2R4FamJ) LoRa chip, ESP32 chip,   0.96-inch blue OLED display, and CP2102 USB to UART converter. The ESP32 module comes with 32Mb of flash memory. The pin diagram of the module is as follows; please keep in mind the pins those are connected to the onboard peripherals like the OLED display and the Lora module. Any external peripherals need to be connected accordingly. The used pins are marked with a red arrow in the pin diagram.  You can check about the module in detail here in the official site of the module. To connect the module to the PC, the required drivers for CP2102 need to be installed and can be downloaded from here.

InstallingSupport for the Display: Now as you have a basic idea about the module, lets first install the library required for the on-board OLED module. The library that I have used is  u8g2 by Oliver. This can be installed merely by getting into the manage libraries section of the IDE and searching for u8g2.

Installing Lora Support: Adding support for LoRaWAN in Arduino is pretty simple. LoRa is a physical layer communication protocol, which means it only takes care of physical layer communication it doesn't do any job regarding network management and handshaking. To implement a network of such modules however needs require complex networking protocols. There where the LoRaWAN protocol comes into the picture and the complete MAC layer has to be written w.r.t to the microcontroller. The library I have used for the MAC layer of LoRaWAN for Arduino/ESP32 is arduino-lmic by Matthijs Kooijman. If you want to know in-depth about LoRaWAN, you can check out this article. You can simply download the repository and add to Arduino IDE, and you are good to go. The code I have provided send data to TTN on the press of a button connected to GPIO 13 (Arduino naming ) and flash a LED 2 times connected to GPIO 12. The text Data Sent is displayed on the OLED. If the TTN server sends back any scheduled data, the LED flashes for three times and data is printed to the serial console. Please check the video for details. The important thing however in the code is to select the pins properly depending upon the ESP32 LoRa module you are using, and all the available have different pin configurations. So make sure to change accordingly. In my case it is,

Please check the pin diagram of respective modules. The next important thing in the sketch is to set the network keys which are obtained from TTN while registering the new node (can be obtained after the addition also, so no need to copy if not required). The keys are different and depend on the mode of activations used which are either ABP (Activation By Personalization) or OTAA (Over The Air Activation). In this sketch, I have used ABP method, and the required keys are Network Session Key, Application Session Key, and Device address. To obtain the keys first, you need to register an application in TTN and to do so navigate to TTN console applications page but before that make sure you have an account. After that the node can be added to the application and keys can be obtained. Please check the video for details.  To read about ABP and OTAA activation methods and security measures in LoRaWAN, you can check this article. One final thing is even if you do not have a LoRa gateway, make sure you have one around may be other users or any operator, and moreover, that is configured for TTN and your used frequency band. Otherwise, this will not work. Even if there is one gateway around it will work.

For code you can check:  http://bit.ly/2TisJjy

Read more



Sours: https://www.hackster.io/weargenius/esp32-lorawan-node-with-arduino-c120c4

You will also be interested:

Introduction: ESP32 Long Distance - LoRaWan

In this article, we are going to discuss LoRaWAN, a network that travels with little energy. But for just how far? With the chip I use in the video, the ESP32, the control distance reaches 3.6 kilometers. So today, we talk about the characteristics of the chip and the LoRa network, which was practically made for IoT (Internet of Things).

In the assembly, in the example of Heltec, with the ESP32 plus the SX1276 chip, we have Sender sending the data packet to the Receiver. In the green head device, the Receiver, we have the signal that is at -9dB. This is because the antennas are practically glued and extremely close, but as you move them away from each other, you can see that the signal strength decreases, reaching -124dB when you stop to receive the information. In the same display, Rx9 bytes indicate the packet size and Hello is the string that the yellow cable device, Sender, is sending. In Sender, we also have a LED flashing at 500 milliseconds.

Step 1: ESP32 LoRaWan

Concerning my ESP32 cards, I bought them with the LoRa chips already built-in. These development kits already come with display, which I consider advantageous. So we dismantled the kit. Under the device, we can see the information on the SX1276 chip.

It is important to remember that the ESP32 has three chips: Flash memory, Espressif, which is the processor of Tensilica, and also there is a USB to Serial Ttl, of Silicon Labs. In the case of this development kit, we also have a fourth chip, which is the SX1276.

Step 2: How the LoRa Network Is Used

To understand the use of the network, we have the LoRa chips communicating with each other, measuring geographic position, temperature, pressure, humidity, and all the information that is analyzed through the IoT in the LoRa network. We then have a hub, the Gateway, which receives all these signals. This is going to enter the TCP / IP network LoRaWAN SSL and then follow to a server side, a more robust thing, IBM Watson, Amazon, in short, the data is processed at another level.

Step 3: Key Features of LoRa Technology and LoRaWAN Protocol

Here, I show some characteristics of the LoRa technology and the LoRaWAN protocol.

I emphasize that the idea of this network LoRa is not for you to send multimedia content, but to send packages of data of reading.

LoRaWAN Protocol

LoRaWAN is a protocol specification built upon the LoRa technology developed by the LoRa Alliance. It uses unlicensed radio spectrum in the Industrial, Scientific, and Medical (ISM) bands to enable low power and wide area communication between remote sensors and gateways connected to the network. This standards-based approach to building an LPWAN enables the rapid deployment of public or private IoT networks anywhere using hardware and software that is bi-directional, secure, interoperable, and mobile, which provides a precise location and works the way you would expect it to.

Step 4: CHIP Sx1276

Then, by disassembling the development kit, we unscrew the display and locate the LoRa chip, created by the French company Semtech. Here, I have a table taken from the Datasheet with information of this device on the 1276, 1277, 1278, and 1279 models. The difference is more in frequency.

Step 5: ESP32 LoRa X ESP32 WiFi

Comparing the traditional ESP32 with ESP32 LoRa, we again point out that the traditional has three chips, while LoRa has four. This fourth chip, in this case, is the sx1276.

It is connected via the SPI port. As for OLED Flat, it is connected to i2c.

Step 6: ESP32 LoRa Pinout

It is important to note the pins that are already occupied.

Step 7: Test

ESP32 LoRaWAN TTGO To perform the test, we took the chips from TTGO, put on an antenna and battery, and walked out. Right away, we found it running at 915 MHz. We tested the 433 MHz as well.

We set up a packet to send Sender to the Receiver. The second will receive this packet and measure the signal strength in dB, which will show on the display. In this way, it will be possible for you to perform a test. I also intend to do this using my drone, which travels up to 7 kilometers, to see how far I can get.

Step 8: ESP32 LoRaWAN - Heltec

This is Heltec's model, which is at 433 MHz and works very well. If you are looking to buy an ESP32, I recommend this brand because it has a Lib inside the Arduino IDE, which makes handling easier.

Step 9: Lib and Heltec Examples

Heltec examples are in GitHub.


Below is the path to locate the source code of your computer after installation.

C: \ Program Files (x86) \ Arduino \ hardware \ heltec \ esp32 \ libraries \ LoRa \ examples \ OLED_LoRa_Sender

Step 10: Manual PDF

I translated the manual from Portuguese and will deliver it to you in a PDF file.

Register to my email list:

Subscribe to the link: pdf.fernandok.com

You will receive a message confirming your application. Check your inbox, as well as your spam box, among others.

With the confirmed registration, I will send you a second email with the download link from the manual: "How to install Arduino IDE ESP32 LoRa - Heltec on Windows".

Step 11: Source Code

Today, we have two .INO programs, the Sender and the Receiver.

Sender and Receiver

First, I declare the SPI pins and set the radio frequency, that is, I make all the necessary statements.

#include <spi.h> //responsável pela comunicação serial
#include <lora.h> //responsável pela comunicação com o WIFI Lora #include <wire.h> //responsável pela comunicação i2c #include "SSD1306.h" //responsável pela comunicação com o display #include "images.h" //contém o logo para usarmos ao iniciar o display // Definição dos pinos #define SCK 5 // GPIO5 -- SX127x's SCK #define MISO 19 // GPIO19 -- SX127x's MISO #define MOSI 27 // GPIO27 -- SX127x's MOSI #define SS 18 // GPIO18 -- SX127x's CS #define RST 14 // GPIO14 -- SX127x's RESET #define DI00 26 // GPIO26 -- SX127x's IRQ (Interrupt Request) #define BAND 915E6 //Frequencia do radio - podemos utilizar ainda : 433E6, 868E6, 915E6 #define PABOOST true

Sender: OLED_LoRa_Sender.ino

Here, I have the display that is connected to the i2c pins and the strings.

//variável responsável por armazenar o valor do contador (enviaremos esse valor para o outro Lora)
unsigned int counter = 0; //parametros: address,SDA,SCL SSD1306 display(0x3c, 4, 15); //construtor do objeto que controlaremos o display String rssi = "RSSI --"; String packSize = "--"; String packet ;

Setup: OLED_LoRa_Sender.ino

Here, we configure the pins as output, as well as the actions of the display. We initiate LoRa communication and configure the pins that will be used by the library.

Highlight: Every time you connect the ESP32 to the LoRa network, it checks if the antenna is plugged into the Pigtail connector, because if you connect to the USB without it being connected to the antenna, you can burn the transmitter chip.

void setup()
{ //configura os pinos como saida pinMode(16,OUTPUT); //RST do oled pinMode(25,OUTPUT); digitalWrite(16, LOW); // reseta o OLED delay(50); digitalWrite(16, HIGH); // enquanto o OLED estiver ligado, GPIO16 deve estar HIGH display.init(); //inicializa o display display.flipScreenVertically(); display.setFont(ArialMT_Plain_10); //configura a fonte para um tamanho maior //imprime o logo na tela logo(); delay(1500); display.clear(); //apaga todo o conteúdo da tela do display SPI.begin(SCK,MISO,MOSI,SS); //inicia a comunicação serial com o Lora LoRa.setPins(SS,RST,DI00); //configura os pinos que serão utlizados pela biblioteca (deve ser chamado antes do LoRa.begin) //inicializa o Lora com a frequencia específica. if (!LoRa.begin(BAND,PABOOST)) { display.drawString(0, 0, "Starting LoRa failed!"); display.display(); //mostra o conteúdo na tela while (1); } //indica no display que inicilizou corretamente. display.drawString(0, 0, "LoRa Initial success!"); display.display(); //mostra o conteúdo na tela delay(1000); }

Loop: OLED_LoRa_Sender.ino

Here's how to assemble a package and turn on the LED.

void loop()
{ //apaga o conteúdo do display display.clear(); display.setTextAlignment(TEXT_ALIGN_LEFT); display.setFont(ArialMT_Plain_16); display.drawString(0, 0, "Sending packet: "); display.drawString(40, 26, String(counter)); display.display(); //mostra o conteúdo na tela //beginPacket : abre um pacote para adicionarmos os dados para envio LoRa.beginPacket(); //print: adiciona os dados no pacote LoRa.print("hello "); LoRa.print(counter); //endPacket : fecha o pacote e envia LoRa.endPacket(); //retorno= 1:sucesso | 0: falha //beginPacket : abre um pacote para adicionarmos os dados para envio LoRa.beginPacket(); //print: adiciona os dados no pacote LoRa.print("hello "); LoRa.print(counter); //endPacket : fecha o pacote e envia LoRa.endPacket(); //retorno= 1:sucesso | 0: falha //incrementa uma unidade no contador counter++; digitalWrite(25, HIGH); // liga o LED indicativo delay(500); // aguarda 500ms digitalWrite(25, LOW); // desliga o LED indicativo delay(500); // aguarda 500ms }

Print - Logo: OLED_LoRa_Sender.ino

This function only prints the logo on the display.

//essa função apenas imprime o logo na tela do display
void logo() { //apaga o conteúdo do display display.clear(); //imprime o logo presente na biblioteca "images.h" display.drawXbm(0,5,logo_width,logo_height,logo_bits); display.display(); }

Setup: OLED_LoRa.Reciver.ino

We start LoRa here with the specific frequency, we point the correct initialization in the display, and we enable LoRa to receive the data sent by Sender. We also check the receipt of the package.

//inicializa o Lora com a frequencia específica.
if (!LoRa.begin(BAND,PABOOST)) { display.drawString(0, 0, "Starting LoRa failed!"); display.display(); while (1); } //indica no display que inicilizou corretamente. display.drawString(0, 0, "LoRa Initial success!"); display.drawString(0, 10, "Wait for incomm data..."); display.display(); delay(1000); //LoRa.onReceive(cbk); LoRa.receive(); //habilita o Lora para receber dados } void loop() { //parsePacket: checa se um pacote foi recebido //retorno: tamanho do pacote em bytes. Se retornar 0 (ZERO) nenhum pacote foi recebido int packetSize = LoRa.parsePacket(); //caso tenha recebido pacote chama a função para configurar os dados que serão mostrados em tela if (packetSize) { cbk(packetSize); //função responsável por recuperar o conteúdo do pacote recebido delay(10); } }

Print on OLED: OLED_LoRa.Reciver.ino

Here, we configure the information that will appear on the display.

//função responsável por configurar os dados que serão exibidos em tela.
//RSSI : primeira linha //RX packSize : segunda linha //packet : terceira linha void loraData(){ display.clear(); display.setTextAlignment(TEXT_ALIGN_LEFT); display.setFont(ArialMT_Plain_16); display.drawString(0 , 18 , "Rx "+ packSize + " bytes"); display.drawStringMaxWidth(0 , 39 , 128, packet); display.drawString(0, 0, rssi); display.display(); }

Step 12:

Be the First to Share

Did you make this project? Share it with us!


  • Space Contest

    Space Contest
  • Pumpkins & Gourds Speed Challenge

    Pumpkins & Gourds Speed Challenge
  • Retro Tech Challenge

    Retro Tech Challenge
Sours: https://www.instructables.com/ESP32-Long-Distance-LoRaWan/

1545 1546 1547 1548 1549