Go Down

Topic: Cannot Receive SMS Message - Official GSM Shield (Read 1 time) previous topic - next topic

st1tchy

Hello,

I am trying to get my GSM Shield to receive an SMS message, but it won't do it. I am able to send a message from the Arduino, using the example code provided by the library. My code and Serial output are below.

Code: [Select]
/*
 SMS receiver

 This sketch, for the Arduino GSM shield, waits for a SMS message
 and displays it through the Serial port.

 Circuit:
 * GSM shield attached to and Arduino
 * SIM card that can receive SMS messages

 created 25 Feb 2012
 by Javier Zorzano / TD

 This example is in the public domain.

 http://arduino.cc/en/Tutorial/GSMExamplesReceiveSMS

*/

// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER ""

// initialize the library instances
GSM gsmAccess(true);
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup()
{
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  boolean notConnected = false;

  // Start GSM connection
  while (notConnected)
  {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
  Serial.println("Test 1");
}

void loop()
{
  char c;

  // If there are any SMSs available()
  Serial.println("Test 2");
  if (sms.available())
  {
    Serial.println("Test 3");
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#')
    {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while (c = sms.read())
      Serial.print(c);

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  delay(1000);

}


Serial Output
Code: [Select]
SMS Messages Receiver
GSM initialized
Waiting for messages
Test 1
Test 2
AT+CMGL="REC UNREAD",1%13%Test 2
AT+CMGL="REC UNREAD",1%13%Test 2
AT+CMGL="REC UNREAD",1%13%Test 2
AT+CMGL="REC UNREAD",1%13%Test 2

It then just repeats the last line. I have sent a few messages, and it has received none of them.

addula123

what is the type of gsm board and how do you connect it to the arduino ???

st1tchy

Sorry, I thought I had put what board I was using in the original post. I am using the Official GSM shield, and It is just plugged into the Mega. Pin 2 is not connected, and there is a wire between pins 2 and 10 as shown in the manual on the Arduino website.

ARDUN0HED

I get the same. I was hoping for a response to help me out also.

nixrobot

Hi !

I bought 2 weeks ago the GSM shield Rev2

I use it with the UNO board with the example code : "send SMS" , and I had the same behavior : Just the message "SMS Messages Sender"

It was due to the PIN number , I setted a wrong one. So I tried with my mobile phone and then I remembered the correct one and then confirmed it.

Then the arduino goes to the message "not connected"
I had always this message. I was disapointed.

But I found a small button named "power" on the shield. I push it few second
and then the status led switch on and the status led started blinking !!
Then I press the reset button to restart the soft, and it started to work !

I reached to send a SMS to my mobile phone !


On things that still doesn't work, is the serial, I cannot write characters on the serial console.
So I put my number and the text in constant in the code.

And I added a whiel(1); at the end of the loop, to avoid sending lot of same SMS.

Hope it help someone

Go Up