[MMV] TCP Connection over GPRS using SIM900 and AT Commands | Vishnu’s Blogs

=> AT

<= AT /** This should come back. SIM900 default is to echo back commands you enter **/

<= OK /** This string should tell you all is well**/

=>AT+CPIN? /**This is to check if SIM is unlocked. This sample assumes unlocked SIMs**/

<= +CPIN: READY /** If your response contains this, then it means SIM is unlocked and ready**/

=>AT+CREG? /**This checks if SIM is registered or not**/

<=+CREG: 0,1 /**This string in the response indicates SIM is registered**/

=>AT+CGATT? /**Check if GPRS is attached or not**/

<=+CGATT: 1 /**A response containing this string indicates GPRS is attached**/

=>AT+CIPSHUT /**Reset the IP session if any**/

<=SHUT OK /**This string in the response represents all IP sessions shutdown.**/

=>AT+CIPSTATUS /**Check if the IP stack is initialized**/

<=STATE: IP INITIAL /**This string in the response indicates IP stack is initialized**/

=>AT+CIPMUX=0 /**To keep things simple, I’m setting up a single connection mode**/

<=OK /**This string indicates single connection mode set successfully at SIM 900**/

=>AT+CSTT= “APN”, “UNAME”, “PWD” /**Start the task, based on the SIM card you are using, you need to know the APN, username and password for your service provider**/

<= OK /**This response indicates task started successfully**/

=> AT+CIICR /**Now bring up the wireless. Please note, the response to this might take some time**/

<=OK /**This text in response string indicates wireless is up**/

=>AT+CIFSR /**Get the local IP address. Some people say that this step is not required, but if I do not issue this, it was not working for my case. So I made this mandatory, no harm.**/

<= xxx.xxx.xxx.xxx /**If previous command is successful, you should see an IP address in the response**/

=>AT+CIPSTART= “TCP” , “www.vishnusharma.com”, “80” /**Start the connection, TCP, domain name, port**/

<= CONNECT OK /**This string in the response indicates TCP connection established**/

=>AT+CIPSEND /**Request initiation of data sending (the request)**/

<= > /**The response should be the string “>” to indicate, type your data to send**/

=> xxxxxx /**Just type anything for now**/

=>#026 /**Now type the sequence #026. This tells the terminal.exe to send the hex code 0x1a (which is Ctrl+Z) to indicate end of data sending**/

<= xxxxxxxxxx /**You should get some response back from the server…it would generally be a complain that the request string was not valid…but that is a different subject…you have established the connection**/

/**To close the connection**/

=>AT+CIPSHUT /**Request shutting down of the current connections**/

<=SHUT OK /**Indicates shutdown successful**/

Source: TCP Connection over GPRS using SIM900 and AT Commands | Vishnu’s Blogs

[MMV] TCP Connection over GPRS using SIM900 and AT Commands | Vishnu’s Blogs was last modified: December 10th, 2017 by Jovan Stosic

SMS Tutorial: Syntax of the +CMGS AT Command in SMS Text Mode

In SMS text mode, the syntax of the +CMGS AT command is: (Optional parameters are enclosed in square brackets.)

+CMGS=address[,address_type]<CR>sms_message_body<Ctrl+z>

Before we discuss each of the parameters, let’s see an example that gives you some idea of how an actual command line should look like:

AT+CMGS=”+85291234567″,145<CR>This is an example for illustrating the syntax of the +CMGS AT command in SMS text mode.<Ctrl+z>

The address Parameter

The first parameter of the +CMGS AT command, address, specifies the destination address to send the SMS message to. Usually it is a mobile number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, “+85291234567”, “91234567”, etc. Note that the value passed to the address parameter should be a string, i.e. it should be enclosed in double quotes.

The address_type Parameter

The second parameter of the +CMGS AT command, address_type, specifies the type of the address assigned to the address parameter. Two values are commonly used. They are 129 and 145:

  • 129. It means the value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the value of address is an international number, a national number or a number of other types. Example addresses: “85291234567”, “91234567”.

  • 145. It means the value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. Example address: “+85291234567”.

As address_type is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the address_type parameter, which is:

  • 129 if the value of address does not start with a “+” character. For example, “85291234567”.

  • 145 if the value of address starts with a “+” character. For example, “+85291234567”.

http://www.developershome.com/sms/cmgsCommand.asp

SMS Tutorial: Syntax of the +CMGS AT Command in SMS Text Mode was last modified: December 13th, 2017 by Jovan Stosic