This is a very low cost and simple Arduino GSM and GPRS shield. We use the module SIMCom SIM900 . It’s the cheaper module now available in the market. The module is not simple to mount by an hobbyst, so we use the Breakboard TDGGSM_900 that we presented here .
You can buy the GSM module premounted here .
This is the GSM_shield library documentation:
Here is a GSM_shield Library intended for GSM Shield by Futura Elettronica (www.futurashop.it).
This Library is derived from Hwkitchen’s GSM Library http://www.hwkitchen.com and include the NewSoftSerial library to communicate using the pin 4 (RX) and 5 (TX).
You can also use the pin 0 and 1 (RX and TX) but you must disconnect the module to upload the sketch (so it’s not very nice), and you must modify the library.
How install the library for Arduino
After downloading of the GSM_Shield Library unzip the GSM_Shield folder to Arduino
Folder\libraries\ (es. C:\Programs\arduino-0022\libraries\GSM_Shield)
In the GSM_Shield.zip you can find the library to communicate with gsm module and the file for use the NewSoftSerial.
Basic description
GSM_Shield library is created as standard class with the Gsm_Shield.cpp and Gsm_Shield.h source files. GSM_Shield class is based mainly on the serial communication
between the Arduino board and the GSM module placed on the GSM Shield. There are used standard AT commands for the communication with the GSM Module.
The Current version of library uses blocking version of communication.
It means that the program is blocked until the communication function is finished – so until required data are sent and required answer is received. The Advantage of that blocking approach is that it is easy to
understand the program flow. On the other hand there is also disadvantage that we can’t use the processor resources in the time when the program just waits for the incoming data.
Note: please pay attention to serial communication mode. With the serial hardware (pin 0 and 1) you can reach the default baudrate of the module SIM900 (115200). But if you use the pin 4 and 5 the NewSoftSerial library can’t support (receive) the baudrate, so you must chose a lower baudrate.
With the command TurnOn(baudrate) you turn on the module and fix the baudrate. e.g. TurnOn(9600);
Methods
There are described important functions for the end user in this document.
The GSM_Shield Library contains also some functions that are used internally
and are not described in the document. It is also possible to use these
functions by the end user of course as they are defined as public but there
To connect this module to Arduino we make a PCB that include a LM317 some capacitor filter and no more.
The LM317 give to module about 3.9V.
There is a switch to select the way to communicate with Arduino:
– throw serial hardware (pin 0 and 1)
– throw serial software (pin 4 and 5)
is needed to check the library source code with notes.
int LibVer(void)
returns library version in format XYY -it means X.YY (e.g. 100 means vers. 1.00)
Sample: GSM_Shield_LibVer
void TurnOn(baud)
turns on the GSM module in case module is off and sends some initialization AT commands which are possible to send before registration -> InitParam(PARAM_SET_0)
Should be used at the beginning of the sketch in the setup() function.
Set also the module baudrate (Note: if you use the hardware serial, there are no limit to the baudrate, 115200 is possible. But using the pin 4 and 5 the NewSoftSerial must be use and the baud limit is 57600).
baud value possibile: 4800, 9600, 19200, 38400, 57600, 115200(no use with this library which include NewSoftSerial)
void setup()
{
gsm.TurnOn(9600);
}
Sample: GSM_Shield_LibVer
void InitParam(byte group)
Sends parameters for initialization of GSM module
group: 0 – parameters of group 0 – not necessary to be registered in the GSM
AT&F
1 – parameters of group 1 – it is necessary to be registered
AT+CLIP=1
AT+CMEE=0
AT+CMGF=1
Sample: GSM_Shield_LibVer
void Echo(byte state)
Function to enable or disable echo
Echo(1) enable GSM echo mode
Echo(0) disable GSM echo mode
Sample: GSM_Shield_LibVer
byte CheckRegistration(void)
checks if the GSM module is registered in the GSM net.
This method communicates directly with the GSM module in contrast to the method IsRegistered() which reads the flag from the module_status
(this flag is set inside this method)
must be called regularly at the one place in the main sketch loop
(recommendation repeat time is from 1sec. to 10 sec.)
return values:
REG_NOT_REGISTERED – not registered
REG_REGISTERED – GSM module is registered
REG_NO_RESPONSE – GSM doesn’t response
REG_COMM_LINE_BUSY – comm line is not free
Sample: GSM_Shield_Reg
byte IsRegistered(void)
returns flag if the GSM module is registered in the GSM net
this method does not communicate directly with the GSM module,
just reads the flag so it is very fast unlike CheckRegistration()
which takes more than 20msec.
it is recommended to use this function everytime it is necessary to use some GSM function which needs GSM module is registered – checking ingoing SMSs, checking calls etc.
return values:
0 – not registered
>0 – GSM module is registered
Sample: GSM_Shield_Reg
byte CallStatus(void)
checks call status
return values:
CALL_NONE – no call
CALL_INCOM_VOICE – incoming voice call
CALL_ACTIVE_VOICE – active voice call
CALL_NO_RESPONSE – no response
byte CallStatusWithAuth(char *phone_number, byte first_authorized_pos, byte last_authorized_pos)
checks status of call(incoming or active) and makes authorization with specified SIM positions range
parameters and return values:
phone_number: a pointer where the tel. number string of current call will be placed so the space for the phone number string must be reserved
first_authorized_pos: initial SIM phonebook position where the authorization process starts
last_authorized_pos: last SIM phonebook position where the authorization process finishes
Note(important):