2
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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!

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.