Go Down

Topic: Arduino Uno + GPRS shield (Read 592 times) previous topic - next topic

gerrynigro

Hi to all,
I'm trying to perform calls or send sms messages from my arduino uno and gprs shield.
I'm using an Arduino Uno and a GPRS Shield Seeduino SIM900.
I'm using a part of a sketch I found on a seeduino wiki about their cellular shield.

I can compile and I can see that it works on the arduino uno, but I don't receive sms or calls.
I don't know why.
Anyone can help me?

Here is the sketch.
Thank you in advance to anyone can help me.

Quote


#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial mySerial(7, 8);

void setup()
{
  mySerial.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);    // the GPRS baud rate
  delay(500);
}

void loop()
{
  //after start up the program, you can using terminal to connect the serial of gprs shield,
  //if you input 't' in the terminal, the program will execute SendTextMessage(), it will show how to send a sms message,
  //if input 'd' in the terminal, it will execute DialVoiceCall(), etc.
       
        SendTextMessage();
//        DialVoiceCall();
        delay(100000);
}

///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
  mySerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(100);
  mySerial.println("AT + CMGS = \"+39138xxxxx615\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(100);
  mySerial.println("A test message!");//the content of the message
  delay(100);
  mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(100);
  mySerial.println();
}

///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
  mySerial.println("ATD + +39138xxxxx615;");//dial the number
  delay(100);
  mySerial.println();
}



PaulS

Code: [Select]
  //after start up the program, you can using terminal to connect the serial of gprs shield,
  //if you input 't' in the terminal, the program will execute SendTextMessage(), it will show how to send a sms message,
  //if input 'd' in the terminal, it will execute DialVoiceCall(), etc.

You can't if you don't read from the serial port. If you are going to remove that code, remove the now-useless comments, too.

Every AT command returns a reply. You never bother to read them. Why not?

gerrynigro

Ok,
sorry PaulS, I had left some wrong comment from the original sketch.
Now it's clean.
I just would like to send the sms or, performing the voice call, now.
I really don't understand because on the serial monitor I can see that the skecth executes, but it seems non to send the sms or the call.
:-(

Quote

#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial mySerial(7, 8);

void setup()
{
  mySerial.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);    // the GPRS baud rate
  delay(500);
}

void loop()
{
  //I want to be absolutely simple, so by now, I just want either to send a text message OR to perform a voice call.
       
        SendTextMessage();
//        DialVoiceCall(); //Now I'm trying to send the sms, but I can't perform the voice call too
        delay(100000);
}

///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
  mySerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(100);
  mySerial.println("AT + CMGS = \"+39138xxxxx615\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(100);
  mySerial.println("A test message!");//the content of the message
  delay(100);
  mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(100);
  mySerial.println();
}

///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
  mySerial.println("ATD + +39138xxxxx615;");//dial the number
  delay(100);
  mySerial.println();
}

PaulS

Quote
I really don't understand because on the serial monitor I can see that the skecth executes, but it seems non to send the sms or the call.

I don't see how that is possible. There are no calls to Serial.print() in your code, so nothing should appear on the Serial Monitor.

You still aren't reading any response from the device.

gerrynigro

Ok PaulS,
sorry, I wasn't precise.

Here the code and what I can read on the serial monitor.
As you can see the problem is that the sketch executes, enters the function, but altough the instruction seems to be executed, I don't receive the sms message on my mobile phone.

Quote

#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial mySerial(7, 8);

void setup()
{
  mySerial.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);    // the GPRS baud rate
  delay(500);
}

void loop()
{
  //I want to be absolutely simple, so by now, I just want either to send a text message OR to perform a voice call
       Serial.println("Before the sms");       
       SendTextMessage();
       Serial.println("After the sms");
//        DialVoiceCall();
        delay(100000);
}

Serial monitor trace

Quote



///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
  Serial.println("In the function");       
  mySerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(100);
  mySerial.println("AT + CMGS = \"+39138xxxxx615\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(100);
  mySerial.println("A test message!");//the content of the message
  delay(100);
  mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(100);
  mySerial.println();
  Serial.println("Exiting the function");
}

///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
  mySerial.println("ATD + +39138xxxxx615;");//dial the number
  delay(100);
  mySerial.println();
}


Quote


Before the sms
In the function
Exiting the function
After the sms



I wonder if the library is correct or if the sintax of the call is correct, but on the serial monitor I don't have return message.

PaulS

Quote
but on the serial monitor I don't have return message.

I wonder if the fact that you never read anything from the GPRS has anything to do with that. Actually, I don't wonder at all.

Go Up