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

User avatar
By btidey
#89474 deep sleep time was indeed changed to a 64 bit integer of microseconds BUT that doesn't mean you can get extremely long sleep intervals.

The microseconds is translated into a 31 bit interval for the slow speed RTC clock (~173KHz) which is still active in deep sleep. This gives a max interval of about 3.5 hours.

viewtopic.php?f=160&t=20784&start=12

From your original post it doesn't sound like the deep sleep time is actually relevant as you seem to be doing deep sleep forever (0) and relying on the sensors to wake it up.

I am sure there is a way to combine the two sensors into a wake signal for EN or RST. Could you indicate how the two sensors are being used? Maybe a truth table on when the two sensors are in on/off state.
User avatar
By donbrew
#89554 They are simple ball sensors; low signal one way high the other.
Signal goes to RST pin. The low signal wakes the D1 Mini from deepsleep(0); D1 Mini sends email; goes back to sleep.
I don't know if there is another way to wake using another pin or signal. That is my question.
User avatar
By StanJ
#89629 Yep, it's do-able with a single D1 Mini and one tilt switch: https://electronics.stackexchange.com/q ... e-detector

You'll also need to wire the tilt switch into a GPIO so you can see whether the door is currently open or closed when the CPU wakes up. The circuit above just generates the /RST pulse when the state changes (the door opens or closes). I'd have used a reed switch, as they're probably more reliable long-term than 5 cent tilt sensors are, but that's just me. Lord only knows what the contact bounce time of those tilt switches is. A reed switch is typically less than 50ms, so the sequence is:

<door changes state>
reset pulse generated on either direction
D1 mini wakes, makes WiFi connection
<switch has stopped bouncing, so read the GPIO to see whether it's open or closed>
transmit the current open/closed status
go back to sleep

I'm guessing your parts are all through hole, so you need through hole / leaded parts and not SMD. A single CMOS 4030B would do you fine. The circuits linked above generate a brief HIGH pulse, so you'd need to use one gate of the XOR to invert the output to a brief LOW pulse. The old 4000 series is a heck of a lot lower quiescent current than the 74HC86 is. edit: there are low current 74HC86, but all I find are SO or smaller ICs.

A larger issue is that the D1 Mini isn't battery-friendly. It'll draw 5 to 10mA continuous when it's asleep due to the LDO and USB chips, then jump up to 80mA when it's on to send the event notice. That 5 to 10mA will eat batteries pretty quickly. A bare ESP-12F module and a couple of AAA batteries (one alkaline + 1 lithium) would power it for years. Alkalines run ~ 1.45V new, lithiums ~1.8V, so 3.25V total, safely within the 2.8 to 3.6V input of the ESP-12F without needing an LDO. If I'm brain-damaged on that bar napkin power calculation I expect someone will correct me. :?
Last edited by StanJ on Mon Nov 30, 2020 6:06 pm, edited 1 time in total.
User avatar
By StanJ
#89641 edit: Nope, I can't recommend that circuit I linked to. The basic concept is good, but the implementation is poor.

Image
Image

It needs at least space on the board for a bulk capacitor, as it's relying solely on the 10uF cap in the ESP-12F.
Worse than that, he has components and ground plane under the antenna. It'd be lucky if it connected more than 10 feet from the router.

Still, you could tweak his original and probably get boards delivered for less than $10 each. I'd switch to the ESP-12S as it eliminates the utterly useless castellations connected to the flash chip, and incorporates some of the discretes he's added. That'd free up a bit of room on the board to move components around for better placement and allows routing copper through there.

Image