Waking up ESP32 with DS3231 alarm

If doesn't fit into any other category ....
Post Reply
Zim
Posts: 289
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 265 times
Been thanked: 130 times

Waking up ESP32 with DS3231 alarm

Post by Zim »

Hi Gents
I am trying to implement a RTC to wake up a ESP32 from deep sleep. I see no example of setting an alarm available in the help file. Is it possible?

Thanks
Zim
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

Re: Waking up ESP32 with DS3231 alarm

Post by AndyGadget »

Looking at the DS3231 data sheet (https://www.analog.com/media/en/technic ... DS3231.pdf) wouldn't this just be a matter of connecting pin3 (INT/SQW) of the DS3231 (with a pullup) to one of the allowed pins on the ESP32 then issuing a SLEEP command. The DS3231 puts pin3 high when an alarm time is reached and wakes the ESP32.

(Just re-read your original question and see I've got the wrong end of the stick. Your question is about actually setting the alarms!)

From the help file :
To put the module in deep sleep the following command is available :
SLEEP value [, pin, level]
This command puts the ESP32 in deep sleep (low energy) for 'value' seconds.
At the end of the period, the unit will reboot and reload the default basic program.
Example
' Sleeps for 600 seconds (10 minutes)

Optionally, it is possible to wake up the module using an external signal sent on an input pin
In this case the pin and the level must be specified in addition to the time value.

Example
' Sleeps for 3600 seconds (1 Hour) or until the pin 32 goes to high
SLEEP 3600, 32, 1

Only RTC IO can be used as a source for external wake up.
They are pins: 0,2,4,12-15,25-27,32-39.
Level is 1 for wakeup on High and 0 for wakeup on Low
Zim
Posts: 289
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 265 times
Been thanked: 130 times

Re: Waking up ESP32 with DS3231 alarm

Post by Zim »

Hi AndyGadget
Sorry, my question wasn't detailed enough. I want to awaken the esp32 once every 24 hours. I would guess I would need an external trigger. The DS3231 apparently has the ability for adjustable alarm points. What I need is an example of how to set the 24 hour event in the DS3231 using annex. Its above my knowledge. I am not sure if it is even possible, but sure would be useful.

Thanks
Zim
Post Reply