I want to use an external 32kHz crystal for RTC with ESP32 S3, but I didn't see any example or tutorial for Arduino IDE, Even when I asked ChatGPT, it gave me some example but the code gave library errors. I don't understand why there is no RTC example in the Arduino IDE.

I have designed a PCB with this SCH for RTC. But I don't know how I can activate an external 32 KHz crystal with Arduino IDE. Please tell me how.

enter image description here


2 Answers 2


From the ESP32-S3 documentation in section 2.4.2:

ESP32-S3 supports an external 32.768 kHz crystal or an external signal (e.g., an oscillator) to act as the RTC sleep clock. The external RTC clock source is used to improve the timing accuracy and thus reduce the average power consumption, but will not affect the functionality.

This document also contains a schematic:

enter image description here

... it is assumed that the schematic in the question is that of the ESP32-S3-WROOM module accounting for the differences between the two schematics.

The wording in the document infers there is only a counter to track / control the processor's sleep state.

This is further enforced by this question / answer found in electronics.stackexchange.com:

The ESP32 RTC module only has a timer that runs even in hibernation mode as well as some RAM that it can retain in deep sleep mode...

... There's no "wall clock" or "calendar" in the ESP32 RTC module.

If still interested in implementing a "wall clock" using the ESP32-S3, the same stackexchange question / answer offers the following:

The ESP32 does not have a real time clock - you cannot tell it to wake up at a particular time. It does have a timer that can wake it from deep sleep after a given time.

You can use the deep sleep wake up timer like this:

esp_sleep_enable_timer_wakeup((uint64_t)sleepTimeSeconds * 1000000); esp_deep_sleep_start();

You set the sleep timer with esp_sleep_enable_timer_wakeup. The time period is in microseconds. With the timer set, the ESP32 will automatically wake up after the set time period.

Code will then have to be written to pull the last time from the ESP32-S3's nonvolatile memory, increment it by 1 second, store it back into nonvolatile memory and put the processor back to sleep for 1 second.


This is not a simple task: you have to recompile the Arduino core with the external RTC enabled.

Basically, you have to properly set the CONFIG_RTC_CLK_SRC option in kconfig file. You should start to read from here, and practising with ESP-IDF configurator.

I successfully completed this operation for the ESP32-S2 few years ago, but the procedure is very similar. Good luck.

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.