Dates and power outages

Hi guys. I'm a beginner and I'm working with ESP32. I need to make a program that captures the date and time, and that still manages to work with internet and power outages. I used the NTPClient to get the date via the internet (in the setup ()) and that date is passed to the RTC via the library "ESP32Time", when there is a drop in internet I can work with the dates and times, but when there is a drop and back from energy, dates stop working. Does anyone know what I can do? I searched and found nothing.

but when there is a drop and back from energy, dates stop working.

Please expand and explain

I simulate the power outage by removing the USB esp32 from the computer and putting it back. I also don't know if this is the best way to test this...

How are you powering the ESP32?

Is the RTC powered when the ESP32 is not?

...R

I use the ESP32 internal RTC and connect ESP32 via USB to the notebook, the RTC does not have a dedicated battery

filipekerplunk:
the RTC does not have a dedicated battery

You need to get one that does.

...R

is there any way to get dates and times and work with the power out and back, without a power supply to the RTC?

I don't think your testing procedure is valid. When you remove the USB connector, you have removed both power and the serial connection from the ESP32. I suggest you get a simple battery case which can hold four 1.5 v. batteries, and test your circuit standalone without the USB supplying power.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.