Skip to content

SKU_TEL0089_SIM800H_GPRS_Shield_V1.0_Module_backUp

Angelo edited this page Sep 21, 2016 · 3 revisions

SIM800H GPRS Shield

Introduction

This is a GPRS/GSM Arduino expansion board developed by DFRobot. The capabilities of GPRS, DTMF, TTS speech all in one shield, operating frequency is EGSM 900MHz/DCS 1800MHz and GSM850 MHz/PCS 1900MHz. It also supports UCS2 encoding data and text data format directly which makes your robot could do TTS voice broadcast at any time. It supports DTMF, once the DTMF feature was enabled, press the keys during a call can be converted into character, and can be used for remote control. It is controlled by AT commands, you can launch its functions directly through computer serial port or Arduino board. The module was embedded with SIMCom's SIM800H chip with good stability. More updated feature could be refered to the description of the SIM800H chip. Meanwhile we also show some application of the SIM800H library, it can help you to get familiar with this shield in a easier way.

Specifications

  • Working voltage: 6 - 12V
  • Low power consumption mode: the current is 0.7mA ( sleep mode )
  • Normal consumption mode:(100mA@7V - GSM mode)
  • Quad-band 850/900/1800/1900MHz
  • GPRS multi-slot class 1~12
  • GPRS mobile station class B
  • Standard GSM phase 2/2+
  • Class 4 (2 W @ 850/900 MHz)
  • Class 1 (1 W @ 1800/1900MHz)
  • Control method: AT command control
  • USB/Arduino switch
  • Serial baud rate Adaptive
  • Support real time clock (RTC)
  • Support TTS and broadcast
  • Support DTMF
  • LED indicator shows power supply status, network status and operating mode
  • Size: 81*53mm

Pin out

center

Specification:

1 Compatibility

This shield is compatible with Arduino board like Arduino UNO, Arduino Mega1280 and Arduino Mega2560 (5V standard operating voltage).

2 Status light

PWR: Power indicator; NET: Net connect indicator:

  • Off - module are not working;
  • 64ms On/800ms Off - module are looking for net;
  • 64ms On/3000ms Off - module are connected with net;

3 Enable module button

Press the button for 2 seconds to boot/shut down module. Note: This button is connected to digital Pin 12, so you can also boot/shut down module by setting the Pin12 value.

4 USB/Arduino Switch

  • None: Push to this side when uploading sketch to Arduino board like Uno, Mega except the leonardo.
  • Arduino: communicate with Arduino through the sketch.
  • USB: communication with PC through the serial(USB cable).

5 mic&speaker channel

These socket and pin are used to play TTS and dialing. Note: You could change the TTS output channel with AT command. Default channel is channel 1.

Tutorials AT Mode

Note: It needs external power supply (6-12V) for the higher power consumption as the GSM mode.

How to enter into AT mode ?

1 Firmware connection Insert SIM800H module onto UNO or other controler, connect UNO with computer through USB cable, put the swith to USB set. 2 Enable module Press the button boot for 2 seconds OR upload follow sketch.

    void setup(){
        //Set pin 12 as output
        pinMode(12,OUTPUT);
        //GSM power on sequence
        digitalWrite(12,HIGH);
        delay(2000);
        digitalWrite(12,LOW);
    }
    void loop(){
    }

3 Choosing the right board and Serial port at arduino IDE menu bar. Open the serial monitor or other Serial Assistant software. Choosig"Both NL & CR". Wait for the net led to blink as finding net, then you could sent AT command. Other wise check the external power supply or SIM card and Reset. 500px

Typical AT command list

AT\r\n

Return: OK Description: AT test command, to check if you could enter AT mode.

ATA\r\n

Return: OK Description: answer the phone

ATH\r\n

Return: OK Description: Hang Up

ATD15982373181;\r\n

Return: OK Description: Make a call

====AT+CMGF=1\r\n ==== Return: OK Description: Set SMS format as text mode

====AT+CSCS="UCS2"\r\n ==== Return: OK Description: Set SMS format as UCS2 encoding

====AT+CMGS="00310038003600******0036003500340037"\r\n==== Return: > Description:The UCS2-BIG codes inside the quotation marks is the target phone number to send SMS. when you get ">" characters, enter the message you want to send, content encoding is UCS2 encoding (Set before), then tick the HEX to send, and send "0x1a" expressed as CTRL+Z (0x1A) to send SMS. ====AT+CMGR=1\r\n==== Return: +CMTI:........ Description: Read the message 1, the content "........" returned as text messages ====AT+CMGD=1\r\n==== Return: OK Description: Delete SMS of number 1 in memory.

====AT+CTTS=0\r\n ==== Return: OK Description: Stop the current broadcast

====AT+DDET=1\r\n==== Return: OK Description: Enable the DTMF function

Note:More AT command could be refered to AT command manual. Download AT command manual

Tutorials about Library Using

SIM800H Hardware Library SIM800H Arduino Library '''Hardware Connection ''' # Insert the SIM800H GPRS Shield onto UNO board;

  1. connect UNO to PC with USB cable;
  2. Use external power supply;
  3. Turn the switch to the "NONE";
  4. Open different sketch, select the right board "UNO" and "Srial port", upload sketch to the UNO;
  5. Turn the switch to "USB".

The sketches showing in the chapter are included in the library. thumb All sketch are in the library Note: When using the library, due to the incoming serial data is too large, the original Arduino serial cache buffer needs to be changed to be larger, there are two ways:

  1. Extract the hardware.zip, if your Arduino IDE is below 1.5.5 version, cut HardwareSerial.cpp to Arduino\hardware\arduino\cores\arduino and cover the original file. If it is version 1.5.5 or later, then cut the HardwareSerial.h to Arduino\hardware\arduino\cores\arduino and cover the original file.
  2. If your Arduino IDE is below 1.5.5 version, open the HardwareSerial.cpp file in the Arduino\hardware\arduino\cores\arduino, # define SERIAL_BUFFER_SIZE 64 to # define SERIAL_BUFFER_SIZE 140, If the version is 1.5.5 or later, open HardwareSerial.h file and do the same modifications.

Make a call

Open the sketch "Examples\sim800program\MakeVoiceCall" in Arduino IDE.

/*
Receive Voice Call

This sketch, for the Arduino SIM800H GPRS Shield,enable SIM800H Modular Caller ID, receives voice calls, get the
Answer.

created Dec 2014
by zcl

This example code is in the public domain.
*/

//libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug);

//the setup routine runs once when you press reset:
void setup()
{
    //initialize the digital pin as an output.
    pinMode(13,OUTPUT);
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
}

void loop()
{
 digitalWrite(13,HIGH);//turn the LED on by making the voltage HIGH
 delay(200);
 digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
 delay(200);
}

//application callback function
//Note that not too much to handle tasks in this function
void fundebug(void)
{
    //answer the call
    sim800demo.answerTelephone();
}

**Function description:**SIM800H module is initialized, and then dial the number 15982373181.

  1. Sim800Cmd sim800demo(fundebug); This function is to recognize incoming call, if there is an incoming call, it will call the fundebug(void) in the end. You could write something to deal with the incoming call: answer or not. But do remember that do not write too much lines in the sub-function.
  2. sim800demo.dialTelephoneNumber("15982373181;"); This function is making a dailing. Do not forget the format ";" behind the dail number.
  3. sim800demo.sim800init(); This function is to finish the initial module, it's much more easier than the last version product. AT command: ATDXXXXXXXXXXX;\r\n

Answer a incoming call

Open the sketch "Examples\sim800program\ReceiveVoiceCall " in Arduino IDE.

/*
Receive Voice Call

This sketch, for the Arduino SIM800H GPRS Shield,enable SIM800H Modular Caller ID, receives voice calls, get the
Answer.

created Dec 2014
by zcl

This example code is in the public domain.
*/

//libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug);

//the setup routine runs once when you press reset:
void setup()
{
    //initialize the digital pin as an output.
    pinMode(13,OUTPUT);
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
}

void loop()
{
 digitalWrite(13,HIGH);//turn the LED on by making the voltage HIGH
 delay(200);
 digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
 delay(200);
}

//application callback function
//Note that not too much to handle tasks in this function
void fundebug(void)
{
    //answer the call
    sim800demo.answerTelephone();
}

**Function description:**Answer incoming call if there were one.

  1. As you can see, we add something in the function fundebug(void). You could also replace it with "sim800demo.cancelCall()" to Decline the incoming call.

AT command: ATA\r\n

Recognize Call Number

Open the sketch " Examples\sim800program\DisplayCallNumber " in Arduino IDE.

// libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug1);

//phone number buffer
char str[15] = {'\0'};

//the setup routine runs once when you press reset:
void setup()
{
    //initialize the digital pin as an output.
    pinMode(13,OUTPUT);
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
    //enable SIM800H Modular Caller ID
    sim800demo.DisplayPhoneNumber(OPEN);
}

//the loop routine runs over and over again forever:
void loop()
{

}

//application callback function
//Note that not too much to handle tasks in this function
void fundebug1(void)
{
  //get the phone number
  sim800demo.getCallnumber(str);

  if(memcmp(str,"15982373181",11) == 0)
    sim800demo.answerTelephone(); //answer
  else
    sim800demo.cancelCall();//hangs up
}

**Function description:**Enable caller ID, if there is an incoming call, it will get the number firstly, then determine to answer or decline according to whether it was "15982373181".

  1. sim800demo.DisplayPhoneNumber(OPEN); This enable caller ID display, when there is an incoming call, it will get the phone number first. Replace "OPEN" with "CLOSE" to disable ID recognization. AT command: AT+CLIP=1\r\n

Receive DTMF Data

Open the sketch "Examples\sim800program\ReceiveDTMFNumber " in Arduino IDE.

/*
Receive DTMF Number

This sketch, for the Arduino SIM800H GPRS Shield,enable SIM800H Modular Caller ID, receives voice calls, get the
Answer,enable SIM800H Modular DTMF,get DTMF number.

created Dec 2014
by zcl

This example code is in the public domain.
*/

//libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug1 is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug1);

//the setup routine runs once when you press reset:
void setup()
{
    //initialize the digital pin as an output.
    pinMode(13,OUTPUT);
    //turn the LED off by making the voltage LOW
    digitalWrite(13,LOW);
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
    delay(1000);
    //enable DTMF
    sim800demo.setDTMFenable(OPEN);
    //registration fundebug2 function
    sim800demo.setDTMFHandlefunction(fundebug2);
}

//the loop routine runs over and over again forever:
void loop()
{

}

//application callback function,when Someone is calling,callback this function
//Note that not too much to handle tasks in this function
void fundebug1(void)
{
   sim800demo.answerTelephone();
}

//application callback function,when a DTMF data input,callback this function
//Note that not too much to handle tasks in this function
void fundebug2(void)
{
  char x = 0;
  //get DTMF data
  sim800demo.getDTMFresult(&x);

  if(x == '1')
    digitalWrite(13,HIGH); //turn the LED on by making the voltage HIGH
  else if(x == '0')
    digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
}

**Function description:**Enable DTMF function, if there is a telephone dialing, answer the phone, if there was DTMF data entry during the call, get it and go to selective statement, if it is '1', set Pin13 high, if it is '0', set low. **Note:**DTMF data could be undertand as the dial pad number you input when you are on line. This module would help translate it to digital number and send to Arduino board. So you could make a remote robot control.

  1. sim800demo.setDTMFenable(OPEN); This enables DTMF function.
  2. sim800demo.setDTMFHandlefunction(fundebug2); This will call subfunction "fundebug2" when there's DTMF data coming.
  3. sim800demo.getDTMFresult(&x); This will get DTMF data and translate it to char x. AT command: AT+DDET=1\r\n\r\n

Speech synthesis and broadcast

Open the sketch "Examples\sim800program\MakeTTSSpeak " in Arduino IDE.

/*
TTS Speaker

This sketch, for the Arduino SIM800H GPRS Shield,make Shield to speak.
Use UCS2 Code

created Dec 2014
by zcl

This example code is in the public domain.
*/

// libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo;

//the setup routine runs once when you press reset:
void setup()
{
  //initialize the digital pin as an output.
  pinMode(13,OUTPUT);
  //initialize SIM800H,return 1 when initialize success.
  while((sim800demo.sim800init()) == 0);
  delay(1000);
}

void loop()
{
  //set TTS parameters
  sim800demo.setTTSParameter(50,0,50,50,0);
  digitalWrite(13,HIGH);//turn the LED on by making the voltage HIGH
  //send data to speaker buffer use UCS2 and default speaker channel
  sim800demo.sendTTSUCS2Speak("0031002C5F00706FFF0C0030002C5173706F",UCS2);
  digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
  delay(3000);

  digitalWrite(13,HIGH);//turn the LED on by making the voltage HIGH
  //send data to speaker buffer use UCS2 and speaker channel 1
  sim800demo.sendTTSUCS2Compulsory("0031002C5F00706FFF0C0030002C5173706F",UCS2,1);
  digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
  delay(3000);
}

**Function description:**Set the TTS broadcast parameters, non-mandatory broadcast data, delay and then mandatory broadcast data.

  1. sim800demo.setTTSParameter(50,0,50,50,0); This is to set TTS parameters;
  2. sim800demo.sendTTSUCS2Speak("0031002C5F00706FFF0C0030002C5173706F",UCS2); Non-mandatory broadcast data, it means that this module will ignore it if it is broadcasting, but broadcast if the module is free.
  3. sim800demo.sendTTSUCS2Compulsory("0031002C5F00706FFF0C0030002C5173706F",UCS2,1); Mandatory broadcast data no matter what the broadcast state the module is. AT command:
  4. AT+CTTSPARAM=50,0,50,50,0\r\n
  5. AT+CTTS=1,6B228FCE4F7F75288BED97F3540862107CFB7EDF\r\n

Send SMS

Open the sketch "Examples\sim800program\SendSMS " in Arduino IDE.

/*
TTS Speaker

This sketch, for the Arduino SIM800H GPRS Shield,send a short message to telephone
After initialization success ,enable prompt SMS.

created Dec 2014
by zcl

This example code is in the public domain.
*/

// libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug);

//the setup routine runs once when you press reset:
void setup()
{
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
    delay(1000);
    //enable SMS prompt
    sim800demo.setSMSEnablePrompt(OPEN);
}
void loop()
{
    //send message to telephone,use UCS2 code
    sim800demo.sendSMS("00310035003900380032003300370033003100380031","4F60597DFF0C6B228FCE4F7F752800530049004D0038003000300048");
    //while, do not return
    while(1);
}

//application callback function
//Note that not too much to handle tasks in this function
void fundebug(void)
{
}

**Function description:**Enables SMS notification, send a text message.

  1. sim800demo.setSMSEnablePrompt(OPEN); This enables SMS notification;
  2. sim800demo.sendSMS("00310035003900380032003300370033003100380031","4F60597DFF0C6B228FCE4F7F752800530049004D0038003000300048"); This is to send a text message, the first parameter is a phone number, the second parameter is the content to be sent, both of these parameters is UCS2 encoding. Note: the text message cannot be longer than 20 characters, or saying 80 UCS2 encoding. AT command: AT+CMGS="00310038003600310036003300360036003500340037"\r\n

Integrated Application

Open the sketch "Examples\sim800program\sim800test " in Arduino IDE.

//libraries
#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug);

//return DTMF value
char rqt = 0;

//the setup routine runs once when you press reset:
void setup()
{
   pinMode(13,OUTPUT);
    //turn the LED off by making the voltage LOW
    digitalWrite(13,LOW);
    while((sim800demo.sim800init()) == 0);
    delay(1000);
    sim800demo.setSMSEnablePrompt(OPEN);
    //enable DTMF
    sim800demo.setDTMFenable(OPEN);
    //registration fundebug2 function
    sim800demo.setDTMFHandlefunction(fundebug2);
}

//the loop routine runs over and over again forever:
void loop()
{
  //calling
  if(rqt == 1)
  {
     rqt = 0;
     sim800demo.sendTTSUCS2Compulsory("003253D1900177ED4FE1FF0C00315F00706FFF0C00305173706F",UCS2);
  }
  else if(rqt == '3')
  {
    rqt = 0;
    sim800demo.sendTTSUCS2Compulsory("6B63572853D1900177ED4FE1",UCS2);
    delay(2000);
    sim800demo.cancelCall();
    delay(2000);
    sim800demo.sendSMS("00310035003900380032003300370033003100380031","4F60597DFF0C6B228FCE4F7F752800530049004D0038003000300048");
  }
  else if(rqt == '1')
  {
    rqt = 0;
    digitalWrite(13,HIGH);//turn the LED off by making the voltage LOW
    sim800demo.sendTTSUCS2Compulsory("706F5DF25F00",UCS2);
  }
  else if(rqt == '0')
  {
    rqt = 0;
    digitalWrite(13,LOW);//turn the LED off by making the voltage LOW
    sim800demo.sendTTSUCS2Compulsory("706F5DF25173",UCS2);
  }
}

