GPS_GPRS_GSM_Module_V2.0__SKU_TEL0051_-DFRobot

Introduction

This is a GPS/GPRS/GSM shield from DFRobot. This shield with a Quad-band GSM/GPRS engine works on frequencies EGSM 900MHz/DCS 1800MHz and GSM850 MHz/PCS 1900MHz. It also supports GPS technology for satellite navigation. It's possible for your robot and control system to send messages and use the GSM network.

It is controlled via AT commands(GSM07.07 ,07.05 and SIMCOM enhanced AT Commands). And the design of this shield allows you to drive the GSM & GPS function directly with the computer and the Arduino Board. It includes a high-gain SMD antenna for GPS & GSM.

This GPS/GPRS/GSM shield uses an embedded SIM548C chip from SIMCom.Featuring an industry-standard interface and GPS function, the combination of both technologies allows goods, vehicles and people to be tracked seamlessly at any location and anytime with signal coverage.

Specification

Board Overview

GPS/GPRS/GSM Module V2.0 (SKU:TEL0051) More details about switches:

Tutorial

Requirements

it is recommended you to supply 7~12v power via the power jack. When using the GSM mode, the module requires an external power. But the power consumption is not high,just 200mA@7v, when calling. Module driver pin jumpers: Applying the Module Pin Jumpers(J10-J12) will allocate Pin 3,4,5 for driving the module. Removing the jumpers will release the above Pins, and you could connect the driver pins to the other digital pins on your board to avoid the pin conflict.

Connection Diagram

Hardware Connection photo:
TEL0051 Hardware connection

Prepare for Driving the GSM mode

Following the steps included in the sketch below first! The Sketch for GSM mode:

// #
// # Editor     : Lauren from DFRobot
// # Date       : 23.05.2012
// # E-Mail : Lauren.pan@dfrobot.com

// # Product name: GPS/GPRS/GSM Module V2.0
// # Product SKU : TEL0051
// # Version     : 0.1

// # Description:
// # The sketch for driving the gsm mode via the USB interface

// # Steps:
// #        1. Turn the S1 switch to the EN(right side)
// #        2. Upload the sketch to the Arduino board
// #        3. Turn the S1 switch to the communication mode(left side)
// #        4. Turn the S2 switch to the USB side(left side)
// #        5. send AT commands via the Arduino Serial monitor

// #        wiki link- https://www.dfrobot.com/wiki/index.php?title=GPS/GPRS/GSM_Module_V2.0

byte gsmDriverPin[3] = {
  3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!


void setup(){
  InitGsmMode();
}

void InitGsmMode(){
  //Init the driver pins for GSM function
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }

  digitalWrite(3,LOW);//Enable the GSM mode
  digitalWrite(4,HIGH);//Disable the GPS mode
  //Output GSM Timing
  digitalWrite(5,HIGH);
  delay(1500);
  digitalWrite(5,LOW);
}

void loop(){
  delay(100);
}

How to drive the GSM Mode via USB port

1.If your module works, the indicator LEDs beside the switch S2 will light up, this means that the module is running correctly. The LED marked "NET" is used to drive a network status indication LED. The working state of this LED is listed below.
2.Send the AT commands to the module by using Coolterm(or use the Arduino serial monitor).

 Note: If you want to program the Arduino, please disconnect the coolterm to release the communication port.

Network indication

State The GSM part of SIM548C function
Off The GSM part of the module is not running
64ms On/ 800ms Off The GSM part of the module does not find the network
64ms On/ 3,000ms Off The GSM part of the module found the network
64ms On/ 300ms Off GPRS communication

Serial communication

Default baudrate: 9600 Please do some settings as #Recommended settings before connection.If have trouble sending Ctrl+Z, please refers to #Ways to send Ctrl +Z in Coolterm Serial monitor

GSM module signal strength test

Signal strength test with on-chip antenna: Sending AT command for signal quantity report AT+CSQ through serial port terminal application, will receive signal strength as below.

GSM module signal strength test with on-chip antenna

The returned data “15,0”, the first value “15” means the signal strength is:

Value Signal Strength
0 -113dBm or less
1 -111dBm
2~30 -109~-53dBm
31 -51dBm or greater
99 not know or not detectable

The later value “0” means channel bit error rate.

Signal strength test with external antenna:
GSM module signal strength test with external antenna

Types of AT commands and responses

  1. AT+=? : Test command

    The mobile equipment returns the list of parameters and value ranges set with the corresponding Write command or by internal processes.
  2. AT+? : Read command

    This command returns the currently set value of the parameter or parameters
  3. AT+=<..> : Write command

    This command sets the user-definable parameter values.
  4. AT+ : Execution command

    This execution command reads non-variable parameters affected by internal processes in the GSM engine

Commonly used AT commands

  1. AT : Test the serial communication.if it works,get "ok" as the picture show.
  2. ATD; : Dial a number
  3. ATA : Answer an incoming call
  4. ATH : Disconnect existing connection
  5. AT+UART : Configure dual serial port mode
  6. AT+CSQ : Signal quality report
  7. AT+CMGF : Select sms messages format
  8. AT+CMGS : Send sms message
    1. After you input the sms, press 'ctrl-z'[HEX:0x1A]to send the message.
    2. Press 'ESC' to quit without sending.
  9. AT+CNMI : New sms message indications
  10. AT+CLVL : Loud speaker volume level
  11. AT+CRSL : Ringer sound level
  12. AT+CMIC : Change the microphone gain level

For more detail AT commands, please check the document here!

Prepare for Driving the GPS mode

The hardware requirements:

  1. Arduino Uno
  2. GPS/GPRS/GSM Module V2.0
  3. External power supply via the power jack

We recommend you to supply 7~12v power via the power jack. When using the GPS mode, the module requires an external power. But the power consumption is not high, just 200mW@3.3V

Module driver pin jumpers: Applying the Module Pin Jumpers(J10-J12) will allocate Pin 3,4,5 for driving the module. Removing the jumpers will release the above Pins,

How to drive the GPS Mode via USB port

1.After turn switch s3 on (the right side), the GPSPWR led will be lit.
2.In this mode, switch s2 is on left side. The GPS module communicates directly with PC. The serial port terminal application will show the data sent out by GPS module.
The Sketch for GPS USB mode: Following the steps included in sketch below first!

// #
// # Editor     : Lauren from DFRobot
// # Date       : 23.05.2012
// # E-Mail : Lauren.pan@dfrobot.com

// # Product name: GPS/GPRS/GSM Module V2.0
// # Product SKU : TEL0051
// # Version     : 0.1

// # Description:
// # The sketch for driving the gps mode via the USB interface

// # Steps:
// #        1. Turn the S1 switch to the EN(right side)
// #        2. Upload the sketch to the Arduino board
// #        3. Turn the S1 switch to the communication mode(left side)
// #        4. Turn the S2 switch to the USB side(left side)
// #        5. Turn the S3 switch to the ON side(right side)
// #        5. get the information from the module via the Arduino Serial monitor(baud rate:4800)
// #        For more detail information, please check the product wiki page.~.

// #        Wiki link - https://www.dfrobot.com/wiki/index.php?title=GPS/GPRS/GSM_Module_V2.0

byte gsmDriverPin[3] = {
  3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!


void setup(){
  InitGpsMode();
}

void InitGpsMode(){
  //Init the driver pins for GSM function
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }
  digitalWrite(3,HIGH);//Disable the GSM mode
  digitalWrite(4,LOW);//Enable the GPS mode
}

void loop(){
  delay(1000);
}

Serial communication Default baudrate: 4800 Coolterm (or Arduino serial monitor) is the recommended serial port terminal application. After serial port is successfully connected with PC in Coolterm, GPS module will send out data continuously as below:
Serial monitor in GPS mode via USB port

For location of the data received, please refer to Location Mapping (GPRMC)

How to drive the GPS Mode via Arduino board

  1. After turn switch s3 on (the right side), the GPSPWR led will be lit.
  2. In this mode, switch s2 is on right side. The GPS module communicates with Arduino board, and Arduino board communicates with PC. The serial port terminal application will show preliminary processed data from Arduino board, which gets the data from GPS module.

*The Sketch for GPS mode via Arduino board: *Following the steps included in sketch below first!

// #
// # Editor     : Lauren from DFRobot
// # Date       : 23.05.2012
// # E-Mail : Lauren.pan@dfrobot.com

// # Product name: GPS/GPRS/GSM Module V2.0
// # Product SKU : TEL0051
// # Version     : 0.1

// # Description:
// # The sketch for driving the gps mode via the Arduino TTL interface

// # Steps:
// #        1. Turn the S1 switch to the EN(right side)
// #        2. Upload the sketch to the Arduino board
// #        3. Turn the S1 switch to the communication mode(left side)
// #        4. Turn the S2 switch to the Arduino side(right side)
// #        5. Turn the S3 switch to the ON side(right side)
// #        5. get the information from the module via the Arduino Serial monitor(baud rate:4800)
// #        For more detail information, please check the product wiki page.~.

// #        wiki link - https://www.dfrobot.com/wiki/index.php?title=GPS/GPRS/GSM_Module_V2.0

byte gsmDriverPin[3] = {
  3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!


void setup()
{
  InitGpsMode();//Init the module to the GPS mode

  Serial.begin(4800);//Init the serial baudrate
  Serial.println("$GPGGA statement information: ");
}

void InitGpsMode(){
  //Init the driver pins for GSM function
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }
  digitalWrite(3,HIGH);//Disable the GSM mode
  digitalWrite(4,LOW);//Enable the GPS mode
}

void loop()
{
  while(1)  //get the GPS datas and print them to the Arduino Serial monitor
  {
    Serial.print("UTC:");
    UTC();
    Serial.print("Lat:");
    latitude();
    Serial.print("Dir:");
    lat_dir();
    Serial.print("Lon:");
    longitude();
    Serial.print("Dir:");
    lon_dir();
    Serial.print("Alt:");
//    altitude();
    Serial.println(' ');
    Serial.println(' ');
  }
}


double Datatransfer(char *data_buf,char num)//convert the data to the float type
{                                           //*data_buf:the data array
                                            //the number of the right of a decimal point
  double temp=0.0;
  unsigned char i,j;

  if(data_buf[0]=='-')//
  {
    i=1;
    //process the data array
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);
    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);
    //convert the int type to the float type
    for(j=0;j<num;j++)
      temp=temp/10;
    //convert to the negative number
    temp=0-temp;
  }
  else//for the positive number
  {
    i=0;
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);
    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);
    for(j=0;j<num;j++)
      temp=temp/10 ;
  }
  return temp;
}

char ID()//Match the ID commands
{
  char i=0;
  char value[6]={
    '$','G','P','G','G','A'    };//match the gps protocol
  char val[6]={
    '0','0','0','0','0','0'    };

  while(1)
  {
    if(Serial.available())
    {
      val[i] = Serial.read();//get the data from the serial interface
      if(val[i]==value[i])   //Match the protocol
      {
        i++;
        if(i==6)
        {
          i=0;
          return 1;//break out after get the command
        }
      }
      else
        i=0;
    }
  }
}

void comma(char num)//get ','
{
  char val;
  char count=0;//count the number of ','

  while(1)
  {
    if(Serial.available())
    {
      val = Serial.read();
      if(val==',')
        count++;
    }
    if(count==num)//if the command is right, run return
      return;
  }
}

void UTC()//get the UTC data -- the time
{
  char i;
  char time[9]={
    '0','0','0','0','0','0','0','0','0'
  };
  double t=0.0;

  if(ID())//check ID
  {
    comma(1);//remove 1 ','
    //get the datas after headers
    while(1)
    {
      if(Serial.available())
      {
        time[i] = Serial.read();
        i++;
      }
      if(i==9)
      {
        i=0;
        t=Datatransfer(time,2);//convert data
        t=t+80000.00;//convert to the chinese time GMT+8 Time zone
        Serial.println(t);//Print data
        return;
      }
    }
  }
}
void latitude()//get latitude
{
  char i;
  char lat[10]={
    '0','0','0','0','0','0','0','0','0','0'
  };

  if( ID())
  {
    comma(2);
    while(1)
    {
      if(Serial.available())
      {
        lat[i] = Serial.read();
        i++;
      }
      if(i==10)
      {
        i=0;
        Serial.println(Datatransfer(lat,5),5);//print latitude
        return;
      }
    }
  }
}
void lat_dir()//get dimensions
{
  char i=0,val;

  if( ID())
  {
    comma(3);
    while(1)
    {
      if(Serial.available())
      {
        val = Serial.read();
        //Serial.println(val,BYTE);//print dimensions
        Serial.println(val);//print dimensions
        i++;
      }
      if(i==1)
      {
        i=0;
        return;
      }
    }
  }
}
void longitude()//get longitude
{
  char i;
  char lon[11]={
    '0','0','0','0','0','0','0','0','0','0','0'
  };

  if(ID())
  {
    comma(4);
    while(1)
    {
      if(Serial.available())
      {
        lon[i] = Serial.read();
        i++;
      }
      if(i==11)
      {
        i=0;
        Serial.println(Datatransfer(lon,5),5);//print longitude
        return;
      }
    }
  }
}

void lon_dir()//
{
  char i=0,val;

  if(ID())
  {
    comma(5);
    while(1)
    {
      if(Serial.available())
      {
        val = Serial.read();
        //Serial.println(val,BYTE);
        Serial.println(val);
        i++;
      }
      if(i==1)
      {
        i=0;
        return;
      }
    }
  }
}

void altitude()//get altitude data
{
  char i,flag=0;
  char alt[8]={
    '0','0','0','0','0','0','0','0'
  };

  if( ID())
  {
    comma(9);
    while(1)
    {
      if(Serial.available())
      {
        alt[i] = Serial.read();
        if(alt[i]==',')
          flag=1;
        else
          i++;
      }
      if(flag)
      {
        i=0;
        Serial.println(Datatransfer(alt,1),1);//print altitude data
        return;
      }
    }
  }
}

Serial communication Default baudrate: 4800
Serial monitor in GPS mode via Arduino board

Tips for Coolterm usage

Settings below is recommended
Recommended Coolterm settings

How to send out text message in GSM mode via Coolterm

After the network indication LED showing GSM module has found the network, we can use it to send out message.

Setp 1: Set the system to text mode(as opposed to PDU mode) with command AT+CMGF=1(type "AT+CMGF=1" in the input line, then press KEY), you will get response as below.
Step 1
Step 2: Set message receiver number with command AT+CMGS="Number"(replace Number with your destination number),after pressing key, it will show as follow
Step 2
Step 3: Type in you message content, end with pressing key.
Step 3
Step 4: Send Ctrl character Ctrl+Z to verify your message sending (just pressing Ctrl and Z simultaneously, key is not need after that).If it send out successfully, it will show as below.
Step 4

Ways to send Ctrl +Z in Coolterm

1.After typing the message text, press enter key, it will show:
'Enter' after text finished

Then, in the input area, pressing Ctrl+Z will send out the single ctrl character successfully as below:

After press Ctrl+Z
2.Ctrl characters can also be sent out in their hexadecimal format, in which form 1A is the value of Ctrl+Z:
Sending Ctrl+Z with in hexadecimal format

FAQ

- Some general Arduino Problems/FAQ/Tips
Q Serial connection errs. When connecting to PC, serial port terminal application occasionally warns “A Serial Port Err Occur 103: No Stop Bit Received” or ” A Serial Port Err Occur 104: stop bit received too early”
A set Coolterm in options-receive-ignore receiving signal err to ignore connection err and it will reconnect automatically.
Q Serial port terminal application warns “Normal power down” when reconnect after disconnect, and Network indication LEDs both turn off.
A Choose disconnect, and connect again. Arduino board will reset at every connection to PC. During resetting, the Arduino board will emit a low pulse to pin PWRKEY of GPS module. So if GPS module is already on before connection, the low pulse will switch it off, if not, the pulse will switched it on.
Q Serial port terminal application send out all the strings on the screen after pressing Ctrl+Z, when trying to send message in GSM USB mode.
A It is possible to send Ctrl characters when the terminal is set to Line Mode. We can choose the Line Mode in options-terminal-terminal mode, or we can send the Ctrl character though sending string box of Coolterm in hexadecimal format. Please refer to Ways to send Ctrl +Z in Coolterm.
A Restart the serial port terminal application always works for other troubles.
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents