3

I am trying to build what I thought was a relatively simple system (think deadbolt detector), that will fire an event when a simple switch changes state.

Currently, I am testing with an ESP-01 and an ESP32, using deep sleep but the power consumption still seems quite high, because I have to wake the device up every 10 seconds to query the status of the "switch".

I would like to only wake from sleep when the state changes, I can "easily" do this on "close", but I would like to do this on "open" as well like in this question. I need a switch that not only detects open/close, but also sends a pulse to wake up an ESP8266 whenever the (debounced) state changes

I have read up on XOR/XNOR gates, but I am still not sure, how I would implement it.

Xenophane
  • 33
  • 2

2 Answers2

1

Perhaps you could use a Schmitt trigger EXOR as specified here. enter image description here

Source: Convert a toggle switch into a momentary response

It will create a momentary high pulse whenever a regular toggle switch (deadbolt) is switch on->off or off->on. You could then wire that ouput to an external wakeup pin for said microcontroller.

As you are specifying multiple microcontrollers I suggest that you look up the external wakeup procedures for the board you are using. Many examples are available such as this one for the ESP32.

Best of luck!

Arjan
  • 136
  • 3
1

This is a working prototype that I made. You can see more details about parts, modify and order your own if you want.

This is the schematic:
schematic

Here is a link to my project on jlcpcb: https://easyeda.com/jakibsgaard/low-powered-rising-and-falling-power-on-circuit

I have also a open question where I want to improve the circuit I have made. But that is not required. This has much more information about the circuit I made. Improving edge detector with latching circuit for esp8266

Voltage Spike
  • 75,799
  • 36
  • 80
  • 208
John-Arvid
  • 135
  • 9