0

Setting Fona RTC?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Setting Fona RTC?

by sys_spud on Sun Aug 03, 2014 9:23 pm

Is there a real time clock implemented on the Fona? The SIM800 manual read command (AT+CCLK?) returns a time like: +CCLK: "04/01/01,01:06:25-28" ("yy/mm/dd,HH:MM:SS+/-TZ"), which is obviously wrong. The clock does seems to advance in later queries. I can't get the clock set command (eg., at+cclk="14/08/03,00:00:00-7") to work, returns ERROR.

Thanks!

sys_spud
 
Posts: 20
Joined: Sun Aug 31, 2008 9:34 pm

Re: Setting Fona RTC?

by adafruit2 on Tue Aug 05, 2014 10:24 am

we're actually not sure how it works - you can def get the time/date from the GPRS system but we're still trying to work out how the RTC works overall because even when powered and on the network it doesnt seem to set itself - if you figure it out please let us know! we have been focusing on phone/text/data for library support, so far!

adafruit2
Site Admin
 
Posts: 15222
Joined: Fri Mar 11, 2005 7:36 pm

Re: Setting Fona RTC?

by tonyz on Thu Aug 07, 2014 10:54 pm

Hi sys_spud,
To get the cellular network time from the SIM800's AT+CCLK? command Local Timestamp mode must be enabled at the time the module registers on the cellular network. (The network sets the initial RTC time during registration.)
By default the Local TImestamp mode of my SIM800 was disabled. You can check this with:
AT+CLTS?
You will get this if it is disabled:
+CLTS: 0
To enable it enter this:
AT+CLTS=1
CLTS=1 must be saved in the SIM800's nonvolatile memory so it will be enabled when the module powers up and registers on the network.
Since this setting is not automatically saved in nonvolatile memory, you must save it with:
AT&W
(This saves all writeable settings)
Now restart your SIM800
After it registers AT+CCLK? will respond with the correct time, as in my case:
+CCLK: "14/08/08,02:25:43-16"

regards,
Tony

tonyz
 
Posts: 2
Joined: Mon Jun 24, 2013 9:24 pm

Re: Setting Fona RTC?

by adafruit2 on Thu Aug 07, 2014 11:28 pm

oooh! thanks! that is really useful!

adafruit2
Site Admin
 
Posts: 15222
Joined: Fri Mar 11, 2005 7:36 pm

Re: Setting Fona RTC?

by adafruit_support_rick on Fri Aug 08, 2014 10:06 am

Added a link to TonyZ's post to the FONA FAQ

adafruit_support_rick
 
Posts: 34749
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Setting Fona RTC?

by oilburner on Tue Jun 23, 2015 3:05 pm

Tony! Thanks! (can't tell you how long I've been trying to get this working...)

G

oilburner
 
Posts: 1
Joined: Tue Jun 23, 2015 3:04 pm

Re: Setting Fona RTC?

by orchidz on Fri Jun 03, 2016 4:34 pm

TonyZ wrote:After it registers AT+CCLK? will respond with the correct time, as in my case:
+CCLK: "14/08/08,02:25:43-16"


Any idea how to convert to ISO 8601? like this: 2014-09-09T19:15:00.624Z

I'm reading a d18s20 temp sensor and want to publish the data somewhere via http post, but the post requires ISO 8601 timestamp.

orchidz
 
Posts: 1
Joined: Wed May 18, 2016 2:36 pm

Re: Setting Fona RTC?

by adafruit_support_rick on Sat Jun 04, 2016 9:59 am

parsing the fona time out to ymdhms should be pretty easy. Re-encode from there.

adafruit_support_rick
 
Posts: 34749
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Setting Fona RTC?

by CLEOEXAMEN153 on Thu Nov 24, 2016 7:40 am

TONYZ, good pm. Is your Solution to SIM800 compatible also to SIM808 regarding with issue on setting the RTC of FONA808? Thanks! Please reply as soon as possible

CLEOEXAMEN153
 
Posts: 2
Joined: Thu Nov 24, 2016 7:38 am

Re: Setting Fona RTC?

by tonyz on Thu Nov 24, 2016 10:48 pm

Hi CLEOEXAMEN153,
I haven't tried it on a SIM808, but I suspect it will work. The link to the AT Command Manual looks like it is the same as for the SIM800 (https://cdn-shop.adafruit.com/product-files/2637/SIM800+Series_AT+Command+Manual_V1.09.pdf).
good luck!
Tony

tonyz
 
Posts: 2
Joined: Mon Jun 24, 2013 9:24 pm

Re: Setting Fona RTC?

by CLEOEXAMEN153 on Fri Nov 25, 2016 3:04 am

Hello again TONYZ, i have tried already, but still it produces INCORRECT TIME. Anyway, do you have a code that can manually input AT commands on serial monitor so that I can debug/try it once more.

Or do you have any idea about getting REAL CLOCK TIME using ADAFRUIT FONA 808. Thanks!

CLEOEXAMEN153
 
Posts: 2
Joined: Thu Nov 24, 2016 7:38 am

Re: Setting Fona RTC?

by adafruit_support_rick on Fri Nov 25, 2016 9:49 am

Code to talk directly to fona for AT commands

Code: Select all | TOGGLE FULL SIZE
#include <SoftwareSerial.h>

SoftwareSerial fona = SoftwareSerial(2,3);  //substitute your rx and tx pins

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

void loop()
{
  if (Serial.available())
    fona.write(Serial.read());
  if (fona.available())
    Serial.write(fona.read());
}

adafruit_support_rick
 
Posts: 34749
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.