Skip to main content

Get Started for Lora

Single channel gateways(called One-Channel Hub) are low-cost tools that enable users to begin exploring the LoRa realm. These gateways can receive LoRa packets on a specific spreading factor and channel and facilitate the exchange of these packets with the network. Due to their affordability, many users have embarked on building their own single-channel gateways to experiment with LoRa.

The XIAO ESP32S3 as host MCU and Wio SX1262 LoRa radio kit can be configured to function as single channel gateway for connecting to The Things Network. This kit offers a practical solution for those interested in delving into LoRa technology and establishing connections to LNS(lora network server).

This is the github project: One Channel Hub.

Flash Firmware

The firmware is prepared for installation. Simply download from bin library.

If you don't use the complete ESP-IDF environment, it is also possible to flash the provided binary files using the esptool utility.

Step 1: Download Esptool, for more information please refer to the Esptool documentation.

$ pip install esptool

Step 2: Connect the XIAO ESP32S3 to your PC.

Step 3: Navigate to the downloaded file and open the terminal/Command, then run esptool.py commands.

  • For Linux/macOS
esptool.py --chip esp32s3 -p port -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 8MB 0x0 seeed_xiao_esp32s3_devkit_bootloader.bin 0x10000 seeed_xiao_esp32s3_devkit_lorahub.bin 0x8000 seeed_xiao_esp32s3_devkit_partition-table.bin
  • For Windows
py -m esptool --chip esp32s3 -p COM14 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 8MB 0x0 seeed_xiao_esp32s3_devkit_bootloader.bin 0x10000 seeed_xiao_esp32s3_devkit_lorahub.bin 0x8000 seeed_xiao_esp32s3_devkit_partition-table.bin

Replace port with the name of used serial port. If connection fails, see Troubleshooting.

Customize and build firmware

If you want to reset the configuration, the following instruction can help you build the firmware by yourself under ESP-IDF environment.

Setup environment

This project is based on the Espressif ESP-IDF development, check this guide to setup the environment.

Get ESP-IDF

mkdir -p ~/esp
cd ~/esp
git clone -b v5.2.1 --recursive https://github.com/espressif/esp-idf.git

Set up Tools

cd esp-idf/
./install.sh

Installation of One Channel Hub

Step 1: Clone the hub to local repository. And navigate to the project path.

git clone https://github.com/Seeed-Studio/one_channel_hub.git

cd ~/this_project_directory

Step 2: Install required driver

  • SX126x driver(sx1261, sx1262, sx1268):
git clone -b v2.3.2 https://github.com/Lora-net/sx126x_driver.git sx126x_driver
  • llcc68 driver:
git clone -b v2.3.2 https://github.com/Lora-net/llcc68_driver.git llcc68_driver
  • lr11xx driver(lr1121):
git clone -b v2.4.1 https://github.com/Lora-net/SWDR001.git lr11xx_driver

Build Firmware

Step 1: Enter the lorahub directory.

cd lorahub

Prepare your Linux/MAC terminal for building with ESP-IDF from the command line. This step can be skipped on Windows as the installed 'ESP-IDF x.x CMD' tool will prepare the environment automatically.

. ~/esp/esp-idf/export.sh

Configure the ESP32 target to build for.

idf.py set-target esp32s3

Customize the build if necessary:

idf.py menuconfig

(1) Set board type:

LoRaWAN 1-CH HUB Configuration -> Hardware Configuration -> Board type -> Seeed XIAO ESP32S3 Gateway

The default setting of Lora radio type is sx1262.

Don't forget to disable the OLED Display.

pir

(2) Set flash size:

Serial flasher config -> Flash size -> for XIAO ESP32S3 is 8MB.

pir

Build the project:

idf.py all

Flash with esp-idf

Identify the serial device associated to the One-Channel Hub to be flashed. For linux and mac, can check the serial port by

ls /dev/cu*

then flash using idf.py, replace the port

idf.py -p port flash

If a permission error is returned, check that the current user is part of the dialout group. If not, do the following, reboot the linux machine and try again:

sudo usermod -a -G dialout $USERNAME

On a Windows setup, let's suppose that the device is mounted as COM14, the above command would be like:

idf.py -p COM14 flash

Launch the monitor console to see logs (optional).

idf.py -p port monitor

Flash with esptool

If not using the complete ESP-IDF environment, can just download the provided binary files following the first section.

Wi-Fi Configuration

Step 1: Download ESP BLE prov App:

Press the RST button on the board, and then press the BOOT button, the LED will be on.

Step 2: Connect the XIAO to your PC and open a serial port tool, like PuTTY, COMTOOL, or any other tools you prefered.

Step 3: Open terminal communication

  • For COMTOOL:

(1). Select correct serial port and set baudrate to 115200

(2). Go to Terminal and open communication

pir

  • For PuTTY:

(1). Select correct serial line and set baudrate to 115200

pir

(2). Go to Terminal and click 'Implicit CR in every LF'

pir

Step 4: Click 'Provison Device' on ESP BLE prov app

Once connected successfully, The wifi connection information and lora gateway ID will show up on terminal.

tip

Please take the notes, it is useful for Lora configuration.

  1. IP address: 192.168.1.44
  2. Port: 8000
  3. Gateway EUI: 0xF09E9EFFFE20D02C

pir

The lora package forwarder's message which in Json format can be checked on Terminal.

pir

LoRa Configuration

As the IP address and port we taken down, the web interface is available at: http://ip_address:8000, and open it on browser.

pir

The web interface allows to configure the following parameters:

Channel parameters:

  • Frequency
  • Spreading Factor
  • Bandwidth

LoRaWAN network server:

  • Address
  • Port

SNTP server address: to get UTC time

There are 2 buttons at the bottom of the configuration form:

Configure: when pressed, the parameters set in the HTML form are written to flash memory (NVS).
Reboot: when pressed, a reboot command is triggered, the LoRaHub will restart and the new configuration is applied.

note

Note that the configuration written in flash memory is only taken into account on the next reboot.

All are set down. Now we can connect the Wio-SX1262 with XIAO ESP32S3 lora kit to Lora Network Server like TTN(The things network) and Chirpstack.

  • Connect to TTN
  • Connect to Chirpstack

Resource

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...