Forum >GPS/GPRS/GSM Module V3.0 arduino - Send sms with GPS data
General

GPS/GPRS/GSM Module V3.0 arduino - Send sms with GPS data

userHead kappa 2014-02-08 17:51:12 28057 Views19 Replies
Hi to all,
first of all, tank you for any suggestion.

I'm trying to create a Scratch for Arduino Uno able to do these simple steps:
1) activate GSM.
2) switch to GPS-mode.
3) wait for receiving NMEA signal from GPS
4) store a sample of NMEA string
5) activate GSM
6) send an SMS containing NMEA string.

NOTE: for my first step I need only to send a part of a simple NMEA string, witout formatting or choosing infromations (long-lat etc.)

I did this Scratch, merging some parts of wiki Scratchs and some little extra code.
Code: Select all
// Product name: GPS/GPRS/GSM Module V3.0
// # Product SKU : TEL0051
// # Version : 0.1
// # Description:
// # The sketch for driving the gsm mode via the Arduino board
// # Steps:
// # 1. Turn the S1 switch to the Prog(right side)
// # 2. Turn the S2 switch to the Arduino side(left side)
// # 3. Take off the GSM/GPS jumper caps from the Uart select
// # 4. Upload the sketch to the Arduino board
// # 5. Turn the S1 switch to the comm(left side)
// # 7. RST the board
// # wiki link- http://www.dfrobot.com/wiki/index.php/GPS/GPRS/GSM_Module_V3.0_(SKU:TEL0051)
char inChar; // byte for GPS Serial Read
int index; // index for string (GPSdata) from GPS
char GPSdata[300]; // string created with bytes (reading serial GPS)
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()
{
//Initialize the driver pins for GSM function:
for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin[i],OUTPUT);
}
// Initialize a buffer for received GPS data GPSdata
for (int i=0;i<300;i++){
GPSdata[i]=' ';
}
// Output GSM Timing
digitalWrite(5,HIGH);
delay(1500);
digitalWrite(5,LOW);
// Enable GSM (Pin3,L)+ Disable GPS (Pin4,H):
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
delay(2000);
//set the baud rate
Serial.begin(9600);
delay(15000); // time suggested by wiki
} // end "void setup"
void loop(){
// activate GPS with AT Commands
// NOTE: as suggested in "How to drive the GSM Mode via USB port" of wiki,
// you have to send AT commands in GSM-mode, then switch in GPS-mode.
Serial.print("AT");
delay(2000);
Serial.println("AT+CGPSIPR=9600");// (set the baud rate)
delay(1000);
Serial.println("AT+CGPSPWR=1"); // turn on GPS power supply
delay(1000);
Serial.println("AT+CGPSRST=1"); //reset GPS in autonomy mode
// Enable GPS (Disable GSM)
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
//delay to assure GPS gets date.
delay(60000);
// GPS COORDINATES ACQUISITION
// Initialize a buffer for received GPS data GPSdata
for (int i=0;i<300;i++){
GPSdata[i]=' ';
}
// reset index
index=0;
// read Bytes from GPS:
inChar = Serial.read();
// See if the port is empty yet
while (inChar == -1) {
delay(100);
}
// until buffer is full (GPSdata[300]):
while (index<300){
inChar = Serial.read();
GPSdata[index] = inChar;
index = index+1;
}
// Enable GSM (Pin3,L)+ Disable GPS (Pin4,H):
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
// send AT Commands (for SMS)
Serial.println("AT"); //Send AT command
delay(2000);
Serial.println("AT");
delay(2000);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS=\"0039**********\""); //Change the receiver phone number
delay(1000);
// send GPS store data:
for (int i=0;i<300;i++){
Serial.print(GPSdata[i]);
}
// add a word:
Serial.print("HELLO");//the message you want to send
delay(1000);
Serial.write(26); // ASCII Character = "CTRL-Z"
while(1);
}
I received a sms on a cellphone, but I didn't received GPS string, but some part of AT command sended in the Scratch.
some like:
[quote]TAT+CGPIPR=9600

Hello[/quote]

did you have some suggestion to do this goal?
2015-01-25 18:56:43 hi! could anyone help me with this problem? i used this code

