How to: Setup an ESP32-H2 as Thread Router

Cheap Thread Router

Note: this isn’t a complete step-by-step how-to (though it covers most of the process). During the setup for the ESP-IDF in VSCode I ran into some challenges and didn’t to document those, so for now that is something to fix yourself.

Intro

After buying and installing a few Eve Motion Blind powered blinds spread over three floors, I ran into the problem of not having a Thread network that covered them all. A Homepod Mini was a start, but I did not have a place where it could reliably cover all blinds.

So I started to search for friendly priced Thread router devices. And that was a challenge: there don’t seem to be any (yet).

Extra Thread Border Routers were not preferable because of the price.

First I added a SkyConnect stick to extend the network, but that didn’t solve everything:

  • I still had single point of failures because of the location of both OTBR’s
  • One blind appeared to be in such a corner that both the Homepod and SkyConnect were not able to have a reliable connection.

By now I was pretty sure that there is no easy off-the-shelf solution and that ESP32 was the way to go.
I ordered two ESP32-H2’s and programmed them with the info from the (originally Homepod) Thread network I use in Home Assistant.

This is what I used on Windows:

  • VSCode with the following extensions:
    • ESP-IDF (Follow the installation in VSCode to get everything up and running)
    • CMake
    • CMake Tools
    • (you might need more, but the ESP-IDF wizard can take care of that, or gives you the info on what you need)

Get your Thread Network info:

  • In the HA OpenThread Border Router Add-on: enable the web port in the configuration by entering a port, saving and restarting the addon.
  • Your config should be available at: http://your.ha.ip.address:port/node/dataset/active

What to do: (might not be completely correct)

  • Connect the ESP32-H2 with USB on the UART port and check on which port on your PC it is connected (COM-port)
  • In VSCode in the ESP-IDF:
    • Create a new project
    • Select the correct target: ESP32-H2 chip (via builtin USB-JTAG)
    • Add your ESP-IDF Component directory: Leave empty
    • Choose Template
      • Select ESP-IDF
      • Search for “ot_cli”"
      • Create Project

The good stuff:

Once the project is created open the configuration by clicking on “SDK Configuration Editor (menuconfig)”.
Here you will need to search and set the following settings:

  • Enable the automatic start mode.: Enabled
  • Enable Joiner.: Enabled
    Fill the following settings with what you find on your existing HA OTBR config page:
  • OpenThread network name
  • OpenThread mesh local prefix, format /
  • OpenThread network channel
  • OpenThread network pan id (grab this one from the preferred network in the Thread Integration)
  • OpenThread extended pan id
  • OpenThread network key
  • OpenThread pre-shared commissioner key

When adjusted everything, save your config and build it.
After building, flash to your ESP32-H2 and open the monitor to check if everything works. That should be obvious, if it keeps scrolling with the same blocks of text there is probably something wrong.

Check for functionality:

  • In the monitor you can check the role of your device by typing “state” and pressing enter. This should be “router”.
  • You can also grab an IPv6 address from a Matter device in HA and try to ping it to see if the network works.
  • After waiting a bit it becomes visible as a router in the Eve Home app in the Thread Network tab.

My Experience:

  • In the Eve app some blinds are connected through my ESP-router and have an excellent connection.

My questions:

  • I get the following warning when the router is up and running, but I have not been able to find any info on it: W(3869) OPENTHREAD:[W] DuaManager----: Failed to perform next registration: NotFound

My sources:

My used sources.

ESP32H2 및 ESP 스레드 보더 라우터 보드로 스레드 네트워크 빌드  |  OpenThread
vscode-esp-idf-extension/docs/tutorial/install.md at 91590cca91b209fbfc685031007dc07fbacdfabd · espressif/vscode-esp-idf-extension · GitHub
esp-idf/examples/openthread/ot_cli at master · espressif/esp-idf · GitHub
openthread/src/cli/README.md at 000f5fcb30d7e2853a4d1bb0f7d21cf0e52c00aa · openthread/openthread · GitHub

1 Like

That is not Espressif Thread border router development board, but just a ESP32-H2 ?

I have this one: ESP32-H2-DevKitM-1 - - — esp-dev-kits latest documentation

I believe its the cheapest one with Thread-support I could find.

Also see ESP32H2 및 ESP 스레드 보더 라우터 보드로 스레드 네트워크 빌드  |  OpenThread.
I skipped the ESP Thread Border Router Board.

1 Like

Basic the part that I skipped when I built my OTBR’s. So I could have used an ESP32-H2 as supporting router instead of a second OTBR. Good to know.