"closed by default" transistor design?

BobTPH

Joined Jun 5, 2013
8,967
So, you use a pulldown on a GPIO pin, when sleeping it is tristate and the pin is pulled low. When running you output high, overriding the pulldown and the pin is high.

Now simply connect the switch between that pin and RST. When running it does nothing since the RST is pulled high. When sleeping, the switch pulls RST low.
 

ElectricSpidey

Joined Dec 2, 2017
2,779
So, you use a pulldown on a GPIO pin, when sleeping it is tristate and the pin is pulled low. When running you output high, overriding the pulldown and the pin is high.

Now simply connect the switch between that pin and RST. When running it does nothing since the RST is pulled high. When sleeping, the switch pulls RST low.
This should work just fine as long as the "normally open" switch is not an NPN transistor, as the pulldown in series with the emitter would place the transistor in follower mode and might not pull the reset pin low enough.

I only post this because of something the OP said causing me to believe they may in fact be using an NPN as the "switch".

But even if the "switch" is a transistor it may still work and has to be the best solution if it does.
 

BobTPH

Joined Jun 5, 2013
8,967
I think he's talking about an mechanical pushbutton switch. The transistors being discussed were possible ways to disable the button when not sleeping.
 

crutschow

Joined Mar 14, 2008
34,451
So, you use a pulldown on a GPIO pin, when sleeping it is tristate and the pin is pulled low. When running you output high, overriding the pulldown and the pin is high.

Now simply connect the switch between that pin and RST. When running it does nothing since the RST is pulled high. When sleeping, the switch pulls RST low.
That's a good idea as long as he has a spare GPIO pin available, (which I suppose is likely).
 

Thread Starter

bmbouter

Joined May 29, 2021
75
Ok so ya'll are awesome. I'm only now able to get back to this thread, but yes you all reached the right conclusion. I want the momentary switch connected to the RST pin to be able to pull it low while the microcontroller is sleeping and while it's awake to effectively "disable".

Just when I thought we had a pretty simple design, here comes a simpler one! I'm going to try modeling it in LTSpice (because its helpful to me even though its so simple) and I think gosh I can just use a pull down resistor, the momentary switch, and an extra GPIO! I never considered a design like this.
 

Thread Starter

bmbouter

Joined May 29, 2021
75
I experimentally confirmed that this works great. It took me a while to notice the nodemcu board I have uses different resistor values so my 10k pull down wasn't working initially, but after adjusting the pull down to what it needed to ... pull it down, it worked.

I also modeled it in LTSpice to make sure the values will work with my dev board and the 8266's specification for low.

Thank you!
 
Top