//application callback function
void fundebug(void)
{
   rqt = 1;
   sim800demo.answerTelephone();
}

//application callback function
void fundebug2(void)
{
  //get DTMF data
  sim800demo.getDTMFresult(&rqt);
}

Function description:'''Initialize the SIM800H module, enable SMS notification, enable DTMF feature. If there is an incoming call, answer it and reset rqt to 1, voice broadcast, if there is any DTMF input, then assign it to rqt and then judge rqt for appropriate action.

'''AT command: AT+CMGS="00310038003600310036003300360036003500340037"\r\n'

Library Specification

Initialization part

  • Sim800Cmd (): constructor with no arguments, applies only to using the TTS feature, instead of GSM function;
  • Sim800Cmd (void (*pRf ()): the constructor with a pointer to function, applies to the TTS feature, and also enable GSM function;
  • sim800init (): SIM800H module initialization, complete a series of initial commands;
  • sim800open (): turn power on SIM800H;
  • sim800close (): power down the SIM800H.

TTS Language part

  • setTTSVolume (): set the volume parameter for 0~100;
  • setTTSSpeed (): set the broadcast speed rate, the argument is 0~100;
  • setTTSVmeSpd (): set the volume and speed simultaneously, the first parameter is volume, the second parameter is speed;
  • setTTSParameter (): set the TTS volume, mode, speed, tone, and channel parameters. Please refer to the previous AT instruction;
  • sendTTSUCS2Compulsory (char *_s, reModle_t _mdl): compulsory broadcasts, the first parameter is the content to be broadcast, the second is the mode;
  • sendTTSUCS2Compulsory (char *_s, reModle_t _mdl, char _chl): compulsory broadcasts, the first parameter is the content to be broadcast, the second is the mode, and the third is a broadcast channel;
  • sendTTSUCS2Speak (char *_s, reModle_t _mdl): non-mandatory broadcasts, the first parameter is the content to be broadcast, the second is the mode;
  • sendTTSUCS2Speak (char *_s, reModle_t _mdl, char _chl): non-mandatory broadcasts, the first parameter is the content to be broadcast, the second is the mode, and the third is a broadcast channel;
  • stopTTSSpeak (): stops the current broadcast;
  • getTTSState (): Gets the current broadcast status, if it is broadcasting, then return 1, otherwise return 0.

Dial part

  • callReadCSQ (UCHAR *PDA): get the current signal intensity, the *PDA is a buffer of return data, if the acquisition is successful, *PDA will be assigned a value, and the function returns 1, otherwise return 0;
  • getCallnumber (char *pnbr): get caller ID, *PDA is a buffer of return data;
  • DisplayPhoneNumber (reqmodle_t modle_t): turn on or off the caller ID, the argument is OPEN\CLOSE;
  • dialTelephoneNumber (char *_s): call *_s for the number strings, be sure about number followed by ";";
  • answerTelephone (void): answer the phone;
  • cancelCall (void): hang up the phone;

DTMF part

  • setDTMFenable (reqmodle_t modle_t): turn on or turn off the DTMF function, the argument is OPEN\CLOSE;
  • setDTMFHandlefunction (void (*pDf ()): registere DTMF callback function, it will callback pDf function when DTMF data is received;
  • getDTMFresult (char *PCH): get the DTMF data.

SMS part

  • setSMSEnablePrompt (reqmodle_t modle_t): open or close the SMS function, the argument is OPEN\CLOSE;
  • setSMSHandlefunction (void (*pDf ()): register message callback function when there are messages coming, callbacks to pDf function;
  • getSMSID (char *str): Gets the current message number in the register;
  • sendSMS (char *pnber, char *pData): send short messages, the first parameter is the number that is sent to, and the second argument is the data to be sent, remember that both are UCS2 encoding;
  • readSMS (char *PADR, char *pData): read short messages, the first parameter is the text number to be read, and the second parameter is the return data buffer;
  • deleteSMS (char *PADR): delete SMS, the parameter *PADR is the message number you want to delete.

String to UCS2 encoding

You can download the softeware "CharCoder"to transform the string to UCS2 encoding. Very easy! 800px

Download Source

hardware library sim800 library SIM800_Series_AT_Command_Manual_V1.07 SIM800H All documents Download schematic CharCoder

Clone this wiki locally