What happens if ArduinoCloud is not connected?

Hi all

Making a connected clock. It is working.

But one question: what value does ArduinoCloud.getInternalTime() return if there is no connection?

Any feedback welcome!

Michael

Hi @michaelwillems,
at connection time ArduinoCloud library stores the current timestamp in the hardware RTC. ESP8266 do not have an hardware RTC so value is stored in a library value and incremented using millis().

If there is no connection ArduinoCloud.getInternalTime() returns the value stored into the internal RTC. The library will try to sync the RTC value with NTP time every 24h to try to minimize RTC drift.

1 Like

Oh. But I also use a real time clock. See the project here, link below.

To correct that internal RTC, I update time from Arduino cloud every hour. That’s very often but it can’t do any harm, I suppose.

1 Like

Hi Michael, great work, great clock.
I am working with Arduino Opta, and have to report events with an exact date and time.
I have been trying with Arduino Cloud.

First of all, getInternalTime() returns the epochtime (unixtime), no matter the connection is working. If your arduino is not connected, the internal RTC continues working.

But I have several problems with Arduino Cloud:

  • I am not able to set the time zone (utcOffset). I tried with:
    int utcOffset = 1;   // Madrid
    time_t seg = time(NULL);
    set_time (seg + 3600 * utcOffset);
    seg = time(NULL);
    Serial.print(ctime (&seg));

... but only will work until March 31, 2024, when utcOffset will be 2 instead 1.
I put the coordinates:

double  Lat=40.4165;
double  Long=-3.70256;
coordinates = {Lat, Long};  // Madrid

... hoping that ArduinoCloud would apply the time zone automatically, but it does not work. With www.worldtimeapi.org API I did not have these problems.

  • The second problem with ArduinoCloud is that my system works great only if the connection is working. But if connection is broken, ArduinoCloud.update() takes 15 seconds to respond, and the system stops working correctly.

Thanks for the reaction.

Re not connected: Oof. That is worrying.

I have not even tried that. At the very least then, I’ll need to check that wifi is on benefit I try to update. And that’s a stopgap only.

OK I’ll try. Thanks for the warning.

M

Have you tried, something like this?

  if (ArduinoCloud.connected())
  {
    ArduinoCloud.update();
  }

Have you tried, something like this?

  if (ArduinoCloud.connected())
  {
    ArduinoCloud.update();
  }

Yes, I have tried, and does not work. In my case, ArduinoCloud.connected() blocks the execution until the watchdog resets my arduino Opta. I have to say that the connection is carry out using an ethernet cable, and the system works great, until the cable is disconnected.

It works for me, but you`re right I disabled ArduinoCloud watchdog :

ArduinoCloud.begin(ArduinoIoTPreferredConnection, false);

Very nice and well made. However, I have a suggestion, I think its a good practice to add ~ 1000uF / 100nF powers supply bypass capacitors at +5V and +3V3 rails, close to ESP32, for a stiffer and more reliable power source for ESP32s chip high current peaks..
Cheers!

1 Like

Yes, I usually do add those.

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