Retrieve time and date time from ntp server by esp32 and sim800l

I am using esp32 with sim800L to update rtc in esp32 by parsing time and date from ntp.pool.org server.However, it works by using wifi what is solution of this problem.

here is code of using wifi in esp32:

Could you please clarify what your problem with your setup is and what do you want to do?

and Here is sim800l code with esp32:

You still haven’t really described your problem and what you want to do. In other words, if something does not work as you would expect, describe how it does not work.

However,

Serial.println(&currentTime, “%A, %B %d %Y %H:%M:%S”);

is probably not going to work for printing out a “struct tm” time. See maybe c - How to print time in format: 2009‐08‐10 18:17:54.811 - Stack Overflow for suggestions. You print currentTime.tm_mon elsewhere in your code, it probably works fine.

Although not probably your problem and it doesn’t clearly show from the code snippets if your code really does this, but the comment “Wait 10 seconds before syncing again with NTP” sounds worrying. You probably won’t need to sync your clock that often. I would consider something like 5 minutes minimum, but this depends on your use case and other factors.

Also note that this is not really a programmers’ forum. Your post might be more relevant on some embedded systems programming forum.

2 Likes

First, I am really appreciate your response as long as you clarify my inquires is in the wrong forum.
Although I am not put the output coming from serial monitor to show the response coming from sim800.
However, i need link of forum that I can post my issue and provide all requirements data to developer and programmers .

thanks in advance

English Forum - ESP32 Forum could be a good starting point. Some people there seem to have used SIM800L.

So you’re using something I’ve never heard about, and your code updates the hardware clock by aggressively polling the NTP pool constantly, and it works just fine over wifi, and you ask how to solve this problem.

You haven’t described a problem. You just described that it’s working.

1 Like

if you noticed my post I have provide two of communication of using Wi-Fi and the second using sim800L without Wi-Fi connection. However, in sim800 with esp32 doesn’t have ability to receive data from ntp pool org server while Wi-Fi is working perfect .

[quote=“shehabhassan, post:9, topic:3686, full:true”][quote=“Badeand, post:8, topic:3686, full:true”]
So you’re using something I’ve never heard about, and your code updates the hardware clock by aggressively polling the NTP pool constantly, and it works just fine over wifi, and you ask how to solve this problem.

You haven’t described a problem. You just described that it’s working.
[/quote]

if you noticed my post I have provide two of communication of using Wi-Fi and the second using sim800L without Wi-Fi connection. However, in sim800 with esp32 doesn’t have ability to receive data from ntp pool org server while Wi-Fi is working perfect .
[/quote]

So that sim thingy is cellular network? Like 4G/5G? And it only works over wifi, not over cellular?
Does anything else work over cellular, or is it just NTP?

Yes I use cellular rather then Wi-fi. At this point i have two task one for send and receive data through HTTPs another one is receive data from NTP server for update RTC IN ESP32

Does that other thing work over cellular?

no only i have mention before