In the article Zigbee – Prepare a Sonoff zigbee 3.0 USB Dongle Plus for zigbee2mqtt I have described how to write a Zigbee stick from Sonoff with the firmware for zigbee2mqtt.
An alternative to this Zigbee stick is the Electrolama zig-a-zig-ah! (zzh!) Coordinator USB stick from Electrollama
How the flashing works with this stick I have described in the following article
Contents
- 1 Safety instructions
- 2 Affiliate links/advertising links
- 3 Requirements
- 4 Download software to flash
- 5 Download correct firmware
- 6 Activate bootloader of the USB stick
- 7 Start flashing process
- 8 Update configuration file of zigbee2mqtt
- 9 restart zigbee2mqtt to apply the changes
- 10 More articles on the topic
- 11 Have fun with the project
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
Before you start with this article, you should have prepared a RaspberryPi so that it can be reached via the network and controlled via SSH. In addition, zigbee2mqtt should of course already be installed.
The following articles describe what needs to be done to prepare the RaspberryPi.
- Zigbee - Installing zigbee2mqtt on the Raspberry Pi
- Zigbee - register devices, sensors and actuators with zigbee2mqtt
- Zigbee - Administration of Zigbee2mqtt via the dashboard
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screwdriver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Number | Link |
---|---|
1x | https://electrolama.com/projects/zig-a-zig-ah/ |
1x | USB extension cable Buy at Amazon |
1x | Raspberry Pi Buy at Amazon |
1x | Raspberry Pi power supply Buy at Amazon |
1x | Raspberry Pi case Buy at Amazon |
1x | Micro SD card 64GB Buy at Amazon |
Download software to flash
So that you can flash the Zigbee USB stick with the appropriate firmware, you must first download the appropriate software. This will later help to copy the actual firmware to the USB stick.
To do this, open the website of Texas Instruments (this is the manufacturer of the IC used and the associated Flash software) at the following link.
Then click on the download button there...
...and on the following page on the
"Download options" button
in the section
"FLASH-PROGRAMMER-2".
In the window that opens you should then select the option
"Windows Installer for SmartRF Flash Programmer"
select
At this point you will need to verify yourself with a TI account.
This account can be created for free. Just follow the link under
"Register now.
After that you should be redirected to the shown view. Here you can click on the shown download button to download the...
... start the download of the software.
Now you have to install the downloaded software.
How to install a program under Windows I have described in the following article.
During the installation, the window shown may appear. This is merely an indication that additional drivers are being installed and can be confirmed by clicking on "Install".
After the installation process is complete, you can start the software directly.
Download correct firmware
But before you can start the flashing process, you have to download the correct firmware version. This depends on the chip used and the desired configuration. In most cases, however, you can use the firmware linked below.
Under the following link you can find an overview of the available firmware versions and the corresponding hardware.
The current firmware version is also linked here.
Alternatively, the current firmware version is linked under the following link.
Activate bootloader of the USB stick
Now only one last step is necessary to prepare the USB stick for the flash process. So that it can be equipped with the new firmware, you have to activate the bootloader. This is a small program component of the firmware currently installed on the USB stick, which helps to transfer the new firmware to the USB stick.
To activate the bootloader you have to press and hold the small button on the stick's PCB and then plug it into the USB port while keeping the button pressed.
So you should connect the Zigbee USB stick to your computer at the latest now.
So navigate to the GIT repository linked above and copy the python script uartLog.py to your computer.
How you can download files from a GIT repository I described with an example in the following article.
After you have downloaded the script, you can run it. Open a command prompt, navigate to the location of the script and execute the following command.
python uartLog.py
You may need to install the pySerial library to start it successfully. To do this, you must execute the following command.
pip install pyserial
The script now performs a few simple steps and then lists all connected COM ports. Here it can happen that more than one COM port is found. In this case you have to specify the COM port that belongs to your Zigbee USB stick.
In this example you can recognize the correct COM port by the line that starts with the entry
"Silicon Labs CP210x USB to UART Bridge"
i.e. COM14
If you have more than one device with this entry, the easiest way is to first disconnect all other devices from the computer, restart the script and then continue.
In any case you have to enter the number of the corresponding COM port and confirm with Enter.
In the example shown here, "14" stands for COM14.
The script will then perform all the necessary steps to activate the bootloader on your USB stick.
Important: From now on you must not disconnect the USB stick from your computer. If you do, you must run the script again to re-enable the bootloader.
Start flashing process
Now you can (finally) start the flash process. To do this - if not already done - start the previously installed software
- SmartRF Flash Programmer 2
In the shown view you should select your Zigbee USB stick in the upper left corner. You can recognize it by the entry
"Silicon Labs CP210x USB to UART Bridge"
Then select the "Unknown" entry below.
If your USB stick is not recognized there, you may have to install the appropriate driver first. You can find the driver under the following link. (Thanks to Christopher for the hint 🙂 )
After that you should select the IC used on the Zigbee USB stick. In this case it is the
CC2652P
Selects the corresponding entry in the list at the bottom left.
This step is optional:
If you are migrating from another Zigbee stick and want to transfer a known MAC address directly to the USB stick, you need to go to the tab
MAC Address
change
This step is optional:
Then enter the desired MAC address in the text field shown.
You can also find more information in the article
You can then select the firmware to be flashed by clicking on the button
Browse
select
You have downloaded the firmware in one of the previous steps.
The path to the selected firmware is then displayed in the highlighted text box.
Now you can start the flashing process.
To do this, set the checkmarks as shown and click on the highlighted arrow button.
The flashing process will now start and its progress will be displayed in the lower area.
As soon as this is successfully completed, the message
Success!
displayed.
Update configuration file of zigbee2mqtt
So that zigbee2mqtt knows under which address it can address the new Zigbee USB stick you have to configure the configuration file of zigbee2mqtt correctly.
For this to work you should now connect your Zigbee USB stick to the Raspberry Pi with zigbee2mqtt installed.
With the following command you can now list the connected Zigbee USB sticks.
ls /dev/serial/by-id/
In the example shown, only one USB stick is connected, which is why only one entry is displayed here.
If there are several entries there, you should select the entry with the identification string for the "Select zzh stick".
Copies here the complete line thus:
- /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
and saves them, for example, in a text file to be able to insert them later into the configuration file.
Now open the configuration file of zigbee2mqtt by entering the following command.
sudo nano /opt/zigbee2mqtt/data/configuration.yaml
If necessary, delete an existing entry at the marked position in the "port:" section.
The previously copied address to your Zigbee USB stick must now be pasted into the configuration file as shown in the example.
Make sure that the indentation is correct and that there is only one entry under the "port:" category.
Saves the changes in the configuration file now by
- CTRL-X, Y and Enter
restart zigbee2mqtt to apply the changes
To apply the changes to the configuration file you should restart your zigbee2mqtt installation.
All you have to do is run the following command.
sudo systemctl restart zigbee2mqtt
Zigbee2mqtt should restart now and the configured Zigbee USB stick should be available. How you can now add Zigbee sensors or actuators and administer zigbee2mqtt via a simple dashboard I have described in the following articles.
- Zigbee - register devices, sensors and actuators with zigbee2mqtt
- Zigbee - Administration of Zigbee2mqtt via the dashboard
In the following category I have also listed other Zigbee devices which can be controlled or read out with the NodeRed code offered there.
More articles on the topic
I have summarized other articles on the subject of Zigbee and zigbee2mqtt in the following category. There you will also find articles on various Zigbee devices and how they look like NodeRed can be controlled.
External links:
- https://www.zigbee2mqtt.io/guide/adapters/#flashing-cc1352-cc2652-cc2538-based-adapters
- https://www.zigbee2mqtt.io/guide/adapters/#recommended
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