pvvx / ZigbeeTLc

Custom firmware for Zigbee 3.0 IoT devices on the TLSR825x chip
Other
404 stars 23 forks source link

Dual temp sensors for TS0201 with dual endpoints #112

Open papagenic opened 3 months ago

papagenic commented 3 months ago

This code implements dual temperature sensors on a single TS0201 device. The initial problem was to measure temperature on pipes, and very often temp measurements on pipes go by pair (input/output). Hence the idea to create a dual temp sensor from a single temp sensor

pvvx commented 3 months ago

Only basic firmware versions are supported. I can't support all possible versions of homemade thermometers, as it would require over a hundred thermometers and components for testing. And that requires a lot of time. Organize a separate thread, agree on Zigbee firmware identifiers for OTA. I can provide a link to your version and take into account the firmware identifiers so that there is no confusion. Zigbee Board ID:

//#define BOARD_LYWSD03MMC_B14      0 // number used for BLE firmware
#define BOARD_MHO_C401              1
#define BOARD_CGG1                  2
//#define BOARD_LYWSD03MMC_B19      3 // number used for BLE firmware
//#define BOARD_LYWSD03MMC_DEVBIS   3 // ver https://github.com/devbis/z03mmc
//#define BOARD_LYWSD03MMC_B16      4 // number used for BLE firmware
//#define BOARD_WATERMETER          4 // ver https://github.com/slacky1965/watermeter_zed 
//#define BOARD_LYWSD03MMC_B17      5 // number used for BLE firmware
#define BOARD_CGDK2                 6
#define BOARD_CGG1N                 7 // 2022
#define BOARD_MHO_C401N             8 // 2022
#define BOARD_MJWSD05MMC            9
//#define BOARD_LYWSD03MMC_B15      10 // number used for BLE firmware
#define BOARD_LYWSD03MMC            10
#define BOARD_MHO_C122              11
// 13..15 - number used for BLE firmware - https://github.com/pvvx/ATC_MiThermometer
#define BOARD_TB03F                 16 // DIY TB-03F-Kit
#define BOARD_TS0201_TZ3000         17
#define BOARD_TNKS                  18 // Water tank controller (not yet published at the moment)
#define BOARD_THB2                  19
#define BOARD_BTH01                 20
#define BOARD_TH05                  21
#define DEVICE_TH03Z                22 // ZigBee TH03Z
#define BOARD_THB1                  23 // https://github.com/pvvx/THB2
#define BOARD_TH05D                 24 // TH05_V1.3 https://github.com/pvvx/THB2
#define BOARD_TH05F                 25 // TH05Y_V1.2 https://github.com/pvvx/THB2
#define BOARD_THB3                  26 // https://github.com/pvvx/THB2
#define BOARD_ZTH01                 27 // ZigBee ZTH01
#define BOARD_ZTH02                 28 // ZigBee ZTH02

#define MANUFACTURER_CODE_TELINK            0x1141 // Telink ID

The BLE version supports assembly with 3 temperature sensors. Standard and 2 MY18B20 via 1-Wire. But this can only be assembled independently by setting 'define' in the configuration files. image The same applies to other sensors. image Water reserve tank management: image ...


The next version of Zigbee will use the developments and similar codes of work with sensors from the BLE version. All source codes working with sensors will be changed.

papagenic commented 3 months ago

Thanks for the input regarding sensors. I seem to remember however that the 1wire sensors are not so energy efficient. I guess you are probably right . The number combination of multiple sensors is very large. We can proceed as you suggest. What do you need from me for that? When you say "the next version of zigbee", do you mean the next version of ZigbeeTlc?

pvvx commented 3 months ago

When you say "the next version of zigbee", do you mean the next version of ZigbeeTlc?

Yes, ZigbeeTLc. But there is no time yet. Also, a combination of BLE + Zigbee is suggested, since a very large number of users like to upload everything in a row, and then complain that there is no Zigbee or the existing system does not support Zigbee OTA. And BLE is on all smartphones...


Zigbee OTA files for existing thermometers are automatically downloaded to Home Assistant from https://github.com/Koenkk/zigbee-OTA. To identify which firmware is used for which device, the IDs transmitted by the device are used. Some have the update set to automatic.

Therefore, each version requires its own IDs. https://github.com/Koenkk/zigbee-OTA/tree/master/images/Telink


I seem to remember however that the 1wire sensors are not so energy efficient.

That's why it's not DS18B20, but Chinese MY18B20. And it has a significantly lower cost.

Works up to 1.8V power supply. And for additional reduction of consumption is used work in parallel with two 1-wire. image

System average (cycle 2 x 5 sec): 8.4 uA (3.3V) (Sleep: 2.5 uA) Stage 1: image Window: 0.76 мА, 40 ms

Stage 2: image Window: 0.71 мА, 40 ms

Sensors MY18B20 (x2): Power terminal current (Cycle 4 x 2.5 sec),

Measure: image

Read & Sleep: image

Sensor SHT4x: Power terminal current (Cycle 4 x 2.5 sec) Sleep: image

Measure: image

I2C (10k) + Measure: image

The entire purchased batch was also calibrated at the factory. The discrepancies in the tested batch of MY18B20 sensors are no more than 1 least significant bit. Comparison with SHT4x (lighter graph): image


AHT10...35 sensors consume more and give a measurement error when powered below 2.5V.