7 Comments  →
   by Dost Muhammad Shah    7 Comments  →
' . get_the_title() . '

In this post I am writing how to send a GET request using GSM Module with AT commands. It should work with any module and has been tested to work with Sim800 series  (SIM800C-DS , SIM800ASIM800H, SIM800L, SIM800C, SIM800 etc) and Sim900 series (SIM900, SIM900A, SIM900D, SIM900B) of modules from simcom.

You have to bring up GPRS connection before this obviously , which is not covered here in this post.

 

HERE ARE THE STEPS TO MAKE GET REQUEST

Initiate the HTTP service

AT+HTTPINIT
> OK

Set the HTTP session.

AT+HTTPPARA=”CID”,1
> OK

Set the HTPP URL

at+httppara=”URL”,”google.com”

Start the session<

AT+HTTPACTION=0
> OK

> +HTTPACTION:0,601,0

The above AT response code (601) for HTTP session start indicates that there is a network error. Then make sure that the PDP context is setup properly.

IF the HTTP session is successful, it should return code of ’200′,

AT+HTTPACTION=0
> OK
> +HTTPACTION:0,200,4

Above HTTP GET request is sucessful and it returned 4 bytes.
To read the data of the HTTP server,

AT+HTTPREAD
> +HTTPREAD:4
> test
> OK

To terminate the HTTP service,

AT+HTTPTERM
> OK

UPDATE:

Sometimes a 601 Error code is received in response. @Bruno Lewin shared a link to a StackOverFlow Answer about the issue and I feel that I should include it here as well

 

Here are the minimum setup commands that have worked for me (based on trial/error and searching around on the internet).

AT+SAPBR=3,1,"APN","wap.cingular"
AT+SAPBR=1,1

The correct value for the APN may be different for you, depending on your network and service provider.

Status codes above 600 (and some in the 500 range) are unassigned in the HTTP standard. In the AT command manual for the SIM908, status meanings are given in the notes on the HTTPACTIONcommand:

600 Not HTTP PDU
601 Network Error
602 No memory
603 DNS Error
604 Stack Busy

You can query the bearer connection status of CID 1 with AT+SAPBR=2,1 and the related parameters with AT+SAPBR=4,1. You can also check that you’re attached to the GPRS network with AT+CGATT?. If everything indicates that you are connected and you are still getting a 601 status code, then check that your service plan has data and that it hasn’t run out. I have found that even when my account has a few hundred k of data showing on the balance that I start to get a 601 status until I add more data to my prepaid phone plan. If the SIM module has been on the whole time and you add more data, you’ll need to close and re-open your connection (AT+SAPBR=0,1 followed by AT+SAPBR=1,1) and then your HTTP* commands will start working again without having to set the HTTPPARA settings again and without having to restart with HTTPINIT.


2 Comments  →
   by Dost Muhammad Shah    2 Comments  →

If you have a PIN code enabled SIM card and want to remove /disable PIN code using AT commands follow these commands,
suppose 9546 is the current PIN code , Replace 9546 with your PIN code, >>> shows the response from modem.

AT+CPIN?
>>> +CPIN: SIM PIN // pin codes need to be entered
>>> OK

AT+CPIN="9546"
>>>; OK

AT+CLCK="SC",0,"9546" // disable pin code
>>> OK

AT+CPIN?
>>> +CPIN: READY

 


2 Comments  →
   by Dost Muhammad Shah    2 Comments  →

By default when you make a voice call Sim900 doesn’t send any response if the called party picks the call. Sometime its important to know if the other side is getting ring or has picked the call. In order to show the state we have to configure the module using the following AT Command

AT+MORING=1

After sending the is command if a number is dialed, a URC string “MO RING” will be received if the other mobile is alerted and “MO CONNECTED” will be received if the call is answered.