RTC not working (First time use) (Solved)

Hello,

I’m trying to use the RTC widget on my project, I’m running latest version of IOS, latest version of blynk app, latest server version and latest arduino IDE library. My problem is that I can’t read a real time, whenever I reset the wemos D1 mini pro, the time starts in 00:00

This is my code:


#define BLYNK_DEBUG

#define BLYNK_PRINT Serial

#include <SimpleTimer.h>

#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h>

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <TimeLib.h>
#include <WidgetRTC.h>

#define LED BUILTIN_LED

bool isFirstConnect = true;
char auth[] = "7147415706734becb602fac38b680ed4";
SimpleTimer Timer;
String muestraWifiyHora = " ";
int wifisignal;

WidgetTerminal terminal(V3);

WidgetRTC rtc;

void CheckConnectionProc()
{
  if (!Blynk.connected()) {
    if(Blynk.connect()) {
      Serial.println("Reconexion OK");
    } else {
      Serial.println("Reconexion no OK");
    }
  }
}

void calculaRSSIyReloj()
{
  wifisignal = map(WiFi.RSSI(), -105, -40, 0, 100);

  int gmthour = hour();
  if (gmthour == 24){
     gmthour = 0;
  }
  String hora =   String(gmthour, DEC);
  int horadigitos = hora.length();
  if(horadigitos == 1){
    hora = "0" + hora;
  }
  String minutos = String(minute(), DEC);
  int minutosdigitos = minutos.length();  
  if(minutosdigitos == 1){
    minutos = "0" + minutos;
  }  

  String reloj = hora + ":" + minutos;

  muestraWifiyHora = "          Señal: ";
  muestraWifiyHora = muestraWifiyHora + wifisignal;
  muestraWifiyHora = muestraWifiyHora + "%";
  muestraWifiyHora = muestraWifiyHora + "          Reloj: ";
  muestraWifiyHora = muestraWifiyHora + reloj;
  Blynk.setProperty(V3, "label", muestraWifiyHora);
}

BLYNK_CONNECTED()
{
  if (isFirstConnect)
  {
    Blynk.syncAll();
    isFirstConnect = false;
  }
}

void setup()
{
  Serial.begin(9600);

  WiFiManager wifi;
  wifi.autoConnect("Alarma Cueva"); 
  Blynk.config(auth, "lacueva2016.ddns.net");
  //Blynk.begin(auth, ssid, pass);

  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);

  rtc.begin();

  Timer.setInterval(5000L, calculaRSSIyReloj);
  Timer.setInterval(10000L, CheckConnectionProc);
}

void loop()
{
  Blynk.run();
  Timer.run();
}

This is the response in serial
0‚~?–4û!ƒ“’…OCAZþû*WM:
*WM: AutoConnect
*WM: Connecting as wifi client…
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.1.106
[3138]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.4.3 on Arduino

[3230] Free RAM: 41928
[3255] Cmd skipped:16
[5001] Connecting to lacueva2016.ddns.net:8442
[5055] <[02|00|01|00] 7147415706734becb602fac38b680ed4
[5065] >[00|00|01|00]È
[5065] Ready (ping: 4ms).
[5065] <[11|00|02|00]Gver[00]0.4.3[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]Arduino[00]build[00]Apr 22 2017 22:55:29[00]
[5179] <[10|00|03|00|00]
[5196] >[00|00|02|00]È
[5217] >[14|00|03|00|06]
[5244] >vw[00]4[00]0
[5371] >[14|1E]b[00|04]
[5371] >vr[00]2
[6374] >[14|1E]b[00|04]
[6374] >vr[00]2
[7374] >[14|1E]b[00|04]
[7374] >vr[00]2
[8278] <[13|00|04|00]33[00]label[00] Señal: 52% Reloj: 00:00

After 13 minutes:
[778278] <[13|00] [00]33[00]label[00] Señal: 58% Reloj: 00:12
[778287] >[00|00] [00]È
[778385] >[14|1E]b[00|04]
[778385] >vr[00]2
[779367] >[14|1E]b[00|04]
[779367] >vr[00]2
[780367] >[14|1E]b[00|04]
[780367] >vr[00]2
[781367] >[14|1E]b[00|04]
[781367] >vr[00]2
[782369] >[14|1E]b[00|04]
[782369] >vr[00]2
[783278] <[13|00]¡[00]33[00]label[00] Señal: 58% Reloj: 00:13



Do you see something wrong?
Thanks in advance!

@darkmoon will not work with 0.4.3 as the widget was changed at 0.4.4.

Upgrade to latest 0.4.7.

@Costas Sorry… when I check the arduino IDE version I think I was drinking something bad…

Thanks Costas!

1 Like

@Costas Well, still having same problem on new 4.7 version…

0‚~?–4û!ƒ“’…OCAZþû*WM:
*WM: AutoConnect
*WM: Connecting as wifi client…
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.1.106
[9632]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.4.7 on Arduino

[9724] Free RAM: 41848
[9749] Cmd skipped:17
[9773] Connecting to lacueva2016.ddns.net:8442
[9888] <[02|00|01|00] 7147415706734becb602fac38b680ed4
[9901] >[00|00|01|00|C8]
[9908] Ready (ping: 12ms).
[9937] <[11|00|02|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]Apr 22 2017 23:13:46[00]
[10078] <[10|00|03|00|00]
[10105] >[00|00|02|00|C8]
[10125] >[14|00|03|00|06]
[10153] >vw[00]4[00]0
[10177] >[14|1E]b[00|04]
[10204] >vr[00]2
[11170] >[14|1E]b[00|04]
[11170] >vr[00]2
[12169] >[14|1E]b[00|04]
[12169] >vr[00]2
[13170] >[14|1E]b[00|04]
[13170] >vr[00]2
[14170] >[14|1E]b[00|04]
[14171] >vr[00]2
[14772] <[13|00|04|00]33[00]label[00] Se[C3|B1]al: 61% Reloj: 00:00

Any other Idea?

Thanks!

Some Blynkers forget to add the RTC widget to their projects.

Notice you are using a WeMos but log states Arduino. Did you select the right board?

After some time seems that is working…
Do you know if is needed time to receive the correct time?

Thanks!

If you use the correct code in your sketch, per example, then time should update as soon as the connection is made.

Can I ask for the correct code?

Sketch Builder.

1 Like

No more questions sir