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

Firmware Location

https://github.com/Koenkk/Z-Stack-firmware/

Use router or coordinator firmware (ZStack)

How to Flash

https://notenoughtech.com/home-automation/flashing-cc2531-without-cc-debugger/

Solder wires (with dupont ends) onto the pins as illustrated below

pins
pin meaning table image

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)

more pin info
  1. Check if WiringPi is installed (should be) by running gpio -v if you don’t see the version in the output here are the complete instructions.
  2. Clone flash it to your Raspberry Pi:
    git clone https://github.com/jmichault/flash_cc2531.git
  3. Navigate to the folder cd flash_cc2531 and see if the USB device is wired correctly running: ./cc_chipid
  4. You should see ID = b524. if any other outcome is given, check your wires.
  5. Get the latest firmware from my link above, unizp it, and upload the hex file to your pi
  6. Clear the flash with ./cc_erase
  7. Upload new firmware using ./cc_write /path/to/<Hex file name here> this will take about 3 min.
  8. 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?)

Read more here: https://community.home-assistant.io/t/my-zigbee2mqtt-devices-do-not-connect-to-the-router-i-want-to-connect-to/319019/5

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.

zigbee map in zigbee2mqtt

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.

More information about the lights: https://donnlee.com/2020/06/26/cc2531-router-operations-zigbee/#:~:text=To%20pair%2C%20enable%20%E2%80%9Cpermit%E2%80%9D,IDs%20for%20the%20CC2531%20router.

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.