Skip to content

Simplest way to make GET and POST request over GSM network with an Arduino and a SIM900 module

License

Notifications You must be signed in to change notification settings

mvento/SIM900-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIM900 Basic request library

Simplest way to make GET and POST request over GSM network.

Description

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!

Requirements

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.

Limitations

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

Installation

It doesn't require any special action for install. Haven't you ever installed a library? Try it

Using SIM900 library

You can make request in few lines of code. Check the library examples for more information.

Init:

Connection * SIM900 = new Connection( pinCode, apn, apnUser, apnPassword, enablePin, serialNumber );
SIM900->Configuration();

Get Request:

char * bodyReply = NULL;
SIM900->Get( host, path, url, headerHttpReply, bodyReply );
// Do something with bodyReply
delete bodyReply;

Post Request:

char dataToSend[] = {"temperature":20};
SIM900->Post( host, path, url, dataToSend, headerHttpReply );

SIM900 boards compatibility

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.

License

Released under MIT license.

About

Simplest way to make GET and POST request over GSM network with an Arduino and a SIM900 module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages