Using AT commands to get time from NTP server?

Hi,

Does anyone know how to send a request to a NTP server using AT commands with a SIM900?
I am using the iComSat GSM shield and have a simple sketch that allows me to send AT commands to the SIM900 using a terminal program.
My goal is to have the NTP server send my arduino a time-stamp that will allow me to update my RTC. Before I even attempt to write any code that has the arduino do this task automatically I would like to be able to do it myself using a terminal program and AT commands.
If anybody knows of any good resources/tutorials that may help would you be kind enough to post a link?

Just from looking at a few NTP time libraries (that work with an Ethernet shield) I realize that I need to send a data packet, but I am unsure of what AT command will let me do this.
Any help is much appreciated.

Does anyone know how to send a request to a NTP server using AT commands with a SIM900?

I didn't know that it can be done at all with AT commands. Do you have a link to the datasheet of the SIM900.

If it is possible the datasheet should describe how to send an UDP packet over the internet. The content of such packet can be reverse engineered from several time libs.

Here is a link to the SIM900 AT Command set: http://robokits.co.in/datasheets/SIM900_ATC_V1_00.pdf

and her is a link to an application note for the SIM900: http://www.svtehs.com/simcom/docs/SIM900_AN_TCPIP_V100.pdf

I just assumed that this was possible as the SIM900 has an AT Command AT+CLTS that is supposed to get a local timestamp; however it states that this command is network dependant and unfortunately it doesn't seem to work on the Rogers network.

Also I should let you know that there is a command to start a UDP connection (AT+CIPSTART=) that I can use to connect to a NTP server port 123. I have successfully made this connection. I would think that after that I would just use AT+CIPSEND to send a data packet. I guess what I don't know how to do is create the packet.

par. 3.1.2 gives an example of how to make an UDP connection...

Hmmm ok,
So I managed to establish a UDP connection to an NTP time server.
I just don't know what to send to the server. I have a feeling I'm going to be reading about packets and packet formats all night!
I am guessing after the connection is established I am basically sending a string of 1's and 0's? Does that sound about right?

I am guessing after the connection is established I am basically sending a string of 1's and 0's? Does that sound about right?

No, you should send binary data aka bytes.

In the page below a simple NTP sketch is presented, you can see what bytes to send and what to expect back (also binary data)

with sim900 you can update time from the cellular network automatically at startup ,

follow these steps,

AT+CLTS=1\r
AT+CENG=3\r

after this on every attachment with network you will get

*PSUTTZ: 2013, 2, 23, 8, 22, 51, "+16", 1

DST: 1

*PSUTTZ: 2013, 2, 23, 8, 22, 54, "+16", 0

DST: 0

and the local time stamp will be updated to local time
check by commandAT+CCLK?

Here is manual about SIM900 with NTP AT command

http://www.mt-system.ru/sites/default/files/documents/sim900_ntp_at_command_manual_v1.00.pdf

To get the NTP server I use the PSUTTZ data from AT+CFUN command. First at all I enable the PSUTTZ notification with AT+CLTS command.

You must secure the modem is registered into your operator network. In my case I applay AT+CREG? command and I check to get +CREG: 0,1. I try 3 times until reset the modem and try again.

The best result to get the time, after each power ON, is following this sequence:

AT+CREG? //Check if you modem is registeren into the your operator network.

//In my case I wait --> +CREG: 0,1

AT+CLTS=1 // enable the PSUTTZ notification

AT+CFUN=0 // set minimum functionality
AT+CFUN=1 // set full functionality

//I wait the PSUTTZ data that give the NTP server

I hope this may help you...

get time from network cable in arduino at 2560 mega