How can I let an Wemos D1 boot on a button click, letting it execute an action and then shut down. I would like it to be wireless so it can be very flexible, and would love to not have to worry about it's battery life for about half a year.

I was thinking about making a circuit where the button would complete the circuit and power the Wemos. The problem is that you need to keep the button pressed until the action is done, not so handy.

I was also thinking about having capacitors to store enough the energy after a press for the Wemos D1 to do the action, but this will probably not suffice.

I was also thinking about having a battery in it, putting it in deep sleep and let it wake when needed, but that will make me charge the battery way too much.

Any ideas what I can do?

  • \$\begingroup\$ i do this with a NC SPST to VIN, and ESP-NOW, which can fire off a message within 200ms of power-on. I have a variety of small standalone 2-AAA powered buttons that last for years. \$\endgroup\$ – dandavis Dec 6 '18 at 21:15

This question is a bit broad to belong here, but generally there are three classes of approach:

1) Use a software solution to put the chip into the lowest power sleep mode possible after it is done operation. Have a button that resets it and/or wakes it from sleep. Possibly replace the linear regulator with one having a lower quiescent current

2) Rework the board replacing the SOT23-5 linear regulator with one of the many having an active high enable input on pin 4. Connect the enable input to Vin via the button, and also to a GPIO via a diode. Push the button to start the system, software then holds the GPIO high to keep the system on as long as it needs to, then turns itself off. Depending on startup time you might need a capacitor to help hold it on long enough after the button push for the software to take over holding the regulator enabled. (Some toys actually use a capacitor from Vin to the enable to auto-power on when the battery is connected, and then power off when software decides they've been idle too long)

3) Place a non-inverting power switch chip chosen for low quiescent current in the upstream supply path. It's important that this be a non-inverting configuration, ie, active high enable for a high side switch. An inverting switch such as a single P-FET or N-FET will just end up turning itself partially back on through the protection diodes and pulling resistor.

Make sure to use a power source which can satisfy the peak current demand. A CR2032 coin cell for example may satisfy the average power requirement but won't meet the peak requirement and the ESP will be unable to boot. Also be very careful not to have any I/Os asserted against pulling resistors for meaningful amounts of time - especially on an ESP where you have lots of pulling resistor to configure boot mode.

| improve this answer | |
  • \$\begingroup\$ Thanks for the help. I currently do not have time to perform what you've described above, but I will in the near future. From what I can see, it looks promising :). Thanks \$\endgroup\$ – Mark D Dec 13 '18 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.