ATC_MiThermometer icon indicating copy to clipboard operation
ATC_MiThermometer copied to clipboard

[Feature request] Use hardware button to save energy

Open unaiur opened this issue 2 years ago • 6 comments

Some devices (like CGDK2) have a hardware button that is currently unused.

It can be used to implement optional battery optimizations:

  • Use a larger advertisement interval (1min), but when the button is pressed swap to a short advertisement interval (0.5sec) for 5 minutes or while there is an active BT connection. This mode can be enabled only for devices with a hardware button and for use cases that not require automated connections to the device. It can be also useful to speed up BT connections.

  • Turn off the LCD until the button is pressed and then keep it on for a configurable time.

unaiur avatar Feb 10 '22 15:02 unaiur

To do this, you need to create another version. Software algorithms and functionality in the current version are not compatible with this implementation. This is similar to the XMWSDJ04MMC variant. It showed inconvenience in use.

This optimization offers no benefit to battery life, but greatly reduces the functionality and use cases of the thermometer. The average consumption of the TLSR825x SoC itself at default settings (advertising every 2.5 seconds) is 6 uA. The indicator consumes much more. In CGDK2, this is more than 20 µA, LYWSD03MMC - 8..9 µA Disabling the LCD controller is not possible in most cases. To do this, you need to install an additional key to turn off its power. E-Ink does not consume when displayed, but consumes a lot when redrawing. To do this, there is an option for the minimum image refresh interval.

Sensor polling in 10 seconds is chosen as optimal for those who do not know how to set up integration. For smooth control of heating elements (PID control), data must be transmitted every 0.1 seconds. But most integrations and MQTT cannot provide this mode.

When polling for 10 seconds, only such control can be squeezed out of "HA": image image

The "warm floor" has even more inertia. This will cause much larger fluctuations in temperature.

It is not possible to reduce the number of transmissions of duplicate advertisements due to the use of ESP chips by many. They miss a lot of packets when receiving and additional duplication is required. A normal BLE adapter or controller, when surrounded by hundreds of BLE devices, has a loss of about 7%. What not to say about ESP.

pvvx avatar Feb 11 '22 23:02 pvvx

  • Use a larger advertisement interval (1min), but when the button is pressed swap to a short advertisement interval (0.5sec) for 5 minutes or while there is an active BT connection. This mode can be enabled only for devices with a hardware button and for use cases that not require automated connections to the device. It can be also useful to speed up BT connections.

Preliminary analysis of CGDK2(-2) consumption: image image

pvvx avatar Feb 12 '22 02:02 pvvx

I don’t understand you. Are you saying it is worthless because the maximum battery life with a CGDK2 always sleeping is 16 months?

Are you proposing to use a bigger battery? Maybe a CR2450 battery will fit in.

Anyway, reducing the advertising time to less that half a second speed ups the Bluetooth connection and makes it more reliable for Linux users.

Best regards!

On Sat, 12 Feb 2022 at 03:31 Victor @.***> wrote:

  • Use a larger advertisement interval (1min), but when the button is pressed swap to a short advertisement interval (0.5sec) for 5 minutes or while there is an active BT connection. This mode can be enabled only for devices with a hardware button and for use cases that not require automated connections to the device. It can be also useful to speed up BT connections.

Preliminary analysis of CGDK2 consumption: [image: image] https://user-images.githubusercontent.com/12629515/153693123-504c56d9-f078-4355-a9f6-57c21c6afd35.png

— Reply to this email directly, view it on GitHub https://github.com/pvvx/ATC_MiThermometer/issues/192#issuecomment-1036952610, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABM4WB2MAI7GAOKDOXUVY7TU2XBAVANCNFSM5OBDAKDQ . You are receiving this because you authored the thread.Message ID: @.***>

unaiur avatar Feb 12 '22 08:02 unaiur

Yes. Sleeping TLSR8253 with RAM enabled consumes 3..3.1 uA. The transmission of advertising with a period of 10 seconds is 3 μA. The temperature sensor also consumes power. But the main consumer in CGDK2 is BU9792. The BU9792 consumes 3 times more than a running TLSR8253 with advertise every 10 seconds. Windows and Android connect to the device without problems at 10 second intervals. Recent versions of Bluez on Linux have also been fixed.

CGDK2 https://www.qingping.co/temp-rh-monitor-lite/overview : Ultra-low Power Consumption, One Button Cell Lasts for 8 Months With Ultra-low power consumption LCD, one button cell can last for 8 months in common indoor environment for Qingping Temp & RH Monitor Lite.

CGDK2-2 (doesn't have BLE): image Rated Power 30 μA Real - over 45 μA.

The pressed button adds 30 uA. These are the values of the resistors in the button circuit. :)

pvvx avatar Feb 12 '22 08:02 pvvx

I implemented the logic to turn on and off the lcd and its controller using the hardware button. Single click => toggles screen using an I2C command. I do not have hardware to measure the impact, but when the screen is off it takes around 25 seconds after removing the battery for the capacitor to drain and CPU to turn off, therefore the battery life should be greatly extended.

unaiur avatar Apr 19 '22 08:04 unaiur

How to you know when cpu turn off ? What is the time with lcd on ?

mat-c avatar Aug 28 '22 19:08 mat-c

Disabling the screen on CGDK2 is implemented in version 4.3

pvvx avatar Mar 28 '23 13:03 pvvx