3
\$\begingroup\$

I am using SIM 900 modem to enable GSM connection wirh my product. Micro-controller Communicates with SIM900 modem through a SET AT commands over UART. My product is time critical and i need to have updated time even after power failure. To achieve this I am using inbuilt RTC of SIM900 modem. After each power ON I send following sequence to modem:

  • AT+CFUN=0
  • AT+CFUN=1

After this I am supposed to get +PSUTTZ string from modem which has timestamp in it and it indicated that modem has synchronized its time with network.After this after this I send AT+CCLK? command periodically to modem to read its RTC.

The problem is sometimes I does receive +PSUTTZ string from modem with some Service providers. With BSNL(in India) service provider I never able to get this string.

Anyone has Idea that how to make sure that +PSUTTZ will always receive without fail? (May be some different AT commands or something?)

\$\endgroup\$

4 Answers 4

3
\$\begingroup\$

One way to get current time is by sending a message to itself. Below is an example:

AT+CMGF=1
AT+CSCS="GSM"
AT+CMGS="0123456789" your phone number
THIS IS TEST test message
...
...
+CMTI: "SM",1 recevied a message at index:1
...
...
AT+CMGR=1
+CMGR: "REC UNREAD","0123456789","","14/11/15,15:03:13+22" got current time
THIS IS TEST

Sync your SIM900 with current time by
AT+CCLK="14/11/15,15:06:45+22"

For commands refer datasheet.

\$\endgroup\$
1
\$\begingroup\$

I researched this myself a while ago; you only get the message if your network provider chooses to send it, and many don't.

The only way to work out the time is to use the data connection to look up the time from a time server, and this is much more complicated than an AT command.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for pointing this out but Most of people in rural India wont afford GPRS cost.So I think now I have no choice except to set modem clock manually. \$\endgroup\$
    – Vagish
    Commented Jun 6, 2014 at 9:10
1
\$\begingroup\$

As others have mentioned the +PSUTTZ comes at the option of the network. One other option to get the current time is through the GSM Location and Time command AT+CIPGSMLOC. You will need to setup a GPRS connection, but I'm not sure this uses any data.

AT+SAPBR=3,1,"CONTYPE","GPRS"

OK
AT+SAPBR=3,1,"APN","your.apn.net"

OK
AT+SAPBR=1,1

OK
AT+SAPBR=2,1

+SAPBR: 1,1,"12.345.67.890"

OK
AT+CIPGSMLOC=2,1

+CIPGSMLOC: 0,2018/03/07,22:37:09

OK

This returns the UTC time at the tower you are connected to. There is some more information on pg 5 of the SIM900_GSM Location AT Command Manual

\$\endgroup\$
0
\$\begingroup\$

I've been looking at this over the last few days.

What I have been able to do is read the time into a number of strings, Year, Month, Day, Hour, Minute and Seconds. I also have one called Nu for the time zone but I don't use it.

It's not perfect at the moment but it's the best I've managed to get so far.

Not got the code to hand but it's basically

Send the at+cclk?\r Command to the sim900 (uppercase didn't seem to work)

Then read the serial data into the strings using parseInt command in a while loop.

I get two good reads, a delay then I get all 0's this continues. Not managed to work out what is happening yet but it's the closest I've been in a while.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.