Power management with push button

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cedoche123
 
Posts: 7
Joined: Thu Dec 21, 2017 5:27 pm

Power management with push button

Post by cedoche123 »

Hi,
I am playing with feather boards (M4 Express and RP2040) and trying to turn it ON/OFF simply by pressing a push button (no switch). So basically, I want to be able to press the button once to turn it ON (when it's OFF or turn it OFF when it's ON) Additionally the feather will automatically turn OFF after a givent time for exemple.

In a normal situation, the Enable pin is pulled UP with a 10k and we can turn it off by connecting the pin to Gnd.
So here is what I tried. And I'm sure there is a better solution.
1. Remove the 10k and replaced it with 2x 10k in serie connected to Gnd -> Enable is now pulled DOWN and feather normal state is OFF.
2. Connect the push button between pins Enable and USB. -> Enable will pull UP when button pressed and feather will turn ON.
3. Connect a digital output to Enable pin with a diode. -> At boot, digital output is set to HIGH and maintains Enable pulled UP when push button is released. The diode ensure USB voltage (>3.3) will not go into digital pin when button pressed).
4. Connect analog input between the two 10k resistor so that I can detect when the push button is pressed. -> If voltage > threshold, set digital output to LOW and feather will turn OFF. (Not ideal since batterie voltage can be close to digital pin voltage)

Check the scetch attached.
Can anyone tell me if what I am doing makes any sens and if there is a better solution to do it?

Thanks a lot,
Cedric
Attachments
Scetch
Scetch
power_manager.jpg (97.17 KiB) Viewed 132 times

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Power management with push button

Post by mikeysklar »

I understand preferring a button over a slide switch, but is there any reason to not use a push button switch to remove the additional circuitry you have proposed?

User avatar
cedoche123
 
Posts: 7
Joined: Thu Dec 21, 2017 5:27 pm

Re: Power management with push button

Post by cedoche123 »

First it has to be a no-latching push button so that it can automatically turn OFF given a certain condition in the code.
Then I try to make the module as compact as possible by reusing an existing push button on another featherHAT.
Finally adding an extra 6$ module while I’m sure the same result can be done with little modification is not really an elegant solution.
(But yes, I agree it would perfectly work)

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”