void setup()
{
  //Init the driver pins for GSM function
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
  //Output GSM Timing
    digitalWrite(5,HIGH);
    delay(1500);
    digitalWrite(5,LOW);
}
void loop()   
{   
    // Use these commands instead of the hardware switch 'UART select' in order to enable each mode
    // If you want to use both GMS and GPS. enable the required one in your code and disable the other one for each access.
    digitalWrite(3,LOW);//enable GSM TX?RX
    digitalWrite(4,HIGH);//disable GPS TX?RX
}


and the result is:

RDY

+CFUN: 1

+CPIN: READY

GPS Ready

Call Ready
AT


then, theres no response

I supplied the module with the port of usb and a 7.5v 500mA
userHeadPic moomoy071410
2015-01-25 18:56:43 hi! could anyone help me with this problem? i used this code

void setup()
{
  //Init the driver pins for GSM function
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
  //Output GSM Timing
    digitalWrite(5,HIGH);
    delay(1500);
    digitalWrite(5,LOW);
}
void loop()   
{   
    // Use these commands instead of the hardware switch 'UART select' in order to enable each mode
    // If you want to use both GMS and GPS. enable the required one in your code and disable the other one for each access.
    digitalWrite(3,LOW);//enable GSM TX?RX
    digitalWrite(4,HIGH);//disable GPS TX?RX
}


and the result is:

RDY

+CFUN: 1

+CPIN: READY

GPS Ready

Call Ready
AT


then, theres no response

I supplied the module with the port of usb and a 7.5v 500mA
userHeadPic moomoy071410
2014-12-09 07:12:13 Hi Grey,

I press "z" and "ctrl" buttons simultaneously on keyboard.am I right?

alright, I will try it later.
Thanks,
JJ
userHeadPic JJ
2014-12-09 07:12:13 Hi Grey,

I press "z" and "ctrl" buttons simultaneously on keyboard.am I right?

alright, I will try it later.
Thanks,
JJ
userHeadPic JJ
2014-12-09 06:14:11 Hi JJ
How do you implement the action “Ctrl+Z”. I guess it will be some problem.
Could you try the Arduino SMS sample code:
Code: Select all
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()
{   
  //Init the driver pins for GSM function
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }
  digitalWrite(5,HIGH);//Output GSM Timing
  delay(1500);
  digitalWrite(5,LOW); 
  digitalWrite(3,LOW);//Enable the GSM mode
  digitalWrite(4,HIGH);//Disable the GPS mode
  delay(2000);
  Serial.begin(9600); //set the baud rate
  delay(5000);//call ready
  delay(5000);
  delay(5000);
}
void loop()
  Serial.println("AT"); //Send AT command 
  delay(2000);
  Serial.println("AT"); 
  delay(2000);
  //Send message
  Serial.println("AT+CMGF=1");
  delay(1000);
  Serial.println("AT+CMGS=\"1580xxxxx71\"");//Change the receiver **
  delay(1000);
  Serial.print("HELLO");//the message context
  delay(1000);
  Serial.write(26);
  while(1);
}
And I want to tell you that there was a new message when you were testing the module
[quote]+CMTI: "SM",1[/quote]
Try to use the AT command "AT+CMGR=1" to read it.
All the command is included in the datasheet.
userHeadPic Grey.CC
2014-12-09 06:14:11 Hi JJ
How do you implement the action “Ctrl+Z”. I guess it will be some problem.
Could you try the Arduino SMS sample code:
Code: Select all
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()
{   
  //Init the driver pins for GSM function
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }
  digitalWrite(5,HIGH);//Output GSM Timing
  delay(1500);
  digitalWrite(5,LOW); 
  digitalWrite(3,LOW);//Enable the GSM mode
  digitalWrite(4,HIGH);//Disable the GPS mode
  delay(2000);
  Serial.begin(9600); //set the baud rate
  delay(5000);//call ready
  delay(5000);
  delay(5000);
}
void loop()
  Serial.println("AT"); //Send AT command 
  delay(2000);
  Serial.println("AT"); 
  delay(2000);
  //Send message
  Serial.println("AT+CMGF=1");
  delay(1000);
  Serial.println("AT+CMGS=\"1580xxxxx71\"");//Change the receiver **
  delay(1000);
  Serial.print("HELLO");//the message context
  delay(1000);
  Serial.write(26);
  while(1);
}
And I want to tell you that there was a new message when you were testing the module
[quote]+CMTI: "SM",1[/quote]
Try to use the AT command "AT+CMGR=1" to read it.
All the command is included in the datasheet.
userHeadPic Grey.CC
2014-12-08 03:17:50 hi Grey,

Yeap, I follow the instructions written in WIKI,
S1:  Arduino
S2:  COMM
Uart: Middle (it doesn't change)

But in the end, it did not show in receiver's mobile phone although I get the AT results like WIKI shown

Next, today I tried
// Product name: GPS/GPRS/GSM Module V3.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 Prog(right side)
// #        2. Turn the S2 switch to the USB side(left side)
// #        3. Set the UART select switch to middle one.
// #        4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor )
// #        5. Turn the S1 switch to the comm(left side)     
// #        6. RST the board

// #        wiki link- https://www.dfrobot.com/wiki/index.php/G ... U:TEL0051)

void setup()
{
  //Init the driver pins for GSM function
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
  //Output GSM Timing
    digitalWrite(5,HIGH);
    delay(1500);
    digitalWrite(5,LOW);
}
void loop()   
{   
    // Use these commands instead of the hardware switch 'UART select' in order to enable each mode
    // If you want to use both GMS and GPS. enable the required one in your code and disable the other one for each access.
    digitalWrite(3,LOW);//enable GSM TX?RX
    digitalWrite(4,HIGH);//disable GPS TX?RX
}

I curious why it enables me send "one time message" to the receiver's phone, the second times fails forever. The serial monitor shows me this:

RDY

+CFUN: 1

+CPIN: READY

GPS Ready

Call Ready
AT

OK

ERROR
AT+CMGS="016652xxx93"

> SDSD.
+CMGS: 235

OK
AT+CMGS="0177xx8199"

> XIaaN.
ERROR

+CMTI: "SM",1
AT+CMGS="0166xx1093"

> SDS.
ERROR



hmm, is there any setting requires when send the second times of message to any receiver phone? Since i remains same setting as the 1st time. I tried most of brands simcard, they work same, one time success only. Second time, have to restart all the stuff just can send again.

i use 9V/350mA power adapter.

Thanks for replY.  :)

Best regards,
JJ
userHeadPic JJ
2014-12-08 03:17:50 hi Grey,

Yeap, I follow the instructions written in WIKI,
S1:  Arduino
S2:  COMM
Uart: Middle (it doesn't change)

But in the end, it did not show in receiver's mobile phone although I get the AT results like WIKI shown

Next, today I tried
// Product name: GPS/GPRS/GSM Module V3.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 Prog(right side)
// #        2. Turn the S2 switch to the USB side(left side)
// #        3. Set the UART select switch to middle one.
// #        4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor )
// #        5. Turn the S1 switch to the comm(left side)     
// #        6. RST the board

// #        wiki link- https://www.dfrobot.com/wiki/index.php/G ... U:TEL0051)

void setup()
{
  //Init the driver pins for GSM function
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
  //Output GSM Timing
    digitalWrite(5,HIGH);
    delay(1500);
    digitalWrite(5,LOW);
}
void loop()   
{   
    // Use these commands instead of the hardware switch 'UART select' in order to enable each mode
    // If you want to use both GMS and GPS. enable the required one in your code and disable the other one for each access.
    digitalWrite(3,LOW);//enable GSM TX?RX
    digitalWrite(4,HIGH);//disable GPS TX?RX
}

I curious why it enables me send "one time message" to the receiver's phone, the second times fails forever. The serial monitor shows me this:

RDY

+CFUN: 1

+CPIN: READY

GPS Ready

Call Ready
AT

OK

ERROR
AT+CMGS="016652xxx93"

> SDSD.
+CMGS: 235

OK
AT+CMGS="0177xx8199"

> XIaaN.
ERROR

+CMTI: "SM",1
AT+CMGS="0166xx1093"

> SDS.
ERROR



hmm, is there any setting requires when send the second times of message to any receiver phone? Since i remains same setting as the 1st time. I tried most of brands simcard, they work same, one time success only. Second time, have to restart all the stuff just can send again.

i use 9V/350mA power adapter.

Thanks for replY.  :)

Best regards,
JJ
userHeadPic JJ
2014-12-02 22:54:49 Hi JJ,

