I am taking bits and pieces from everywhere and making one article with all the information in one place. Please support the sites and projects I am referencing.
The CC2531 is getting old now, but if you still have some of them lying around they can come in handy. I would recommend switching over to something like the Sonoff Zigbee Dongle Plus.
My current setup
Home Assistant using Zigbee2MQTT
CC2531 coordinator with Xiaomi and Aqara Zigbee devices
Use router or coordinator firmware (ZStack)
How to Flash
Solder wires (with dupont ends) onto the pins as illustrated below
Look at the pin numbers below and hook up the dupont wires to the correct pins on your Raspberry Pi as in the table above (image source https://raspberrypi.stackexchange.com/questions/94126/gpio-number-vs-pin-number-which-to-use)
- Check if WiringPi is installed (should be) by running
gpio -vif you don’t see the version in the output here are the complete instructions.
- Clone flash it to your Raspberry Pi:
git clone https://github.com/jmichault/flash_cc2531.git
- Navigate to the folder
cd flash_cc2531and see if the USB device is wired correctly running:
- You should see
ID = b524.if any other outcome is given, check your wires.
- Get the latest firmware from my link above, unizp it, and upload the hex file to your pi
- Clear the flash with
- Upload new firmware using
./cc_write /path/to/<Hex file name here>this will take about 3 min.
- Disconnect the wires and reboot the Raspberry Pi.
Pair CC2531 to your existing Coordinator
In Zigbee2MQTT make sure that your coordinator is in Permit Join mode.
Plug your newly flashed CC2531 with router firmware into a power source like a laptop USB port or a phone charger (it literally only needs power, that is it). Be careful with power banks. The CC2531 draws so little power that most power banks will shut off after 1 minutes because it is not detecting enough current.
That is it, it will show up in your device list. Nothing further to do
How to connect Zigbee devices to this router
You don’t. Zigbee devices will automatically connect to the router when it thinks it is better. Just be patient. You can try resetting a device, but it does not help, it decides itself. It works very similar to WiFi repeaters in this regard. Your phone just knows to switch over to a repeater without you having to tell it to.
There is probably a way to force a device to connect to a router that I don’t know about. (perhaps in Zigbee2MQTT bind?)
I had to reset my Xiaomi switch twice before it figured out there is a router it can connect to. I’ve read (in the above link and elsewhere) that Xiaomi devices are very finnicky about this. But Aqara and others work OK.
What do the blinking lights mean
- Short fast blinks (one per second) – the router is connecting to a network.
- Short long blinks (one per 4 seconds) – normal operations.
- Three short blinks – the router cannot send a report to a coordinator.
Your newly flashed router should flash red once every 4 seconds.
What do the CC2531 buttons do and pairing
- S1 button: only changes the state of the green LED.
- S2 button: repairs CC2531
- CC2530, CC2531: Power on, wait 2 seconds, power off, repeat this cycle three times.
- CC2531: Power on, press and hold down the S2 button for 5 seconds.
When you press S1, the CC2531 LED toggles between flashing-red and green, and emits that state (green = on) like a sensor. That’s all it does. It’s only for testing. Green doesn’t mean the router is doing anything different. It’s just a “sensor” for you to test the link between the CC2531 router and your coordinator.