Site Tools


en:tech:zigbeesensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tech:zigbeesensor [2024/05/17 14:09] – [Software] bullaren:tech:zigbeesensor [2024/05/18 04:35] (current) – [Software] bullar
Line 11: Line 11:
  
 There are 3 types of ZigBee Devices: There are 3 types of ZigBee Devices:
-  - **Zigbee Coordinator Device:** It communicates with routers. This device is used for connecting the devices. +  - **ZigBee Coordinator Device:** It communicates with routers. This device is used for connecting the devices. 
-  - **Zigbee Router:** It is used for passing the data between devices. +  - **ZigBee Router:** It is used for passing the data between devices. 
-  - **Zigbee End Device:** It is the device that is going to be controlled+  - **ZigBee End Device:** It is the device that is going to be controlled
  
  
-In order to setup ZIGBEE you need at least one **ZIGBEE coordinator** device. In my case I use [[https://www.home-assistant.io/yellow|YELLOW]] from Home Assistant where a ZIGBEE module (Silicon Labs MGM210P Mighty Gecko) is on-board. In common use is also [[https://www.zigbee2mqtt.io|Zigbee2MQTT]] with a supported ZIGBEE adapter of your choice. I use this approach for debugging purpose only.+In order to setup ZIGBEE you need at least one **ZigBee coordinator** device. In my case I use [[https://www.home-assistant.io/yellow|YELLOW]] from Home Assistant where a ZIGBEE module (Silicon Labs MGM210P Mighty Gecko) is on-board. In common use is also [[https://www.zigbee2mqtt.io|Zigbee2MQTT]] with a supported ZIGBEE adapter of your choice. I use this approach for debugging purpose only.
  
-=== Modules ===+==== Modules ====
  
 In order to build a DIY Zigbee device (End Device or Router) we need a programmable Zigbee module. Several modules can be found in the market but I stick to [[https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2404011708_Chengdu-Ebyte-Elec-Tech-E18-MS1-PCB_C97344.pdf|E18-MS1-PCB]] from Chengdu Ebyte Elec Tech. In order to build a DIY Zigbee device (End Device or Router) we need a programmable Zigbee module. Several modules can be found in the market but I stick to [[https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2404011708_Chengdu-Ebyte-Elec-Tech-E18-MS1-PCB_C97344.pdf|E18-MS1-PCB]] from Chengdu Ebyte Elec Tech.
 It's based on CC2530 from Texas Instruments a bit outdated but cheap and easy to get. It's based on CC2530 from Texas Instruments a bit outdated but cheap and easy to get.
  
-{{ :en:tech:e18-ms1-pcb.png?direct&300 |E18-MS1-PCB}}+{{ :en:tech:e18-ms1-pcb.png?direct&200 |E18-MS1-PCB}}
  
-=== Quirks & Co. ===+==== Quirks & Co. ====
 For DIY devices you may have to teach the coordinator software how to deal with your Zigbee data. In Home Assistant [[https://github.com/zigpy/zha-device-handlers|quirks]] bridge the functionality gap created when a DIY device deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices. For DIY devices you may have to teach the coordinator software how to deal with your Zigbee data. In Home Assistant [[https://github.com/zigpy/zha-device-handlers|quirks]] bridge the functionality gap created when a DIY device deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
  
Line 43: Line 43:
 </WRAP> </WRAP>
  
-The final PCB is quite compact with a size of 44.5 x 24mm. On top you see the programming interface (J1) and a button (SW1). The yellow LED (LED1) is used an indicator. A 5V power supply can be connected via 2-pin JST connector (J7) or Micro-USB.  A 3.3V regulator is on-board too. The UART interface has 5V signal level and the I²C is standard 3.3V. The level of additional two GPIOs can be selected between 3.3V and 5V by jumper. All 4-pin XH connector (J3-J6) provide a power pin so that a sensor can directly be connected.+The final PCB is quite compact with a size of 44.5 x 24mm. On top you see the programming interface (J1) and a button (SW1). The yellow LED (LED1) is used as an indicator. A 5V power supply can be connected via 2-pin JST connector (J7) or Micro-USB.  A 3.3V regulator is on-board too. The UART interface has 5V signal level and the I²C is standard 3.3V. The level of additional two GPIOs can be selected between 3.3V and 5V by jumper. All 4-pin XH connector (J3-J6) provide a power pin so that a sensor can directly be connected.
  
 {{ :en:tech:pcb_pic.jpg?direct&400 | Soldered PCB}} {{ :en:tech:pcb_pic.jpg?direct&400 | Soldered PCB}}
 ===== Software ===== ===== Software =====
  
-For long I hesitated to step to ZIGBEE as the firmware development could become a challenge. There are a lot of step-by-step descriptions public but it's look like not to be an out-of-the box task. But I could find a couple of projects utilising the [[https://ptvo.info|PTVO firmware]]. The firmware tool allows creating a ZIGBEE device with easily configurable functionality, including inputs, outputs, ADC, pulse counter/generator, I2C, external sensors.+For long I hesitated to step to ZIGBEE as the firmware development could become a challenge. There are a lot of step-by-step descriptions public but it's look like not to be an out-of-the box task. But I could find a couple of projects utilising the [[https://ptvo.info|PTVO firmware]]. The firmware tool allows creating a ZIGBEE device (has to be TI SOC based) with easily configurable functionality, including inputs, outputs, ADC, pulse counter/generator, I²C, external sensors.
   
 After some tests I was impressed and convinced how easy it is to setup a ZIGBEE device. This tools not only outputs the binary file (.hex) that can be directly programmed to the ZIGBEE module, it also generates the custom files for your coordinator of choice (e.g. quirks for Home Assistant). No need to program a single line of code.  After some tests I was impressed and convinced how easy it is to setup a ZIGBEE device. This tools not only outputs the binary file (.hex) that can be directly programmed to the ZIGBEE module, it also generates the custom files for your coordinator of choice (e.g. quirks for Home Assistant). No need to program a single line of code. 
  
-[[en:tech:zigbeesensor|ZIGBEE sensor#1st application water meter]]+An 1st application setup is described [[en:tech:zigbeesensor#st_application_water_meter|here]]
 ===== Programming ===== ===== Programming =====
  
Line 79: Line 79:
 The setup of PTVO firmware is very easy. Just define P21 as counter and set the interval to 60 sec. Every pulse longer than 1ms at P21 will be counted. The setup of PTVO firmware is very easy. Just define P21 as counter and set the interval to 60 sec. Every pulse longer than 1ms at P21 will be counted.
  
-{{ :en:tech:ptvo_counter.png?direct&500 |PTVO setup}}+{{ :en:tech:ptvo_counter.png?direct&600 |PTVO setup}}
  
 After pairing the PTVO firmware will send the counter value to the coordinator. In my case the sensor gives 360 pulses per litre. This calculation as well as the daily consumption can be easily done in Home Assistant. The following examples show the results: After pairing the PTVO firmware will send the counter value to the coordinator. In my case the sensor gives 360 pulses per litre. This calculation as well as the daily consumption can be easily done in Home Assistant. The following examples show the results:
Line 86: Line 86:
 {{:en:tech:water_consumption_daily.png?direct&400|Water consumption per day}} {{:en:tech:water_consumption_daily.png?direct&400|Water consumption per day}}
  
-This sensor is now installed since more than 2 month without any issues. Many thanks to [[https://ptvo.info/zigbee-configurable-firmware-features/|PTVO]] for his great firmware tool.+This sensor is now installed since more than 2 month without any issues. Many thanks to [[https://ptvo.info/zigbee-configurable-firmware-features/|PTVO]] for his great firmware tool .
 ===== Downloads ===== ===== Downloads =====
  
en/tech/zigbeesensor.1715954942.txt.gz · Last modified: 2024/05/17 14:09 by bullar