Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By donbrew
#89441 My project is to notify me upon open or close of a garage door using a tilt switch on battery power.

I have it working perfectly by waking on tilt connecting the out pin to RST. It goes LOW on tilt.

Problem is it only wakes for one instance; either open or closed not both. My work around is to use 2 different systems in one package. I.E.: 2 D1 minis, 2 tilt sensors, one for open one for closed. Seems a waste of resources.

Is there a way to use one D1 mini and 2 tilt sensors? How to send only Low to pin RST and filter HIGH out.

Could I just tie the 2 outputs together; maybe put diodes in the circuits to block HIGH? One sensor is always going to be HIGH when the other is LOW.
User avatar
By Bonzo
#89456 How long have you tested deep sleep for as I thought there was a maximum time and looking on the web:

The maximum time in deep-sleep is 4,294,967,295 µs, which is about ~71 minutes.


You might have to do some lateral thinking and use a solar panel or bigger batteries.

You only need to know what position the door is in so if it is not detected in one position it must be in the other. You could then use a different type of sensor.
User avatar
By schufti
#89462 this ~70min was only correct for cores including 4.2.4 AFAIK.
deepsleep time is now unsigned 64 bit integer, go search github issues accordingly.

do you need only information on movement or dedicated open/close?
if a) then place a reed contact somewhere on the frame and a magnet on the door. As it passes the contact on open or close it wakes the esp for message. For b) you might experiment with a dualpole doublethrow momentary switch operated by a flexing vane brushing over the swicth during the movement of the door. One contact wakes the esp, the other gives the direction, immediately read in setup().
User avatar
By donbrew
#89465 Sorry, I thought I had indicated deepsleep(0). It only wakes when the sensor goes low.

The if not this then that logic does not work because sometimes the door hangs while closing and goes back open. So I need it to wake from deep sleep(0) on either sensor going low.

The logic now is: tilt sensor goes low, wakes D1, D1 sends email/SMS, D1 goes back to sleep. Using about 2 seconds of battery power on each event.

It work in brute force mode, there must be an elegant (easy) solution. My thinking is to use 2 sensors to wake on either option and a third to select which message to send.
Using this sensor: https://www.amazon.com/gp/product/B07S1 ... UTF8&psc=1

I know there are other ways to get the job done. My problem is that I'm in a wheelchair with nobody with sense enough to follow directions to install things. I need to know for sure that the door is either open or closed because I cannot easily go look with my eyes.