For Arduino mode,
It should be
S1:  Arduino
S2:  COMM
Uart: Middle (it doesn't change)
Could you attach a photo about your module switches?
userHeadPic Grey.CC
2014-12-02 22:54:49 Hi JJ,

For Arduino mode,
It should be
S1:  Arduino
S2:  COMM
Uart: Middle (it doesn't change)
Could you attach a photo about your module switches?
userHeadPic Grey.CC
2014-12-02 09:15:10 Hi all,

Thanks Grey. May I ask I had tried the code from https://www.dfrobot.com/wiki/index.php/G ... TEL0051%29
under section of
"How to drive the GSM Mode via Arduino board"

There have no response to the receiver although I get the output on Serial monitor as shown in Figure shown in the page there.

Moreover, when i tried the
"How to drive the GSM Mode via USB port"

It works fine as the receiver receive my message. What is the problem behind it?  ???

Thanks for reply.

Best regards,
JJ
userHeadPic JJ
2014-12-02 09:15:10 Hi all,

Thanks Grey. May I ask I had tried the code from https://www.dfrobot.com/wiki/index.php/G ... TEL0051%29
under section of
"How to drive the GSM Mode via Arduino board"

There have no response to the receiver although I get the output on Serial monitor as shown in Figure shown in the page there.

Moreover, when i tried the
"How to drive the GSM Mode via USB port"

It works fine as the receiver receive my message. What is the problem behind it?  ???

Thanks for reply.

Best regards,
JJ
userHeadPic JJ
2014-11-29 23:49:36 Hi JJ,

They are OK. But it is better to use a lower voltage one, like 7.4V~9V.
What the best is the suitable. It doesn't need too high voltage.

For example~ our [urlhttp://www.dfrobot.com/index.php?route=product ... ption=true]7.4V lipo battery[/url].  2200mha
userHeadPic Grey.CC
2014-11-29 23:49:36 Hi JJ,

They are OK. But it is better to use a lower voltage one, like 7.4V~9V.
What the best is the suitable. It doesn't need too high voltage.

For example~ our [urlhttp://www.dfrobot.com/index.php?route=product ... ption=true]7.4V lipo battery[/url].  2200mha
userHeadPic Grey.CC
2014-11-27 01:27:49 Hi,
currently, I looking for any portable battery for supply GPS/GPRS/GSM shield+UNo+LCD. May I ask ask can anyone give me some suggestion? As the normal battery is insufficient since it give 9V battery that has only 300mAh.

I have few choices as below, can you guys tell me is they suitable for my project?
1) 11.1V 1200mAH 25C Lipo Battery
2) WLtoys V912 RC Heli Spare Part-20-2s 1000mAh Upgrade Lipo Battery (7.4V/1000mAh )
3) MJX F49 Spare Part-15-2S 7.4v 1500mah Lipo Battery

Last question, is there said the higher the voltage, the better the operation is has?

thanks for replys. Appreciated ^_^

Best regards,
JJ

userHeadPic JJ
2014-11-27 01:27:49 Hi,
currently, I looking for any portable battery for supply GPS/GPRS/GSM shield+UNo+LCD. May I ask ask can anyone give me some suggestion? As the normal battery is insufficient since it give 9V battery that has only 300mAh.

I have few choices as below, can you guys tell me is they suitable for my project?
1) 11.1V 1200mAH 25C Lipo Battery
2) WLtoys V912 RC Heli Spare Part-20-2s 1000mAh Upgrade Lipo Battery (7.4V/1000mAh )
3) MJX F49 Spare Part-15-2S 7.4v 1500mah Lipo Battery

Last question, is there said the higher the voltage, the better the operation is has?

thanks for replys. Appreciated ^_^

Best regards,
JJ

userHeadPic JJ
2014-02-09 21:17:41 Hello Kappa,

How are you testing this code?
What power supply are you using?
Are you indoors or outdoors?

Looks like it might be a problem with your initialization sequence. My guess is that the At commands are stuck.
I suggest you to double check the switch status, and disable the Serial from the computer if you are using it. Also, make sure the shield is active while testing this.
Let us know the LED status at each step.
userHeadPic Jose
2014-02-09 21:17:41 Hello Kappa,

How are you testing this code?
What power supply are you using?
Are you indoors or outdoors?

Looks like it might be a problem with your initialization sequence. My guess is that the At commands are stuck.
I suggest you to double check the switch status, and disable the Serial from the computer if you are using it. Also, make sure the shield is active while testing this.
Let us know the LED status at each step.
userHeadPic Jose
2014-02-08 17:51:12 Hi to all,
first of all, tank you for any suggestion.

I'm trying to create a Scratch for Arduino Uno able to do these simple steps:
1) activate GSM.
2) switch to GPS-mode.
3) wait for receiving NMEA signal from GPS
4) store a sample of NMEA string
5) activate GSM
6) send an SMS containing NMEA string.

NOTE: for my first step I need only to send a part of a simple NMEA string, witout formatting or choosing infromations (long-lat etc.)

I did this Scratch, merging some parts of wiki Scratchs and some little extra code.
Code: Select all
// Product name: GPS/GPRS/GSM Module V3.0
// # Product SKU : TEL0051
// # Version    : 0.1
// # Description:
// # The sketch for driving the gsm mode via the Arduino board
// # Steps:
// #        1. Turn the S1 switch to the Prog(right side)
// #        2. Turn the S2 switch to the Arduino side(left side)
// #        3. Take off the GSM/GPS jumper caps from the Uart select
// #        4. Upload the sketch to the Arduino board
// #        5. Turn the S1 switch to the comm(left side)
// #        7. RST the board
// #        wiki link- https://www.dfrobot.com/wiki/index.php/GPS/GPRS/GSM_Module_V3.0_(SKU:TEL0051)
char inChar;        // byte for GPS Serial Read
int index;          // index for string (GPSdata) from GPS
char GPSdata[300];  // string created with bytes (reading serial GPS)
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()
{   
  //Initialize the driver pins for GSM function:
  for(int i = 0 ; i < 3; i++){
    pinMode(gsmDriverPin[i],OUTPUT);
  }
 
  // Initialize a buffer for received GPS data GPSdata
    for (int i=0;i<300;i++){     
    GPSdata[i]=' ';
  }
 
  // Output GSM Timing
  digitalWrite(5,HIGH);
  delay(1500);
  digitalWrite(5,LOW);
   
  // Enable GSM (Pin3,L)+ Disable GPS (Pin4,H):
  digitalWrite(3,LOW);
  digitalWrite(4,HIGH);
  delay(2000);
   
  //set the baud rate
  Serial.begin(9600);
  delay(15000);    // time suggested by wiki
// end "void setup"
void loop(){
  // activate GPS with AT Commands
  // NOTE: as suggested in "How to drive the GSM Mode via USB port" of wiki,
  //      you have to send AT commands in GSM-mode, then switch in GPS-mode.
  Serial.print("AT");
  delay(2000);
  Serial.println("AT+CGPSIPR=9600");// (set the baud rate)
  delay(1000);
  Serial.println("AT+CGPSPWR=1");  // turn on GPS power supply
  delay(1000);
  Serial.println("AT+CGPSRST=1");  //reset GPS in autonomy mode
 
  // Enable GPS (Disable GSM)
  digitalWrite(3,HIGH);
  digitalWrite(4,LOW);
 
  //delay to assure GPS gets date.
  delay(60000);
 
  // GPS COORDINATES ACQUISITION
  // Initialize a buffer for received GPS data GPSdata
  for (int i=0;i<300;i++){
    GPSdata[i]=' ';
  }
  // reset index
  index=0;
 
  // read Bytes from GPS:
  inChar = Serial.read();
  // See if the port is empty yet
  while (inChar == -1) {
    delay(100);
  }
  // until buffer is full (GPSdata[300]):
  while (index<300){
    inChar = Serial.read();
    GPSdata[index] = inChar;
    index = index**;
    }
  // Enable GSM (Pin3,L)+ Disable GPS (Pin4,H):
  digitalWrite(3,LOW);
  digitalWrite(4,HIGH);
 
  // send AT Commands (for SMS)
  Serial.println("AT"); //Send AT command 
  delay(2000);
  Serial.println("AT"); 
  delay(2000);
  Serial.println("AT+CMGF=1");
  delay(1000);
  Serial.println("AT+CMGS=\"0039**********\"");  //Change the receiver **
  delay(1000);
 
  // send GPS store data:
  for (int i=0;i<300;i++){
    Serial.print(GPSdata[i]);
  }
  // add a word:
  Serial.print("HELLO");//the message you want to send
  delay(1000);
  Serial.write(26); // ASCII Character = "CTRL-Z"
  while(1);
}
I received a sms on a cellphone, but I didn't received GPS string, but some part of AT command sended in the Scratch.
some like:
[quote]TAT+CGPIPR=9600

Hello[/quote]

did you have some suggestion to do this goal?
userHeadPic kappa