SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about processor boards have here!
User avatar
By mcrobotics
#226105
While looking over the new Weather carrier board currently holding my ESP32 processor board I realized one of the components on there is a small battery for keeping an RTC alive "if the processor board has one." Looking at the schematic of the ESP32 processor board it seems like this is hooked up and should keep the RTC alive that's built in. After installing the ESP32Time library in the Arduino IDE I was able to execute the example and see that it indeed does have an RTC. I took this example and ran with it to make a short demo project where I can set the time over the serial monitor if I need to, otherwise it just loops and reports back what it is.

However whenever I reset the processor or dis/connect power I'm time traveling back to 1970 as if the battery isn't connected. Is it my sketch or something else fundamental I'm missing?

(Won't let me include the code for some reason, so here's the snippets that deal with the RTC)

ESP32Time rtc;

...

void loop()
{
...

Serial.println("CURRENT TIME:");
Serial.println(rtc.getTime("%A, %B %d %Y %H:%M:%S"));
}

// Doesn't seem to matter if I use a static date/time like below or input from the serial console, still gets lost on power cycle
// This is not called all the time, only on demand when formatted serial data is parsed and ready
set_time()
{
...
rtc.setTime(00, 14, 11, 21, 5, 2021); //May 21 2021, 11:14:00

}

Thanks!
User avatar
By adam.g
#226108
Hi @mcrobotics,

I haven't worked with the EPS32 before, but I'm not sure if it's actually capable of maintaining the time between power cycles. I found a similar discussion on the Espressif forums: https://esp32.com/viewtopic.php?t=1558

Looking at the schematics, the ESP32's VDD3P3_RTC is tied to 3.3V and it's not connected to the MicroMod RTC_3V pin.

Based on this, I'd say you're out of luck with using the battery to maintain the time. I'd suggest perhaps looking to using an NTP server to synchronize the clock when it powers up (if it has a WiFi signal available).

Cheers,
Adam
User avatar
By mcrobotics
#226110
Hi @adam.g

Thanks for the response. Yeah I see that now. Seems the ESP32 can 'run' off the RTC power line even when everything else is powered down according to that post. Guess it makes sense then that VDD3P3_RTC on the MM board is tied to the main 3.3v supply.

NTP is definitely an option, WiFi was the main driver to get this board (push the data to a Pi with a display in my house). :ugeek:
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum