Will this RTC work with ESP32?

Will this RTC work with the ESP32 WROVER?
RPI RTC CLOCK: Raspberry Pi - Real-Time Klokmodule (RTC), DS3231SN bei reichelt elektronik

I know there are different models but this schematic is really easy and understandable for me so i can use this in my own pcb instead of using the module

Its a DS3231 RTC so I’d suggest the RTClib.h library from adafuit.
Install it and try to compile one of its example sketches with the ESP32 board selected.

I think the library will work on an ESP32 (i find multiple examples online), but this one specific is listed as RTC for a raspberry pi, i think it should work as well on an ESP32 because the pins are the same and 3.3v signals but just asking to be sure

The ESP32 has a built in RTC.

That board is advertised as being for the raspberry pi mainly because of the connector that plugs directly onto the pi.

It “looses” time when disconnected to power, and it is really important for my device to have the correct time even without internet.

Can i “update” the time in the RTC or is the RTC “always” correct in time?

Was about to add to my previous post, be careful, often those have a capacitor or rechargeable battery instead of a coin cell battery. The battery can be added, but circuit modification may be needed to remove the capacitor/battery charge circuit.

That is why i am interested in the RTC from the link ( RPI RTC CLOCK: Raspberry Pi - Real-Time Klokmodule (RTC), DS3231SN bei reichelt elektronik)

It looks like a super simple schematic without a charging circuit so i assume it is “safe” to use with regular CR2032 batteries?

I’ve used DS3231 on ESP32 as early as maybe 2018 so hardware-wise there’s no problem. Just need to right library to drive it. The one you linked to is made to directly plug into RPI for convenience. I don’t know what was soldered to the back side. Could be a battery. Ask the seller.

Thanks for the replies, i have just bought one and i will try. How do i keep the time up to date? Can i get the internet time and store it into the RTC?

If you have an rpi, install some suggested scripts for DS3231. I’m sure you can find some by googling. Then the time will be set and all you need is reading from it on ESP32.

The DS3231 will not be connected to a Raspberry Pi, the ESP32 will be a standalone device and needs to have the correct time. I will read internet time from my server (no Raspberry Pi) but if the ESP32 doesn’t get internet, it still should have the correct time. As soon as i get internet it needs to “resync” to make sure the time is correct and maybe update the RTC time?

The ESp32 has WiFi capabilities along with having an internal RTC that works very well, many examples abound on how to get the time from a WiFI connection.

I am not using the WiFI but the ethernet W5500 module because the device needs to be able to get internet from a cable (some places don’t have wifi).

Even with the cable plugged in it could be that the internet is not working. In that case my ESP32 MUST have the correct time

I guess you’ll not be able to use the internet to get the correct time to set your RTC because you do not have WiFi is the supposition? You can get the correct time from the internet connection, WiFi or cabled.

It should have internet via the cable, but if internet is not working (router down, internet down etc) the ESP32 should keep the correct time from the RTC

If internet comes back online, my ESP32 will reconnect to internet (via cable) and resync the time from my server

the onboard RTC is designed for low current consumption, not high accuracy. its main function is waking up the ESP from sleep modes. the accuracy is on a par with a DS1307.

If your primary need is to conserve battery power, use the internal RTC. If your primary need is accuracy, get a DS3231. the one shown in the OP does not have 1PPS or other square wave modes.

Can you help me a bit here?

Why do i need 1PPS or square wave modes?

I don’t know if you do. I do, other people do. this information is for people who find this post while searching for ESP32 internal RTC.

I need it because I want to make an NTP server that runs off GPS, independent of the internet.

Well, i also have a gps module connected but i am not sure if i can rely on that, some devices will not get gps signal because they are put somewhere inside, than i guess getting time from a server via internet would me more reliable?