How to Enable Router Mode on a Sonoff Zigbee Dongle Plus

This tutorial will show you how to enable router mode on a Sonoff Zigbee Dongle Plus (ZBDongle-P).

Sonoff Zigbee Dongle Plus Flash Router Firmware

Zigbee is a wireless protocol that a wide range of devices uses for power-efficient communication. It is designed to form its own networks with mains-powered devices, typically extending the range and reliability of the network.

While mains-powered Zigbee devices often act as routers, this typically isn’t true for battery-powered devices. Battery devices are often referred to as end devices. Basically, the network stops with it and isn’t repeated.

To help improve the range of your Zigbee network, which has many end devices, you can employ a dedicated Zigbee router. There are a few different ways that you can set one up, but one is to flash a Zigbee coordinator with a router firmware

In our case, we purchased a Sonoff Zigbee 3.0 Dongle Plus (ZBDongle-P) that uses the CC2652P chip. We chose this device as it is one of the more reliable yet affordable options. The only downside is that it comes by default with coordinator firmware.

Luckily, firmware to convert a Sonoff Zigbee Dongle Plus from a coordinator to a router is a relatively easy process. We can use some easy-to-use tools to flash the router firmware.

Before proceeding, there are two variants of the Sonoff Zigbee Dongle’s, one is the ZBDongle-P that we are covering in this guide, and the other is the ZBDongle-E. The “E” variant requires different steps to get it to act as a Zigbee router.

If you are unsure what version you have, it is typically written on the box and the back of the USB dongle.

Equipment

Below, you can find a list of equipment we used to flash our Sonoff Zigbee Dongle Plus with the router firmware.

Optional

We last tested this tutorial with a ZBDongle-P and used our Raspberry Pi 5 to flash the hardware.

Flashing your Sonoff Zigbee Dongle Plus with Router Firmware

Over the following sections, we will walk you through the steps for flashing your Sonoff Zigbee Dongle Plus (ZBDongle-P) with the router firmware. These steps are relatively simple and should take little time to complete.

While these steps were written and tested on a Raspberry Pi, they should work for any device running a Linux operating system. In particular, we recommend using any Debian-based operating system such as Raspberry Pi OS and Ubuntu.

Preparing your Operating System

1. Your first step is to update the packages on your operating system.

You can update the package list cache and upgrade any out-of-date packages by running the following two commands.

sudo apt update
sudo apt upgrade

2. Once the update completes, we can now install all the packages we need to flash the router firmware to the Zigbee Dongle Plus.

The first group of these packages are Python and the few libraries the firmware flasher we are using relies on. We will also be installing the “wget“, “git” and “unzip” packages to make everything a bit simpler

sudo apt install python3 python3-serial python3-magic python3-intelhex wget git unzip

Getting the Flashing Software

3. After installing all the additional packages we require, let us ensure we are in the current user’s home directory by running the command below.

cd ~

4. After swapping to your home directory, you can use the git command to clone a script by Jelmer Tiete that enables us to flash the router firmware to our Zigbee Dongle Plus (ZB-Dongle-P).

This is one of the more stable and well-developed flashing software for the CC2652P chip that the ZBDongle-P uses.

git clone https://github.com/JelmerT/cc2538-bsl/

5. Once git finishes cloning the software to your device, change into the directory using the cd command in the terminal.

cd ~/cc2538-bsl

Downloading the Router Firmware for the Sonoff Zigbee Dongle Plus

6. Our next step is to download the router firmware compatible with the ZBDongle-P we are using.

This compiled firmware for the CC2652P chip that the dongle is using is provided by Koen Kanters. You can find the latest by checking the Z-Stack-firmware GitHub page he manages. The firmware you are after is the one for the CC265P and is the “router” firmware, not the “coordinator“.

With the following command, you can download the latest version of the router firmware when publishing for the Sonoff Zigbee Dongle Plus.

Since we are using the “-O” option, we can save this router firmware as “router-firmware.zip“.

wget https://raw.githubusercontent.com/Koenkk/Z-Stack-firmware/refs/tags/Z-Stack_3.x.0_router_20221102/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20221102.zip -O router-firmware.zip

7. With the firmware now saved to our device, we will want to extract it using the unzip package we installed earlier.

By using the "-j” option when extracting this firmware, we get it to “junk” its root folder. This makes using this firmware later a bit easier.

unzip -j router-firmware.zip

8. Our next step is to use the mv command to rename this router firmware to “router-firmware.hex“.

This step isn’t necessary, but it makes flashing the firmware to the USB dongle a bit simpler later on and saves us from having to rewrite the guide every time the firmware is updated.

mv CC1352P2_CC2652P_launchpad_router*.hex router-firmware.hex

Identifying the Device Mount Point

9. Now that we have the router firmware in place, you must have your Sonoff Zigbee Dongle Plus plugged into your device.

Once you have plugged the device in, your next step is to work out where this dongle has been mounted on your Linux system.

One of the easiest ways to do this is to list the plugged-in devices by their id by running the following command.

ls -l /dev/serial/by-id

You should get a list of devices that are connected to your machine. In your case, you will want to look for the one labeled “Sonoff_Zigbee_3.0_USB_Dongle_Plus“.

Once you find the right line, the value you need is at the end. For example, if you see “../../ttyUSB0“, the value you want is “ttyUSB0“.

total 0
lrwxrwxrwx 1 root root 13 Oct 18 14:23 usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0cdb0083bf45ed11954fcf8f0a8                                                                                                                                                                6e0b4-if00-port0 -> ../../ttyUSB0

Flashing the Router Firmware to your Sonoff Zigbee Dongle Plus

10. We finally have everything in place and can now flash our Sonoff Zigbee Dongle Plus (ZBDongle-P) with the router firmware.

Before you run this command, we recommend putting your Zigbee coordinator into pairing mode. For example, through the Zigbee2MQTT interface you would enable “join” mode.

With this line, you only need to replace “<DEVICENAME>” with the value you got in the previous step. For our example, we would swap this value with “ttyUSB0“.

sudo ./cc2538-bsl.py -ewv -p /dev/<DEVICENAME> --bootloader-sonoff-usb router-firmware.hex

11. Below you can see that we successfully flashed our Zonoff dongle with the router firmware.

It successfully erased the original firmware on the device and flashed the new firmware.

sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_router_20221102.hex
Firmware file: Intel Hex
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:2A:2E:AD:29
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
    Write done
Verifying by comparing CRC32 calculations.
    Verified (match: 0x9877ee56)

12. Once the router firmware has been flashed, unplug it and plug it back into your USB device. It should immediately go into pairing mode.

If you have issues getting your Sonoff Zigbee Dongle-P to pair while in router mode, try reflashing the device, unplugging it, and plugging it back in.

When the firmware is flashed to your dongle, it should automatically start in pairing mode.

Conclusion

By this point in the guide, you should know how to flash the router firmware to the Sonoff Zigbee Dongle Plus (ZBDongle-P).

Flashing this USB dongle is a decent way to easily set up a Zigbee router and increase the range of your network.

Please feel free to leave a comment below if you have had any issues with getting the router firmware flashed to your dongle.

If you found this tutorial to be helpful, we highly recommend taking some time to explore some of our Home Assistant tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *