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=1" followed 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+CIFSR" followed 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\n" for 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=1" followed 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,
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"
- Low cost RFID readers for purchase in India
- Low cost MOSFET high side driver or Load switch
- SIM300 SMS and Call Commands
- Low Cost Linux boards in India