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.
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.
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?
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