Google is committed to advancing racial equity for Black communities. See how.

ESP Thread Border Router

View source on GitHub

ESP Thread border router is a FreeRTOS-based implementation running on a combination of Espressif's Wi-Fi and 802.15.4 SoCs.

Hardware requirements:

  • An ESP32 series Wi-Fi dev kit. (ESP32, ESP32-C3, ESP32-S2 or ESP32-S3)
  • An ESP32-H2 dev kit for running RCP.

Hardware connection

The ESP32-H2 RCP will be connected to the border router via UART.

ESP32-H2 UART
ESP32-H2 UART connection


  • Connect the ground PIN of ESP32 and ESP32-H2
  • Connect PIN 4 of ESP32 to PIN TX of ESP32-H2
  • Connect PIN 5 of ESP32 to PIN RX of ESP32-H2

Set up ESP-IDF

The code for running the ESP Thread border router is shipped with the Espressif development framework, ESP-IDF.

To set up the environment, please follow the official installation guide.

Build and flash the RCP

cd ${IDF_PATH}/examples/openthread/ot_rcp
idf.py --preview set-target esp32h2
idf.py build flash

Configure the Thread and the Wi-Fi network

The border router will automatically join the Wi-Fi network and create a new Thread network if there is not one in its storage. The network parameters can be configured in the config menu:

cd ${IDF_PATH}/examples/openthread/ot_br
idf.py menuconfig

The network configuration items are:

  • Wi-Fi SSID and PSK: Example Connection Configuration > connect using Wi-Fi interface
  • Thread network parameters: OpenThread network parameters

Build and run the border router

cd ${IDF_PATH}/examples/openthread/ot_br
idf.py build flash monitor

Now you'll see the border router output in the ESP32 monitor. It also provides an interactive OpenThread command line:

state
I(23374) OPENTHREAD:[INFO]-CLI-----: execute command: state
leader
Done
>

Supported features

  • Border agent for external commissioners.
  • IPv6 bidirectional connectivity.
  • SRP service registration and advertising proxy.
  • mDNS discovery proxy.

To set up a SRP client on a Thread end device and reach it from the Wi-Fi network, follow the border router codelab from step 4.

Note that all the ot-ctl commands in the codelab need to be directly entered in the border router's command line.

For instance, for this command:

sudo ot-ctl dataset active -x
0e080000000000010000000300001235060004001fffe002083d3818dc1c8db63f0708fda85ce9df1e662005101d81689e4c0a32f3b4aa112994d29692030f4f70656e5468726561642d35326532010252e204103f23f6b8875d4b05541eeb4f9718d2f40c0302a0ff
Done

You would enter:

dataset active -x
I(13893332) OPENTHREAD:[INFO]-CLI-----: execute command: dataset active -x
0e080000000000010000000300001235060004001fffe002083d3818dc1c8db63f0708fda85ce9df1e662005101d81689e4c0a32f3b4aa112994d29692030f4f70656e5468726561642d35326532010252e204103f23f6b8875d4b05541eeb4f9718d2f40c0302a0ff
Done