My code starts to be ready, a bee hive measuring system.
One complete code run takes ca 1.8 sec to execute, from wakeup to sleep, it then sleeps for 15 min. The system runs a week or so on a 2A li-Ion.
No BLE or WiFi needed.
To save battery I uses deep sleep for ESP32, but I ask for some input to save more power than per today.
One idea, the code for initializing the HX711 is done in setup, can this initialization be skipped after first boot (from first power on), and avfer esp_deep_sleep_start(); the initialization is not necessary? (this will save some time and power, and also for LoRa+DHT+BS18B20
Any tip/examples you can give me to sleep not only ESP but other peripherals?
The 'smart tips' might be a complete waste of time, if for instance the majority of the high 'deep sleep' current is caused by the ESP32 module itself.
Remove all the external components and write a program that say blinks an LED and puts the ESP32 into 'deep sleep' for say a minute.
Put a multimeter in series with the battery and see what the 'deep sleep' current is.
If a 2Ahr battery lasts a week, then the average current is close to 12mA. Now if the deep sleep current of the bare ESP32 is about that, you need to address that as an issue, there would be little point in looking elsewhere for power savings.
I suspect the current during that 1.8secs is maybe average 100mA. So over the week thats about 34mAhr. So even if you got rid of the stuff you need that takes 1.8secs, battery life would only increase by around 3 hours.
And since the sleep period is a fixed 15mins its easy to setup.
I do have a RTC powered sleep board that goes in series with a lithium battery. Via I2C from the host you can set deep sleep from seconds up to a month. Sleep current is 2uA.