(Tutorial in the making, please check back after some time.) Sim800L supports General Packet Radio Service (GPRS) for connecting to the internet with HTTP. The module has built in TCP/IP stack that can be accessed with AT commands. This can be very handy for persistent data logging on low bandwidth networks. We will first use the AT commands to make a HTTP GET request to fetch a simple page and then use the library.
Going further I would also like to explore possibility of running MQTT, which is more suitable for low data rate and seamless logging. So lets get started.
Hook Up
The hook up will remain same as in previous tutorial.
We will also use the same basic code to send and receive commands to the module from the computer. These go through Arduino, so that we are assured that everything is setup properly.
Test AT commands
There are numerous AT commands that the module supports. These aren't well documented in the datasheet. I will list the bare minimum commands to setup and verify data connectivity of the SIM800L. Most of the libraries use these commands to set up the HTTP connection.
Here are a few things that you need to do before going further.
- Ensure that the SIM800L module and the Arduino Uno are setup exactly as shown above and the basic AT commands work.
- If it is a brand new SIM card, put it inside a phone first and check the data connectivity by opening up a simple webpage. It is easier to verify on the phone and enable data service if need be. This will eliminate one possibility some thing going wrong.
Command | Response | Description |
AT | OK | ping the module to see if its up! |
AT+CFUN=1 | OK | This enables full functionality of the modem. You can confirm the state of the modem by typing AT+CFUN? In fact you can do this to every command where you set parameters. Adding a question mark immediately after the command, returns the current value of that command. |
AT+CPIN? | +CPIN:READY | Check if the SIM card is ready to make calls, messages or to start the data packet transmission. |
AT+CSTT="airtelgprs.com","","" | OK | Access Point Name, User name and Password needs to be set before data connectivity can be established. Please use APN name of your SIM card provider. Note that for most service providers PIN and Password are not set. If your provider or you have set it up please this as well. |
AT+CIICR | OK | Start wireless connection with the GPRS. This sets up the wireless GPRS connection wiht the service provider and obtain a ip address |
AT Command Log
I used Bray Terminal to log the commands and their responses in the sequence above to fetch a hello.txt file from our wiki and this is how it looked!
Sample Code
Now let us do the same stuff with Arduino Code, will be using the Seeed GPRS library to do so. The code is also available in the library example.