zigbee2Mqtt part 1 with CC2530 and FTDI



from here:https://github.com/koenkk/zigbee2mqtt
https://www.zigbee2mqtt.io/information/supported_devices.html
Zigbee2mqtt supports several CC2530 and CC2531 devices. Both can be used as a router or coordinator. A discussion of these devices can be found here. For more information about a coordinator and routers can be found here.


Z-Stack coordinator firmwares

This repository contains various Z-Stack coordinator firmwares.

Overiew

Z-StackDeviceZigbeeDirect childrenRoutesNotes
Z-Stack_Home_1.2 (default)CC25311.2 HA2030/0
CC2530, CC2530 + CC2591, CC2530 + CC25921.2 HA1630/0
Z-Stack_Home_1.2 (source_routing)CC2531, CC2530, CC2530 + CC2591, CC2530 + CC25921.2 HA540/40
Z-Stack_3.0.xCC25313.01540/0Discussion #1445
- Max 40 Zigbee 3.0 devices
CC2530, CC2530 + CC2591, CC2530 + CC25923.01040/0Discussion #1445
- Max 40 Zigbee 3.0 devices
Z-Stack_3.x.0CC26X2R1, CC1352P_23.050100/200Discussion #1429
- Max 200 Zigbee 3.0 devices
and their limitation:

which one should I use?

This depends:
  • Zigbee 3.0 coordinators are only recommended for CC26X2R1 and CC1352P_2 (other devices might not be powerful enough)
  • If you have a network of 1 - 30 devices, the Z-Stack_Home_1.2 default firmware is recommended.
  • If you have a network of 30+ devices, the Z-Stack_Home_1.2 source routing firmware is recommended.
  • Note that the source routing firmware only supports 5 direct children, therefore you need to have routers in range of the coordinator.
it seems reasonable, routing will take a lot of effort to maintain device table, and periodically check the device is there or not, so routing will decrease the connected device, or you need more powerful chip.

I will fist try my CC2530 with external antenna.

using 2530 + FTDI as 2531 dongle:
https://www.zigbee2mqtt.io/information/connecting_cc2530.html

after flashing the firmware, I plug the device into USB of Pi, and following this instruction:https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html
the instruction use a CC2531, so it appears as ttyACM0,  my ftdi show as ttyusb0, and I have a wireless keyboard/mouse dongle shows as ttyAMA0










here to install zigbee2mqtt
https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html#2-installing

the default setting is using cc2531, we need to change some setting:
nano /opt/zigbee2mqtt/data/configuration.yaml
https://www.zigbee2mqtt.io/information/connecting_cc2530.html#configuring-zigbee2mqtt
serial:
  port: /dev/ttyUSB0
advanced:
  baudrate: 115200
  rtscts: false

after adding service to systemctl
Some tips that can be handy later:
# Stopping zigbee2mqtt
sudo systemctl stop zigbee2mqtt

# Starting zigbee2mqtt
sudo systemctl start zigbee2mqtt

# View the log of zigbee2mqtt, it will show the action update
sudo journalctl -u zigbee2mqtt.service -f


I purchased few xiami sensors, I paired the switch and the temp/humid sensor.
To pair switch, you need something sharp to push the hole on the back, 3 secs, when the blue led on the left start to flash, it start to pair. Same thing for sensor with a small button on top.
then we can use this command to check the journal
sudo journalctl -u zigbee2mqtt.service -f

we can see the time and the data sent to mqtt.
each device is represented as a 8 bytes ID, it could be the mac address of zigbee chip. in the following you can see there are 2 device one is botton, one is sensor.


Then I can get an other terminal to subscript to each topic(node),
pi@raspberry:~ $ mosquitto_sub -d -t zigbee2mqtt/0x00158d0003584cba
The we can see the data comes in



留言

這個網誌中的熱門文章

Meshtastic 03 adding GPS on TTGO lora32 V2

GeoSetter how to add geotag on to pictures, and export to google earth as kmz

AIS0. understanding AIS NMEA 0183: How it's coded