Setting the RAK12002 time with the RAK1910

Has anyone ever set this RTC using the RAK1910 in Arduino? I can’t seem to figure out how to go about doing this.

I am trying to create an interruption device that will be used to turn a device on & off at set intervals within a 1 minute period. I have included the RTC module in my design to ensure when multiple interrupters are used across a system, they are all using the same time from GPS to stay as synchronized as possible.

Currently using:

RAK19007

RAK11200

RAK1910

RAK12002

Hi @eliteiot ,

Our quick start guide for RAK1910 uses tinygps library. It has a crack_datetime function where you can get parsed date and time.

From there you can use rtc.setTime of RAK12002 to configure the time. You check how to do it on the RAK12002 quick start guide as well.

Btw, it appears you are using RAK11200 ESP32 WisBlock Core. If you just need the GPS to get time, you can also considered getting it from the cloud from NTP server. It can save you cost and works indoor (as long as it has wifi connection).

Hello! I also wrote such a program and I should note that with the help of
GPS and precise time module RAK12002 everything was very simple!
I read data from the RAK_ZOE_M8Q GPS receiver, then checked if the GPS was getting time data, then loaded it into the RAK_RTC clock.
The official page of Bernd Giesecke has very simple and good examples of how to do this.

#if RAK_ZOE_M8Q > 0
/***********************************/
  if (my_gnss.getGnssFixOk ())
    {
      byte fix_type = my_gnss.getFixType ();	// Get the fix type
      char fix_type_str[32] = { 0 };
      if (fix_type == 0)
	sprintf (fix_type_str, "No Fix");
      else if (fix_type == 1)
	sprintf (fix_type_str, "Dead reckoning");
      else if (fix_type == 2)
	sprintf (fix_type_str, "Fix type 2D");
      else if (fix_type == 3)
	sprintf (fix_type_str, "Fix type 3D");
      else if (fix_type == 4)
	sprintf (fix_type_str, "GNSS fix");
      else if (fix_type == 5)
	sprintf (fix_type_str, "Time fix");

      accuracy = (float) (my_gnss.getHorizontalDOP () / 100.0);
      satellites = my_gnss.getSIV ();
      MYLOG ("GNSS", "HDOP: %.2f ", accuracy);
      MYLOG ("GNSS", "SIV: %d ", satellites);

      // Getting time and date


#if RAK_RTC_ID > 0

      // Readjusting RTC
      if (fix_type > 0 && my_gnss.getTimeValid () == true
	  && my_gnss.getDateValid () == true)
	{
	  if (rtc.getMinute () != my_gnss.getMinute ()
	      || my_gnss.getHour () != rtc.getHour ())
	    {
	      // Clock synchronized with satellite time
	      rtc.setTime (my_gnss.getYear (), my_gnss.getMonth (),
			   my_gnss.getTimeOfWeek (), my_gnss.getDay (),
			   my_gnss.getHour (), my_gnss.getMinute (),
			   my_gnss.getSecond ());
	      // year, month, weekday, date, hour, minute, second
	      fixDateTime = true;
	    }
	}

#endif
2 Likes

Wow! Two great shares in one day.

Thanks a lot @renice123