How to extend battery life of wireless devices

I have made a wireless switch with ESPhome, and while testing it i am measuring a power draw of approx. 50 mA, using standard AA batteries with about 2000 mAh this button won’t have a battery life of more than 40 hours i suppose.

When writing the ESPhome program, is there any way i can delay the loop or extend the battery life in any other way?
I’ve read that adding the “delay” to binary sensors only delays that sensor and the entire loop is still running and drawing power?

Deep sleep.

Hi,
To clarify a bit its a push button that switches when pressed once, or twice etc.
So if I put it into deep sleep, and the button is pressed in while in deep sleep, wouldn’t it “not” detect the button push and nothing will happen?

Thanks

“Deep Sleep” is waiting for the RST pin to be pulled low. The only part of the processor that is running is the system clock. If you set a “sleep time” in the deep sleep component, GPIO16 will go low after the sleep time has expired. You don’t say which ESP board you are using. Some Wemos D1s have a place for a solder jumper on the back of the board that connects GPIO16 to RST.

When you (or the timer on GPIO16) pull RST low, the ESP restarts and when it boots and connects to the WiFi then your button press be detected. The downside is that the booting of the ESP can take two or three seconds. If this delay is not a problem, just put your button on RST to ground.

Tell us what it is you want to happen when you press the button. Someone may have a better idea.

Hi

Sorry about that, I am fairly new and still learning, and thought a good start would be a wireless button. So right now the button is simply for turning on lights.
And i guess there must be some way to reduce the power consumption, as there are lots of brands making “smart” buttons that lasts months?
I wanted something compact and small and I’m using an ESP-01S (ESP8266).

Because i wanted a push button, and not a switch i set it up as a binary sensor which then toggles a switch on/off on each push. (This is something i found on another forum post)

You are sort of on the right track. But those buttons do not use WiFi, they use Zigbee or 433MHz.

Zigbee buttons are fairly cheap, but you need a receiver on the computer running Home Assistant. I use this one. And here is a YouTube tutorial of how to install it on Home Assistant.

433MHz buttons are much, much cheaper. The receiver I use is the Sonoff RF Bridge, but I just looked for it on Amazon and found that the Sonoff RF Bridge is discontinued. Does anyone know of a replacement device?

1 Like

Definitely not an expert, but I think you’ll have a hard time getting long battery life using a development ESP board versus making something custom. Even with deep sleep and only a single wakeup per day, I never could get more than a few weeks off of 3xAAs and an ESP32 development board. I assume that it all comes down to the power regulator constantly wasting power even while the device sleeps.

1 Like

Alright, I just had a quick read on the topics and I think I understand.
I will definitly look into these two options a bit more. (I can see that some of the local shops in my country has the Sonoff RF bridge in stock, so maybe I’ll try picking one of those up with a couple of components)

Thanks alot for the help!

I looked on Amazon where I bought my bridge. On the Sonoff site, they still have the RF bridge.

1 Like