Hello everyone,
I'm currently working on a weather station project, precisely on the communication part.
It means that i'm working with a SIM900 module to send alert SMS and GPS coordinates if the user send a SMS with a sort of password (like in ads : send LOVE to 66900).
And it's for the gps coordinates part that i ask help here, for the moment this is what i did
//Num module : +33768265074 // ! // Maxime : +33786284633 // ! // 44.7260358,5.021091 //
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7,8); // RX, TX
char mdp[] = "Test"; // we compare this to the content of incoming SMS
boolean sms;
void setup()
{
SIM900.begin(9600); // Init module (SIM900)
Serial.begin(9600); // Init serial communication
delay(500);
Serial.println("Waiting for SMS");
sms = true;
}
void loop()
{
if(sms == true)
{
receivesms();
sms = false;
}
if(SIM900.available())
{
Serial.write(SIM900.read()); // Write in the serial monitor the messages
}
/*
if(SIM900.read() == mdp) // So this is this if that makes trouble, this line should be supposed to check if the user entered the right "password"
{
Serial.println("ok"); // A little confirmation
}
*/
}
void receivesms()
{
SIM900.println("AT+CMGF=1\r"); // SMS mode
SIM900.println("AT+CMGL=\"ALL\"\r"); // Display all messages
delay(1000);
}
And here's a screen of what it does :
Simple it just displays in the serial monitor the incoming messages.
In this first program you can see that i commented the "if(SIM900.read() == mdp) and what's in inside too"; because this is what makes me an error, and if i uncomment like this :
//Num module : nothing // ! // Maxime : +youwillnothavehisnumber:p // ! // 44.7260358,5.021091 //
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7,8); // RX, TX
char mdp[] = "Test"; // we compare this to the content of incoming SMS
boolean sms;
void setup()
{
SIM900.begin(9600); // Init module (SIM900)
Serial.begin(9600); // Init serial communication
delay(500);
Serial.println("Waiting for SMS");
sms = true;
}
void loop()
{
if(sms == true)
{
receivesms();
sms = false;
}
if(SIM900.available())
{
Serial.write(SIM900.read()); // Write in the serial monitor the messages
}
if(SIM900.read() == mdp) // So this is this if that makes trouble, this line should be supposed to check if the user entered the right "password"
{
Serial.println("ok"); // A little confirmation
}
}
void receivesms()
{
SIM900.println("AT+CMGF=1\r"); // SMS mode
SIM900.println("AT+CMGL=\"ALL\"\r"); // Display all messages
delay(1000);
}
It is like there is a transmission problem because it displays weird caracters ( baud rate is ok though).
I don't know if it comes from the "mdp" variable or the "SIM900.read()".
So I think I described well my problem, feel free to ask things it can only be helpful
Link for gsm module if you are interested : GPRS Shield V1.0 | Seeed Studio Wiki (i haven't been paid by the brand for this link)