This article describes the AT command set for accessing internet using GPRS on SIM300 GSM modem. The SIM300 can only support 2G network with very low data rates, In this example i have used VODAFONE SIM card for accessing internet. 

Before you start accessing internet on SIM300 you need to make sure that,

  • Internet service is active on your SIM card.
  • The APN, username, password for accessing internet, It depends on your network operator, for vodafone and airtel the APN is "www" and username and password are blank. ( not sure about other networks)
  • You have an internet pack active or have some currency 

Attaching to GPRS service: 
First step is to enable the internet connection by issuing the command,

"AT+CGATT=1followed by"\r\n".

And similarly the command "AT+CGATT?"  will return the status of the internet connection  


Selecting the APN and the GPRS connection mode: 

Second step is to tell the SIM300 modem the APN or gateway which you will be using to connect to the mobile network by sending the command,

AT+CIPCSGP=1,"your APN name","username","password" followed by "\r\n"

ex: AT+CIPCSGP=1,"www" followed by "\r\n" for Vodafone network. 


Start the Task:

Start the task and activate the APN given in the previous command by issuing the command,

"AT+CSTT" followed by "\r\n"

And similarly the command "AT+CSTT?"  followed by "\r\n" should give you the APN name selected. 


Turn on the GPRS connection: 

Now you need to turn on the internet connection by issuing the command,

"AT+CIICR" followed by "\r\n 

This command if succesfully executed, changes the IPstatus to IP GPRSACT state 


Check if the IP address is allotted to the SIM300 modem: 

SIM300 will reply you with the IP address allotted to it by issuing the command,

"AT+CIFSRfollowed by "\r\n"

The modem will reply with some IP address like 10.132.36.243


Inform SIM300 how you will address the internet:

To communicate with any system we either need its IP address or the domain name. So issue the command,

"AT+CDNSORIP=1"  followed by "\r\nfor domain name addressing or

"AT+CDNSORIP=0"  followed by "\r\n"  for direct IP addressing


Select the prompt and enable status: 

Tell the modem to show a '>' symbol when it is ready to read data and enable the status replies like DATA SENT, etc by issuing the command,

"AT+CIPSPRT=1followed by "\r\n"  


Enable the header information: 

For reading data from the modem using microcontroller we need the data length and some indication of beginning of data, So tell the modem to add the header and data length before the start of the data by issuing the command,

"AT+CIPHEAD=1"  followed by "\r\n"  


Now since you know all the commands, let us access a page located on my website at http://raviyp.in/test/test.php

Make sure the "test.php" file permission is set to 755 (executable by the world). 


Establish communication with website or server:

To access a website we need to establish communication with its server, Do it with the following command,

AT+CIPSTART="tcp","raviyp.in","80"   followed by "\r\n"  

After the above command is issued the SIM300 will reply "CONNECT OK".  if connection was succesfull


Send data to server and tell it what you want to read from it:

Now after receiving "CONNECT OK", we can access the page on the server using the following command,

"AT+CIPSEND"  followed by "\r\n"   

Now you will receive a command prompt symbol '>' type the GET command 

GET /test/test.php HTTP/1.1  followed by "\r\n"   

host:raviyp.in followed by "\r\n\r\n"  And type Ctrl ^Z  or send the ascii code 0x1A(1Ah)  to send the command

...<Here the server will reply with the data>... 


Summarizing everything, here is the sequence, 

RDY
+CFUN: 1
+CPIN: READY
Call Ready
 
AT+CMGF=1
OK
 
AT+CGATT=1
OK
 
AT+CIPCSGP=1,"WWW"
OK
 
AT+CSTT
OK
 
AT+CREG? +CREG: 0,1
OK
 
AT+CIICR
OK
 
AT+CIPSTATUS
OK
STATE: IP GPRSACT
 
AT+CIFSR 10.65.242.196
 
AT+CDNSORIP=1
OK
 
AT+CIPSPRT=1
OK
 
AT+CIPHEAD=1

AT+CIPSTART="TCP","RAVIYP.IN","80"
OK
CONNECT OK
 
AT+CIPSEND
> GET /test/test.php HTTP/1.1
host:raviyp.in
SEND OK
 
+IPD331:HTTP/1.1 200 OK
Date: Wed, 11 Dec 2013 12:16:38 GMT
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8m DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Vary: Accept-Encoding,User-Agent
Content-Type: text/html
Transfer-Encoding: chunked
 
34
You have successfully accesed the page - RAVI PUJAR.
+IPD5:0 

Turn off the GPRS connection and close connection to server:

After the communication you can turn off the connection to server by sending, 

"AT+CIPCLOSE" followed by "\r\n"

the GPRS communication by sending,

"AT+CIPSHUT" followed by "\r\n"


 Also see: 

 




About the Author

is the author of this blog and is an Embedded systems design engineer by profession & Founder @ Valetron Systems Pvt Ltd


Email:This email address is being protected from spambots. You need JavaScript enabled to view it.

Find us on Google+

HIRE ME FOR YOUR PROJECT AS A FREELANCER

 

EasyEDA: Free Circuit Design Software

  • Easy Schematic Capture
  • Powerful Circuit Simulation
  • Online PCB design

Design Your Circuit and PCB here:

https://easyeda.com/editor

Cheap PCB Manufacturing

Electronic Components Online Store