Simplest way to make GET and POST request over GSM network.
SIM900 basic request library provides an easy way to communicate with your REST API or web service using the SIM900 GSM module and GET and POST requests.
This library also works on SIM900A but remember the SIM900A area restrictions!
You can run this library over all arduino boards, but it is almost obligatory to increase the Arduino Serial buffer (it's very easy, try it). The minimum recommended buffer size is 128kb, but it depends on your application requirements (bigger buffer allows bigger url and bigger requests).
I recommend to use 128KB buffer size for Arduino Uno (Atmega 328p) and 256KB for Arduno Mega (Atmega 2560).
Important!!
Serial buffer is stored in RAM memory. When you increase this buffer, the totally RAM available for our program decrements.
The Serial Buffer size restricts the maximum length of the url (host+path+url) and the size of the reply.
Maximum url length: MaxBufferSize - 25 Maximum reply size: MaxBufferSize - 36
It doesn't require any special action for install. Haven't you ever installed a library? Try it
You can make request in few lines of code. Check the library examples for more information.
Connection * SIM900 = new Connection( pinCode, apn, apnUser, apnPassword, enablePin, serialNumber );
SIM900->Configuration();
char * bodyReply = NULL;
SIM900->Get( host, path, url, headerHttpReply, bodyReply );
// Do something with bodyReply
delete bodyReply;
char dataToSend[] = {"temperature":20};
SIM900->Post( host, path, url, dataToSend, headerHttpReply );
The library isn't subjected to any particular SIM900 board/shield. You can configurate the board pin layout easily.
I tested the library in these boards:
Important!!
If your SIM900 shield wakes up at the same time as Arduino (it doesn't have any button or pin to wake up, like SIM900 MINI), it's necessary to wait at least 1000ms before run Configure() method. This is because SIM900 sends garbage data through Serial when it wakes up.
If your SIM900 board wakes up with the power button/pin or it is already running, this action is not necessary.
Released under MIT license.