eduperez wrote:Can the "simple push button" diagram be easily adapted for a "pull button" (i.e., to activate the ESP when a circuit opens)?
Hi, the easy answer is yes, but it’s not that simple to do in the spirit of the concept. i.e has very little power usage when powered down & doesn’t use lots of components.
That said, I’m guessing it would be good to adapt this to use normally closed contacts (standard alarm door contacts).
My first thoughts:
The easy answer – use the PIR example and replace the PIR with a 1k ohm resistor between Vcc and the diode & put your normally closed switch between the diode & ground. This will work for testing but hammer your batteries. If you go much more than 1k ohms you risk not having a logic 1 at CH_PD.
The maths bit:
When the switch is open (activated) the circuit is:
1K ohm resistor -> Diode -> 10K resistor.
Logic 1 = <0.75 VCC, So 75% of 3.3V = <2.47V (we need more than 2.5V at CH_PD).
Vcc = 3.3V - diode volt drop 0.7V = 2.4V (no head room so you’ll need a diode with a low forward volt drop).
If you use a diode with 0.3V forward volt drop.
Vcc = 3.3V – diode volt drop 0.3V = 3.0V (now we have some head room to play with).
We have 3.0V left to play with so we can work out the voltage divider with as high a value in series with the switch as possible to limit the power consumption during power down, but still give us <2.47V at the terminal.
10K + 1K = 11k (total voltage divider resistance) = ratio 10 to 1.
3.0V ratio 10 to 1 = 2.7V to 0.27V
We end up with:
3.3V (Vcc).
- 0.27V = 3.06V (after volt drop across 1K resistor).
-0.30V = 2.76V (after volt drop across diode & the voltage CH_PD will see).
-2.70V = 0.00V (after volt drop across 10K resistor & the rounding up of values).
The down side:
When the normally closed switch is closed (ESP is off & circuit is supposed to draw no power) there are two parallel circuits:
1k -> to ground via the switch.
Power = V / R, =3.3V / 1K = 3.3mA
1K -> Diode -> 10K to ground.
Negligible.
So with passive components, yes it can be easily done. But you’ll end up with about 3.3mA current draw even when powered down. I’m guessing this would be ok for development but is going to be no good for a final design using batteries.
We need to go back to the simple switch idea and find a way to invert your normally closed switch without using any power.
I feel another FET coming on. But not tonight.