0
\$\begingroup\$

I have a design where I'm using an ESP32 as the device's main controller. The system is battery powered, so the ESP is in deep-sleep a lot. It can be woken up with a simple button push (detecting for a falling edge, on one of it's "RTC GPIO").

The circuit for the button is pretty standard:

enter image description here

Pull-up for valid state, and an RC filter for debouncing. The RC filter is after the pull-up, as to ensure there isn't a voltage divider formed between the pull-up and the filter resistor to the button ground side when the button is pushed.

However, something weird has been happening. I've noticed a few times my device is randomly waking up. I've had a google and I can't seem to see any complaints on ESP forums about the deep-sleep being unreliable and randomly waking up after X amount of time, so it must be something unique to my design.

The PCB trace for the button is essentially a stub (the pull-up and RC filter are located right at the button), and the trace itself is over 150mm long. I'm no EMI expert, but my inkling is telling me there's a chance this is picking up noise (capacitively, inductively, or even as a far-field antenna) and potentially causing the ESP to wake-up. Is this a crazy thought to have? It is a four layer board with top and bottom ground fills as well, so I would have thought the trace is somewhat "shielded" and with decent parasitic capacitance to GND - but maybe not.

After I had this inkling I moved the devices from my work bench (plenty of Wi-Fi, 50Hz, and AC-DC wall adapter switching stuff around even with bench-top devices turned off) into my room for the day while I was out of the house. Just sitting there laying on my bed. And, lo and behold, in 8 hours none of them turned on. This could be total coincidence though - that's why I just wanted to get a second opinion.

Thanks! :)

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

While not a definitive answer, can you move the RC filter, R108 & C25, closer to the RTC GPIO pin?

\$\endgroup\$
1
  • \$\begingroup\$ I'm doing a Revision 2 now and I've made that change. Would love to do it as a rework on a prototype I have, but I'm on leave and can only really make minor firmware adjustments until the new year. As long as 1 other person is thinking the same as me, I'm keen to give that a shot - so thanks for the suggestion :) I have experience with this happening on an STM32 (the wakeup button was on a separate PCB entirely, with a ~100mm cable running to it) and moving the capacitor (not the R, but both wouldn't hurt) close to the PCB fixed the issue. ESD (me standing up) was causing that one, though. \$\endgroup\$
    – DSWG
    Dec 15, 2019 at 13:17
0
\$\begingroup\$

Add a debounce function to the software.

Immediately after waking up from pin change interrupt, check the pin state through software. If it isn't steady low for a few ms, go to sleep again.

Most likely you can skip the whole RC stuff then.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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