Hi!
Just for context, few months ago I wrote this post: https://forum.allaboutcircuits.com/...witch-changes-state-with-auto-turnoff.196069/
My idea is to make an independent power latch that will monitor state changes from a reed switch (or tbf any kind of switch) to power up an ESP-01 board. Another requirement is that the power should be ON until the ESP01 has finished its task (which is reading the state of the switch). Took forever to get the components, but finally managed to try it. I was recommended a circuit with an LDO with Shutdown capability, but since I couldn't find such component, I had to make it a bit different.
This is my (simplified) circuit:
![1699688912672.png 1699688912672.png](https://forum.allaboutcircuits.com/data/attachments/294/294875-ec15ce94052223bc84a4efc8a7d8c9f0.jpg)
Source is 5V. The LDO (https://datasheet.lcsc.com/lcsc/2110121030_onsemi-NCP164ASNADJT1G_C2902124.pdf) is also connected to Vin and Ground (but removed for simplicity). The transistor is a BC547 NPN transistor bought from aliexpress. The XOR is not really an XOR (since I don't have), but I made one out of two XNOR (https://datasheet.lcsc.com/lcsc/2302221900_Texas-Instruments-CD4077BE_C353982.pdf). And the capacitors are electrolytic (also from aliexpress). And I'm aware that the 100K resistor should be bigger to save battery.
In this case I'm having some issues:
1- It looks like when there's a state change, the time the ESP-01 goes on is super small, not long enough to power on and hold GPIO2 HIGH. So I'm wondering how can I make it longer. I know there's gonna be some bounce, but can't I just make the time the switch is on somehow longer (by cahnging the capacitors), so it will have enough time to account for the bounce?
2- And also, sometimes after a good 10-20 seconds after changing state, I can see the ESP-01 leds powering on and off. Which I don't really understand, since there shouldn't be any current flow towards there. I thought about the bouncing, but I don't think it bounces for 10-20 seconds...
I asked in another forum and was recommended to change the XOR for a RS Flip-Flop, to take into account the switch bouncing. This is the recommended circuit. But then again, it's hard for me to find those components without spending 40€ in shipping. And also, I'd like how to fix my circuit, not get a new one. This is the other recommended circuit for reference:
![1699689024664.png 1699689024664.png](https://forum.allaboutcircuits.com/data/attachments/294/294876-b8254b5eb95121cd0d4062bb022e96a2.jpg)
As I said my goal is to fix my circuit, not to use this new one if possible
, just for learning purposes I want to know what is wrong and what would be the good way to fix it with common components, more than with another IC.
Thanks!
Just for context, few months ago I wrote this post: https://forum.allaboutcircuits.com/...witch-changes-state-with-auto-turnoff.196069/
My idea is to make an independent power latch that will monitor state changes from a reed switch (or tbf any kind of switch) to power up an ESP-01 board. Another requirement is that the power should be ON until the ESP01 has finished its task (which is reading the state of the switch). Took forever to get the components, but finally managed to try it. I was recommended a circuit with an LDO with Shutdown capability, but since I couldn't find such component, I had to make it a bit different.
This is my (simplified) circuit:
![1699688912672.png 1699688912672.png](https://forum.allaboutcircuits.com/data/attachments/294/294875-ec15ce94052223bc84a4efc8a7d8c9f0.jpg)
Source is 5V. The LDO (https://datasheet.lcsc.com/lcsc/2110121030_onsemi-NCP164ASNADJT1G_C2902124.pdf) is also connected to Vin and Ground (but removed for simplicity). The transistor is a BC547 NPN transistor bought from aliexpress. The XOR is not really an XOR (since I don't have), but I made one out of two XNOR (https://datasheet.lcsc.com/lcsc/2302221900_Texas-Instruments-CD4077BE_C353982.pdf). And the capacitors are electrolytic (also from aliexpress). And I'm aware that the 100K resistor should be bigger to save battery.
In this case I'm having some issues:
1- It looks like when there's a state change, the time the ESP-01 goes on is super small, not long enough to power on and hold GPIO2 HIGH. So I'm wondering how can I make it longer. I know there's gonna be some bounce, but can't I just make the time the switch is on somehow longer (by cahnging the capacitors), so it will have enough time to account for the bounce?
2- And also, sometimes after a good 10-20 seconds after changing state, I can see the ESP-01 leds powering on and off. Which I don't really understand, since there shouldn't be any current flow towards there. I thought about the bouncing, but I don't think it bounces for 10-20 seconds...
I asked in another forum and was recommended to change the XOR for a RS Flip-Flop, to take into account the switch bouncing. This is the recommended circuit. But then again, it's hard for me to find those components without spending 40€ in shipping. And also, I'd like how to fix my circuit, not get a new one. This is the other recommended circuit for reference:
![1699689024664.png 1699689024664.png](https://forum.allaboutcircuits.com/data/attachments/294/294876-b8254b5eb95121cd0d4062bb022e96a2.jpg)
As I said my goal is to fix my circuit, not to use this new one if possible
Thanks!