General

Arduino Gsm Remote Control

userHead elesol12 2014-04-12 04:34:54 21794 Views39 Replies
Hello ! i'm trying to make a gsm remote control with these arduino parts http://store.arduino.cc/index.php?main_ ... cts_id=195
http://store.arduino.cc/index.php?main_ ... cts_id=282
http://store.arduino.cc/index.php?main_ ... cts_id=113
Does anyone know which code i must upload to make it ?
2014-04-22 01:31:38 I'm confused now ! What's the right to send  ?      " H "    or  H        ? userHeadPic elesol12
2014-04-22 01:31:38 I'm confused now ! What's the right to send  ?      " H "    or  H        ? userHeadPic elesol12
2014-04-22 01:31:38 I'm confused now ! What's the right to send  ?      " H "    or  H        ? userHeadPic elesol12
2014-04-22 01:31:38 I'm confused now ! What's the right to send  ?      " H "    or  H        ? userHeadPic elesol12
2014-04-21 18:22:24 Hello, Eleso12

Sorry for the late reply.

Uhm...I think what you sent is "H", not H only. So the LastMess will be "H", not H.

It is a little confused. Do you know what I mean?

And please add that code behind the  "Serial.println(lastMess);"

Like this:
Code: Select all
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE

 
#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;
 
char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****
 
void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
   

   
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");
 
    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
   
}
 
// **** 3 The loop ****
 
void loop() {
 
 
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20);   
     
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");
 
     
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
     
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
    if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
     
  }//end for
   
    sms.flush(); //discards the SMS message

}
userHeadPic Grey.CC
2014-04-21 18:22:24 Hello, Eleso12

Sorry for the late reply.

Uhm...I think what you sent is "H", not H only. So the LastMess will be "H", not H.

It is a little confused. Do you know what I mean?

And please add that code behind the  "Serial.println(lastMess);"

Like this:
Code: Select all
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE

 
#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;
 
char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****
 
void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
   

   
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");
 
    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
   
}
 
// **** 3 The loop ****
 
void loop() {
 
 
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20);   
     
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");
 
     
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
     
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
    if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
     
  }//end for
   
    sms.flush(); //discards the SMS message

}
userHeadPic Grey.CC
2014-04-21 18:22:24 Hello, Eleso12

Sorry for the late reply.

Uhm...I think what you sent is "H", not H only. So the LastMess will be "H", not H.

It is a little confused. Do you know what I mean?

And please add that code behind the  "Serial.println(lastMess);"

Like this:
Code: Select all
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE

 
#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;
 
char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****
 
void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
   

   
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");
 
    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
   
}
 
// **** 3 The loop ****
 
void loop() {
 
 
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20);   
     
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");
 
     
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
     
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
    if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
     
  }//end for
   
    sms.flush(); //discards the SMS message

}
userHeadPic Grey.CC
2014-04-21 18:22:24 Hello, Eleso12

Sorry for the late reply.

Uhm...I think what you sent is "H", not H only. So the LastMess will be "H", not H.

It is a little confused. Do you know what I mean?

And please add that code behind the  "Serial.println(lastMess);"

Like this:
Code: Select all
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE

 
#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;
 
char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****
 
void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
   

   
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");
 
    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
   
}
 
// **** 3 The loop ****
 
void loop() {
 
 
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20);   
     
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");
 
     
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
     
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
    if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
     
  }//end for
   
    sms.flush(); //discards the SMS message

}
userHeadPic Grey.CC
2014-04-21 01:32:02 any ideas ?  please.... userHeadPic elesol12
2014-04-21 01:32:02 any ideas ?  please.... userHeadPic elesol12
2014-04-21 01:32:02 any ideas ?  please.... userHeadPic elesol12
2014-04-21 01:32:02 any ideas ?  please.... userHeadPic elesol12
2014-04-20 01:14:29 i changed  'L'  and 'H' with "L" and "H".  I  uploaded tha code without errors and i send "H" but the led an pin 13 didn't blink !!  see here at the photo http://postimg.org/image/v121wnhwr/
what's wrong ?
userHeadPic elesol12
2014-04-20 01:14:29 i changed  'L'  and 'H' with "L" and "H".  I  uploaded tha code without errors and i send "H" but the led an pin 13 didn't blink !!  see here at the photo http://postimg.org/image/v121wnhwr/
what's wrong ?
userHeadPic elesol12
2014-04-20 01:14:29 i changed  'L'  and 'H' with "L" and "H".  I  uploaded tha code without errors and i send "H" but the led an pin 13 didn't blink !!  see here at the photo http://postimg.org/image/v121wnhwr/
what's wrong ?
userHeadPic elesol12
2014-04-20 01:14:29 i changed  'L'  and 'H' with "L" and "H".  I  uploaded tha code without errors and i send "H" but the led an pin 13 didn't blink !!  see here at the photo http://postimg.org/image/v121wnhwr/
what's wrong ?
userHeadPic elesol12
2014-04-19 02:57:58 Hello Grey ! i did these two changes but without good sesults :(
here are the results with the mistakes
http://postimg.org/image/uk1hr2ayp/
http://postimg.org/image/m93tu7e07/
Here is the code with the last changes :
[quote]
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE


#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;

char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****

void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
 

 
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");

    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
 
}

// **** 3 The loop ****

void loop() {

  if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20); 
   
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");

   
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
   
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
 
   
  }//end for
 
    sms.flush(); //discards the SMS message

}

[/quote]

What can we do now ?
userHeadPic elesol12
2014-04-19 02:57:58 Hello Grey ! i did these two changes but without good sesults :(
here are the results with the mistakes
http://postimg.org/image/uk1hr2ayp/
http://postimg.org/image/m93tu7e07/
Here is the code with the last changes :
[quote]
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE


#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;

char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****

void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
 

 
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");

    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
 
}

// **** 3 The loop ****

void loop() {

  if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20); 
   
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");

   
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
   
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
 
   
  }//end for
 
    sms.flush(); //discards the SMS message

}

[/quote]

What can we do now ?
userHeadPic elesol12
2014-04-19 02:57:58 Hello Grey ! i did these two changes but without good sesults :(
here are the results with the mistakes
http://postimg.org/image/uk1hr2ayp/
http://postimg.org/image/m93tu7e07/
Here is the code with the last changes :
[quote]
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE


#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;

char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****

void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
 

 
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");

    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
 
}

// **** 3 The loop ****

void loop() {

  if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20); 
   
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");

   
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
   
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
 
   
  }//end for
 
    sms.flush(); //discards the SMS message

}

[/quote]

What can we do now ?
userHeadPic elesol12
2014-04-19 02:57:58 Hello Grey ! i did these two changes but without good sesults :(
here are the results with the mistakes
http://postimg.org/image/uk1hr2ayp/
http://postimg.org/image/m93tu7e07/
Here is the code with the last changes :
[quote]
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE


#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 13 // declaration of the constant PIN, and setting it to output nr. 6


GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;

char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM card

int x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message

// **** 2 Setup ****

void setup() {
  //Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
  Serial.begin(9600);
  Serial.println("SMS Recieving");
 

 
  boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
  while(notConnected) {  // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
    if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
    notConnected = false;
    else {
      //messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
      Serial.println("No connection");

    }
  }
  // if connection is established
  Serial.println("GSM connected"); //GSM connected
  Serial.println("Waiting"); //Waiting for SMS
 
}

// **** 3 The loop ****

void loop() {

  if (lastMess == 'H')
    {
      digitalWrite(13,HIGH);
    }
    else if (lastMess == 'L')
    {
      digitalWrite(13,LOW);
    }
  //reading messages
  if (sms.available()) // if there are SMS on the SIM card
  {
    x++; //message counter adds one
    sms.remoteNumber(remoteNumber, 20); 
   
    //Show the message on monitor
    Serial.println("Messages received from");
    Serial.println(remoteNumber); //Prints senders number on the serial monitor
    Serial.println("Message:");

   
    while(c=sms.read()) {
      String nextChar = String (c);
      String Mess = (lastMess + nextChar);
      lastMess = Mess;
      /*sms.read collects one digit of the messages at time and stores it in the variable c.
      This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
      */
    }
   
    Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
 
   
  }//end for
 
    sms.flush(); //discards the SMS message

}

[/quote]

What can we do now ?
userHeadPic elesol12