I'm experimenting with a learning project, where I want to generate a "reset pulse" (from high-low-high) to trigger a reset of a microcontroller, an ESP8266. This is the only way to wake this chip from deep sleep (hard reset). Disclaimer: I know about the more powerful ESP32, but I still want to try to understand why this setup is not working before moving on ;)
So the idea is to trigger a mosfet on every button state change, both when it goes from open to closed (0 to 3.3V), and when it goes from closed to open (3.3V to 0). To achieve this, I've got some help on ##electronics to set up the following simulation
Consider both switches of "SW1" to open and close simultaneously (doesn't have to be exact timing). This is for a simple door sensor, so I couldn't easily use a DPDT switch. And in any case, please refer to my above disclaimer whenever this seems over-engineered or just odd. I just want to learn why this is working (very much) different in real life, than in the sim.
In the sim, the drain of the mosfet stays at VCC while the mosfet is off, and goes to 0 while it is on, giving a nice high-low-high pulse. In my actual setup, I have only 0.6V at the drain when the mosfet (BS170) is off. Is this mosfet very different from the one set up in the sim? As it seems to me, this voltage is pulling the RST pin of the ESP low at all times so it just never runs.
Components used are:
- 3.3V power supply
- BS170 N-channel mosfet
- 2.2nF caps (I didn't have 10uF ceramic ones)
- 1N4001 diodes
Updated schematic after answers below: