logo elektroda
logo elektroda
X
logo elektroda

ESP32: Distinguish Wake-Up by Button vs. Deep Sleep Using RTC Module

Dawidixxx 735 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19806057
    Dawidixxx
    Level 7  
    Hey hey ;) .
    I'm working on a small project where I need to distinguish if the esp was woken up by a button or a wakeup.
    My plan was to extract the time from the RTC module and compare it with a fixed wake-up time, I am looking for such a solution but cannot find one.

    The second solution is the circuit I already used Link . That is, a single state change on reset and a continuous signal on the pin, but I would like to solve this somehow in code rather than circuit.

    Does anyone know maybe a better solution or a version with an RTC clock would be good? I don't know much how to get the time out of it.
    Greetings Dawid
  • ADVERTISEMENT
  • #2 19806537
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #3 19806701
    Dawidixxx
    Level 7  
    8266 on d1 mini, will eventually be on the raw version, there are probably better solutions for this on 32
  • Helpful post
    #4 19809586
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #5 19809616
    Dawidixxx
    Level 7  
    This is a very cool idea, the program connects to the network to send data (when the button is called) and every 10 minutes to retrieve the data.
    However, it's also about detecting the click quite quickly (the circuit controls the servo), I guess I'll have to use this circuit though so that I have to hold the button down a bit longer while waiting for the effect, the program will detect that it has a signal on the pin during reset.

    Thank you for your help and good advice ;) it's a pity that in this module there is not some extra flag from this, or that the RTC time clears after preinit().
  • #6 19809832
    Anonymous
    Level 1  
  • #7 19809926
    Dawidixxx
    Level 7  
    To distinguish precisely whether the reset was triggered spontaneously or by the user. E.g. by a value in the RTC memory or if a wake-up was triggered. It's just a pity, as I read somewhere, that the RTC memory (I'm still referring to the built-in module here) is erased when the chip is booted up, although this probably already happens together with the reset.
  • ADVERTISEMENT
  • #8 19810052
    Anonymous
    Level 1  

Topic summary

The discussion revolves around distinguishing whether an ESP32 microcontroller was woken up by a button press or a scheduled wake-up using an RTC module. The user initially considered comparing the RTC time with a fixed wake-up time but sought a code-based solution rather than a circuit modification. Responses highlighted the importance of specifying the chip model, with suggestions to use an NTP client for accurate time retrieval if an external RTC is not available. The conversation also touched on the limitations of the built-in RTC memory, which may be erased upon boot, complicating the detection of the wake-up source. A link to an example of identifying reboot causes on the ESP32 was shared, although it noted limitations during deep sleep.
Summary generated by the language model.
ADVERTISEMENT