Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery optimization guide #596

Open
nicolaerosia opened this issue Jan 6, 2025 · 11 comments
Open

Battery optimization guide #596

nicolaerosia opened this issue Jan 6, 2025 · 11 comments

Comments

@nicolaerosia
Copy link

Hello,

[@pvvx thank you very much for your work on this firmware!]

[There are threads on this, like https://github.com//issues/204 but could not find a guide]

I'm looking to reduce the power consumption to delay the replacement of batteries as much as possible.

I'm using ESP32-C3 and ESP32-C6 BLE proxies to Home Assistant - I can't use HA connected USB BLE 5.X Dongles because of the way my layout is.

Here is what I did:

  • BT5+ PHY: YES, LE Long Range: NO
  • Advertising type: BTHome v2, adflags: YES
  • Advertising interval: 5000ms
  • Measure interval: 6 (30sec) - I'm OK with a measurement every 30s
  • Connect latency: 1000ms
  • LCD Refresh rate: 12.75s (can't push it higher)
  • Set to 0 measurements to keep - I hope this disable writing to Flash
  • RF TX Power: VANT-0.14 dbm - will try with even less if it is worth it

I used the Android app @pvvx recommended, nRF Connect and I see that all devices appear as:
Device Type: LE only <- I think this is good, right?

Advertising type: Legacy <- This relates to the advertising which is done BT 4.x way on 3 channels instead of BT 5.x way? If yes, would there be a win if it is done BT 5.x way?

Flags: LE General Discoverable, BR/EDR Not Supported

Any other recommendations on tuning I could do to lower the power consumption?

Does setting a smaller device name make a difference?

On ESP32 side, I'm not interested in "best WiFi" performance, I would favor BLE scanning. Any suggestions on how to do this?
Snippet from ESPHome config

esp32_ble_tracker:
  id: ble_tracker
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    continuous: true
    active: true
@pvvx
Copy link
Owner

pvvx commented Jan 6, 2025

  • BT5+ PHY: no
  • Display: Off. On many, but not all, turning off the display increases battery life by up to 2 times.

All this is pointless for CR2032.

  • Installing a capacitor in the power supply can increase it up to 2 times.
    This is a property of the CR2032 battery, not the settings. The reason is the large pulse current during transmission, exceeding the norms for CR2032. It can be smoothed out by installing a capacitor that is missing from the printed circuit board. This will increase the operating time of CR2032 up to 2 times.

Buy a thermometer with 2xAAA or CR2450. This will increase the battery life several times.
The dependence is non-linear, since CR2032 is used at the limit.
For CR2032, the difference in real capacity under pulse load depends greatly on the manufacturer, price, manufacturing time to installation and reaches more than 3 times.


Next, there is a dependence on the type of elements installed in a specific thermometer model.
This gives a difference of two or more times in average current consumption = Choose the right thermometer option.


The thermometer with display MJWSD05MMC has the longest battery life.
About 2 years have passed since the purchase and reflashing, but the batteries in them have not yet run out. At the same time, one works in the "LE Long Range" mode. And this is a 2..3 times increased consumption.

CGG1 the first release also works quite a long time. There is a CR2430 battery. This is only for a model released a long time ago and having a capacitor soldered into the power supply by the manufacturer.

Next come thermometers without a display. Almost all of them have 2xAAA or CR2450. The battery life in them with optimized settings is more than 2 years.

Xiaomi LYWSD03MMC is not the best option. Only Tuya like TH05 is worse.

On thermometers with cheap CR2032 the maximum service life is from 8 months to a little more than a year. It depends little on the settings, except for disabling the display for some models. Where the display chip allows for almost complete disabling.


For the average CR2032 to last 2 years, it needs to transmit data no more than once every 30 minutes. This is inconsistent with BLE and thermometers with displays. And such devices require a button to be able to connect and do other settings. But there are no buttons on most thermometers.
And it is incompatible with use in IoT. Such discreteness of readings does not make sense for controlling anything. It is suitable only for those who like to look at broken mechanical watches - twice a day they show the correct time.

@KeinPlandavonviel
Copy link

Hm, now I'm a bit surprised. I have 8 LYWSD03MMC, 3x HW2.0 and 5x HW1.5
I bought the HW2.0 first and the CR2032 supplied lasted 2 years 4 months after reflashing! In all 3 devices, one of them in outdoor use (with winter).

Sensor in "low power mode"
BT5+ PHY on (default)
Advertising type pvvx / Encrypted beacon
Advertising interval 10000
Measure interval 6 (60sec)
LCD refresh rate 12.75

Was I extremely lucky with the CR2032? I would be surprised though, as all 3 HW2.0 devices lasted so long.

@pvvx
Copy link
Owner

pvvx commented Jan 8, 2025

I bought the HW2.0 first and the CR2032 supplied lasted 2 years 4 months after reflashing!

Next, there is a dependence on the type of elements installed in a specific thermometer model.
This gives a difference of two or more times in average current consumption

Of the available HW B2.0, not a single one worked more than 1.5 years on one battery. On cheap CR2032 even less.

@KeinPlandavonviel
Copy link

KeinPlandavonviel commented Jan 8, 2025

Are the HW2.0s also different in terms of power consumption? I thought “only” the HWx.x would differ from each other.
I wonder how long my HW1.5 will last. :-/

EDIT:
The Capacitor is not present on mine HW2.0.

@pvvx
Copy link
Owner

pvvx commented Jan 8, 2025

On HW B2.0, turning off the display can increase the battery life several times.

@pvvx
Copy link
Owner

pvvx commented Jan 8, 2025

one of them in outdoor use (with winter).

At -35C, the new CR2032 produces 2.0V. This is not enough for work.

B1.9, unheated attic, display off.
image
CR2032 can no longer operate at sub-zero temperatures.
image

@KeinPlandavonviel
Copy link

Different winters. :D Maximum -6.4°C here.
I also have one in the freezer (HW1.5), which still showed 2.8V at -24°C. I wonder how long it will last.

freezer

Are there also differences in power consumption with HW2.0, despite the same HW revision? Have I understood you correctly?

@pvvx
Copy link
Owner

pvvx commented Jan 8, 2025

Are there also differences in power consumption with HW2.0, despite the same HW revision? Have I understood you correctly?

I can't know that. Because I can't buy all the thermometers - Then you won't have a thermometer :)

  • The sensor is detected automatically.
  • The LCD driver is detected automatically.

README ->
For LYWSD03MMC, the HW version is determined by the display and sensor addresses on I2C:

HW LCD I2C addr SHTxxx I2C addr Note
B1.4 0x3C 0x70 (SHTC3)  
B1.5 UART 0x70 (SHTC3)  
B1.6 UART 0x44 (SHT4x)  
B1.7 0x3C 0x44 (SHT4x) Test original string HW
B1.9 0x3E 0x44 (SHT4x)  
B2.0 0x3C 0x44 (SHT4x) Test original string HW

Version 1.7 or 2.0 is determined at first run by reading the HW line written in Flash.
Display matrices or controllers are different for all versions, except B1.7 = B2.0.

@KeinPlandavonviel
Copy link

KeinPlandavonviel commented Jan 8, 2025

Yes, I know. I asked about the differences a long time ago and remembered them. :) My 2.0 also has 2.0 on the PCB.

I must have simply misunderstood you here.
#596 (comment)

Sounded to me like it also depends on your luck with HW2.0 devices. At least my HW2.0s last a very, very long time. I hope my HW1.5 devices (despite UART) last at least 1-1.5 years. I will find out. If not, I may solder in the capacitor and/or convert to 2x AAA.
At least they don't have any problems with -°C. Perhaps the CR2032 quality is decisive here (the one supplied is just in).

Initial voltage“loss"
blub

@pvvx
Copy link
Owner

pvvx commented Jan 8, 2025

The kit includes different CR2032. And they have different expiration dates before sale.
Some CR2032 actually die immediately in sub-zero temperatures during shipping. Our route from China goes through zones with -40C and below. The same goes for air transportation.

@KeinPlandavonviel
Copy link

It is interesting that some CR2032 have such problems with it. I thought lithium-manganese cells had no problems with this. :-/
I recently replaced the cell in the outdoor sensor, I'm curious to see what happens when it gets cold.

Have a nice day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants