Pages: [1]   Go Down
Author Topic: Arduino GSM Shield Sending SMS Messages not Working  (Read 989 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently purchased the GSM shield (http://store.arduino.cc/index.php?main_page=product_info&cPath=11_5&products_id=244) and am able to get the HTTP requests to work, however I am having issues with the SMS messaging. Below is my Debug output and also my code. I am sure it has something to do with the CMS ERROR message, but I have no idea what it means. Can anyone help with this?

Debug Message:
Sending message...
AT+CMGS="1-972-277-1763"%13%
49 53>%13%%10%>
Hello World!%26%%13%
49 73>%13%%10%> %13%%10%+CMS ERROR: 3518%13%%10%
Message sent


Code:
#include <GSM.h>
#include <GSM3CircularBuffer.h>
#include <GSM3MobileAccessProvider.h>
#include <GSM3MobileCellManagement.h>
#include <GSM3MobileClientProvider.h>
#include <GSM3MobileClientService.h>
#include <GSM3MobileDataNetworkProvider.h>
#include <GSM3MobileMockupProvider.h>
#include <GSM3MobileNetworkProvider.h>
#include <GSM3MobileNetworkRegistry.h>
#include <GSM3MobileServerProvider.h>
#include <GSM3MobileServerService.h>
#include <GSM3MobileSMSProvider.h>
#include <GSM3MobileVoiceProvider.h>
#include <GSM3ShieldV1.h>
#include <GSM3ShieldV1AccessProvider.h>
#include <GSM3ShieldV1BandManagement.h>
#include <GSM3ShieldV1BaseProvider.h>
#include <GSM3ShieldV1CellManagement.h>
#include <GSM3ShieldV1ClientProvider.h>
#include <GSM3ShieldV1DataNetworkProvider.h>
#include <GSM3ShieldV1DirectModemProvider.h>
#include <GSM3ShieldV1ModemCore.h>
#include <GSM3ShieldV1ModemVerification.h>
#include <GSM3ShieldV1MultiClientProvider.h>
#include <GSM3ShieldV1MultiServerProvider.h>
#include <GSM3ShieldV1PinManagement.h>
#include <GSM3ShieldV1ScanNetworks.h>
#include <GSM3ShieldV1ServerProvider.h>
#include <GSM3ShieldV1SMSProvider.h>
#include <GSM3ShieldV1VoiceProvider.h>
#include <GSM3SMSService.h>
#include <GSM3SoftSerial.h>
#include <GSM3VoiceCallService.h>

// PIN number if necessary
#define KEY "My Key"
#define PINNUMBER "The SIM's PIN"

// APN data
#define GPRS_APN       "bluevia.movistar.es" // replace your GPRS APN
#define GPRS_LOGIN     ""    // replace with your GPRS login
#define GPRS_PASSWORD  "" // replace with your GPRS password

// initialize the library instances
GSMClient client;
GPRS gprs;
GSM gsmAccess(true);// Pass this for debugging
GSM_SMS sms(true);

char server[] = "arduino.cc"; // the base URL
char path[] = "/"; // the path
int port = 80; // the port, 80 for HTTP

// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "1-000-000-0000";  

// char array of the message
char txtMsg[200]="Test";

boolean messageSent = false;

void setup()
{
  // initialize serial communications
  Serial.begin(9600);
  Serial.println("Starting Arduino setup");
  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // pass the PIN of your SIM as a parameter of gsmAccess.begin()
  while(notConnected)
  {
    if(gsmAccess.begin()==GSM_READY){
      Serial.println("GSM is Ready");
      notConnected = false;
      if(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY){
        Serial.println("GPRS is Ready");
        notConnected = false;
        delay(1000);
      }
      else{
        Serial.println("GPRS is not ready");
        delay(1000);
      }
    }
    else
    {
      Serial.println("GSM is not ready");
      delay(1000);
    }

  }

  Serial.println("GSM and GPRS is initialized");

}

void loop() {
  
  if(!messageSent){
    Serial.println("Sending message...");
    sms.beginSMS(remoteNumber);
    sms.print("Hello World!");
    sms.endSMS();
    messageSent = true;
    Serial.println("Message sent");
  }
  
}

« Last Edit: May 04, 2014, 11:09:56 pm by ecolara3 » Logged

Madrid (Spain)
Offline Offline
Full Member
***
Karma: 0
Posts: 137
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you have to put the telephone number without '-'.
Logged

Johannesburg, South Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First just include GSM.h - not all the individual modules.h

Second - the tel number must have no dashes and be a valid number - the sample below seems odd?

3rd - run the library examples first and insert your details to test the shield - it makes getting started much easier
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
A student, and a programmer wannabe.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem resurfaces again. I can no longer send SMS. What's wrong. Below are the outputs.

Code:
102 120>%19%%17%AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
120 8>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
8 19>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
19 25>%13%%10%OK%13%%10%
GSM initialized
Enter a mobile number: 98997412
Now, enter SMS content: SENDING

Message:
gsm access true
AT+CMGS="98997412"%13%
25 29>%13%%10%>
gsm access true%26%%13%
COMPLETE!
Logged

Madrid (Spain)
Offline Offline
Full Member
***
Karma: 0
Posts: 137
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

AT+CMGS command have to reponse +CMGS: <number>, or a +CMS ERROR: <err> if an error occurred. In that output, the response isn't printed. Try to see it.
Logged

Leeds, England, (dis)UK
Offline Offline
God Member
*****
Karma: 16
Posts: 706
Quick, chuck it in the bin before the boss finds out...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try sending your message to the international style telephone number of the receiving device.
Logged

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Pages: [1]   Go Up
Jump to: