Problem receiving sms from arduino mega ADK board arduino shield

After using the arduino sms message code to test the shield I received the following:

SMS Messages Sender
GSM initialized
Enter a mobile number: 1-917-93x-xxxx
Now, enter SMS content: SENDING

Message:
This is a test

COMPLETE!

Enter a mobile number:

I type the mobile with and without the dashes and leading 1 at the beginning of the number but still did not get the test on the phone. I am using the arduino mega ADK board with arduino shield. I jump pin 10 and pin 2 as noted for this board.

Anyone having this issue, can I get some help, thanks in advance, Clinton.

A full mobile number is +xx the country code ..

Hi,

I added external power to the board and and change to GSM gsmAccess(true), I got the following but still did not received the test on my phone.

SMS Messages Sender
AT%13%
0 9>AT%13%%13%%10%OK%13%%10%
AT+CGREG?%13%
9 40>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
40 71>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
71 102>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
102 5>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
5 36>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
36 67>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
67 98>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
98 1>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
1 32>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
32 63>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
63 94>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
94 125>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
125 28>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
AT+CGREG?%13%
28 59>AT+CGREG?%13%%13%%10%+CGREG: 0,5%13%%10%%13%%10%OK%13%%10%
AT+IFC=1,1%13%
59 76>AT+IFC=1,1%13%%13%%10%OK%13%%10%
AT+CMGF=1%13%
76 94>%19%%17%AT+CMGF=1%13%%13%%10%OK%13%%10%
AT+CLIP=1%13%
94 110>AT+CLIP=1%13%%13%%10%OK%13%%10%
ATE0%13%
110 121>ATE0%13%%13%%10%OK%13%%10%
AT+COLP=1%13%
121 127>%13%%10%OK%13%%10%
GSM initialized
Enter a mobile number: 191793xxxxx
Now, enter SMS content: SENDING

Message:
This is a test
AT+CMGS="191793xxxxx"%13%
127 3>%13%%10%>
This is a test%26%%13%
127 21>%13%%10%> %13%%10%+CMGS: 7%13%%10%%13%%10%OK%13%%10%

COMPLETE!

Enter a mobile number:

Your first reply:

tgsuperspec:
A full mobile number is +xx the country code ..

So in the States you start with +1, the UK +44, India +91, followed by the network / location code, and then the subscriber number.

Yes, in the U.S. we start with 1 which is listed as the first number.

The x's in the number is just to block the remaining numbers.

I am working on a project for my school, can I get help from someone at arduino?

You prefix the 1 with the plus symbol. Are you doing that?

Thank you very much, by putting the + in front the number I am able to see the text appear on my phone.

I was working on the following program when I get this error loading the program:

Global variables use 1,023 bytes (12%) of dynamic memory, leaving 7,169 bytes for local variables. Maximum is 8,192 bytes.
avrdude: verification error, first mismatch at byte 0x0000
0x14 != 0x0c
avrdude: verification error; content mismatch

I am using the Adruino Mega ADK board.

This all happen when I change this code "onModulePin= 10;" from pin 10 to pin 2

I cannot upload any other program to memory, Is it a memory issue or chip problem. If memory issue, how can I clear? Is anyone know what this problem is?

I am trying to code this program so I won't to use the serial monitor to enter phone and message.

Any help with this avrdude error...

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

int8_t answer;
int onModulePin= 10;
char aux_string[30];
char phone_number[]="+191793xxxxx";

void setup(){

pinMode(onModulePin, OUTPUT);
//Serial.begin(115200);
Serial.begin(9600);

while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.println("Starting...");
//power_on();

delay(3000);

// connection state
boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}

Serial.println("GSM initialized");
}

Serial.print("Setting SMS mode...");
sendATcommand("AT+CMGF=1", "OK", 1000); // sets the SMS mode to text
Serial.println("Sending SMS");

sprintf(aux_string,"AT+CMGS="%s"", phone_number);
answer = sendATcommand(aux_string, ">", 2000); // send the SMS number
if (answer == 1)
{
Serial.println("Test-Arduino-Hello World");
Serial.write(0x1A);
answer = sendATcommand("", "OK", 20000);
if (answer == 1)
{
Serial.print("Sent ");
}
else
{
Serial.print("error ");
}
}
else
{
Serial.print("error ");
Serial.println(answer, DEC);
}

}

void loop(){

}

void power_on(){

uint8_t answer=0;

// checks if the module is started
answer = sendATcommand("AT", "OK", 2000);
if (answer == 0)
{
// power on pulse
digitalWrite(onModulePin,HIGH);
delay(3000);
digitalWrite(onModulePin,LOW);

// waits for an answer from the module
while(answer == 0){ // Send AT every two seconds and wait for the answer
answer = sendATcommand("AT", "OK", 2000);
}
}

}

int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

uint8_t x=0, answer=0;
char response[100];
unsigned long previous;

memset(response, '\0', 100); // Initialice the string

delay(100);

while( Serial.available() > 0) Serial.read(); // Clean the input buffer

Serial.println(ATcommand); // Send the AT command

x = 0;
previous = millis();

// this loop waits for the answer
do{
// if there are data in the UART input buffer, reads it and checks for the asnwer
if(Serial.available() != 0){
response[x] = Serial.read();
x++;
// check if the desired answer is in the response of the module
if (strstr(response, expected_answer) != NULL)
{
answer = 1;
}
}
// Waits for the asnwer with time out
}while((answer == 0) && ((millis() - previous) < timeout));

return answer;
}

I doubt that this will make any difference, but are you programming it without anything (sheilds, etc) attached?

If you are then I would suggest posting in a different section - try the first one, Installation - if it's wrong the mods will move it. The error isn't specifically related to the shield as far as I'm aware.

Hello, can someone review this code and tell me why the Arduino GSM shield take so long to connect to the network. If I connect one or three time today then I can only connect the next day. The time between the connection is extremely long.

/*
Project.
*/

#include <Stepper.h>
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

//SR04_Range_Finder and Speaker pins
#define trigPin 9
#define echoPin 8

#define speakerPin 31 //Speaker pin

//Stepper Motor
int motorPin1 = 46; //Green wire
int motorPin2 = 47; //Blue wire
int motorPin3 = 48; //Brown
int motorPin4 = 49; //Gray

//Switch button and led
const int ledPin = 44; //led attached to this pin
const int buttonPin = 42; //the push button attach to this pin
const int readyPin = 40; //Light Led when switch is ready

const int analogPin = 0; //A0 Alcohol sensor pin

int buttonState = LOW; //What's the state of the button, whether push or not
int val, avg,i,caron=0;
int Steps2Take;
long duration, distance;
char remoteNum[13]="+1917xxxxxx"; // telephone number to send sms
char txtMsg1[49]="Hi Mom its Johnny, My Car won't start, fail test";
char txtMsg2[54]="Johnny is having a cardiac problem, Pulse is too high";

#define STEPS 64 // Number of steps per revolution

Stepper small_stepper(STEPS, motorPin1, motorPin3, motorPin2, motorPin4);

// Pulse Sensor VARIABLES
int pulsePin = 1; // Pulse Sensor purple wire connected to analog pin 1
int blinkPin = 4; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin
int hazardLedPin = 6; //pin to send hazard warning
int counter_IBI = 0, counter_BPM = 0, Killcnt = 0;

// Pulse - these variables are volatile because they are used during the interrupt service routine!
volatile int BPM; // used to hold the pulse rate
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // holds the time between beats, the Inter-Beat Interval
volatile boolean Pulse = false; // true when pulse wave is high, false when it's low
volatile boolean QS = false; // becomes true when Arduoino finds a beat.volatile int speakerPin = 12;

//GSM Variables
int timeTosend=1;
int count=0;
char phone_no[]="xxxxxxxx"; // phone number

void setup(){
//Initialize Pulse sensor pins
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
pinMode(speakerPin,OUTPUT); // pin that will fade to your heartbeat!
pinMode(hazardLedPin,OUTPUT); //pin that will blink to hazard situation

Serial.begin(9600); // we agree to talk slow!

delay(2);

interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
small_stepper.setSpeed(200);

//Initialize - set the mode of the push button and ready pins
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
pinMode(readyPin, OUTPUT);

//Initialize Range finder and Speaker pins
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(speakerPin, OUTPUT);

boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
}

void loop(){
int i_cnti = 0, i_cntb = 0;
val=0,i=0,avg=0;
if(caron==0){
digitalWrite(readyPin, HIGH); //turn on ready led
//digitalWrite(ledPin, HIGH); //turn on led
for(i=0;i<20;i++){ //read breathalyzer
val=analogRead(analogPin);//Read Alcohol sensor value from analog 0
delay(100);
avg=avg+val; //* time interval input
}
avg=avg/20;
Serial.println(avg,DEC); //Print the value to serial port
buttonState = digitalRead(buttonPin);//read button

if((buttonState == HIGH) && (avg > 300) && (avg < 500) && (Killcnt == 0))//if breath is checked and below alcohol value - start engine
{
caron=1;
digitalWrite(readyPin, LOW); //turn off ready led
digitalWrite(ledPin, HIGH); //turn on blue led to show car running
small_stepper.setSpeed(300);
Steps2Take = 400; //Rotate cw
small_stepper.step(Steps2Take);
delay(20);

small_stepper.setSpeed(300);
Steps2Take = -400; //Rotate ccw
small_stepper.step(Steps2Take);
delay(20);

buttonState = digitalRead(buttonPin);
//digitalWrite(ledPin, LOW); //turn off led
}
else if(avg > 800){
sms.beginSMS(remoteNum);
sms.print(txtMsg1);
sms.endSMS();
Killcnt++;
for(int h = 0; h < 4; ++h){
digitalWrite(hazardLedPin, HIGH);
delay(100); // wait for a second
digitalWrite(hazardLedPin, LOW); // turn the LED off by making the voltage LOW
delay(200);
}
Serial.println(txtMsg1);
}

}

if(caron==1){
//distance sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
// Serial.println(distance); //Print the value to serial port

//Pulse processing
// sendDataToProcessing('S', Signal); // send Processing the raw Pulse Sensor data
if (QS == true){ // Quantified Self flag is true when arduino finds a heartbeat
fadeRate = 255; // Set 'fadeRate' Variable to 255 to fade LED with pulse
sendDataToProcessing('B',BPM); // send heart rate with a 'B' prefix
sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix
// sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix
QS = false; // reset the Quantified Self flag for next time
}

ledFadeToBeat();

//Range finder
//if((distance<40)||(BPM>130))
if(distance<40)
{
for(i=0;i<100;i++){
digitalWrite(speakerPin, HIGH);//speaker beep
delay(1);
digitalWrite(speakerPin, LOW);
delay(1);
}
}

//Alert to put hand on staring wheel
if((IBI > 200) && (IBI < 330)){
counter_IBI++;
if(counter_IBI >= 1000) {
counter_IBI = 0;

for(i=0;i<100;i++){
digitalWrite(speakerPin, HIGH);//speaker beep
delay(2);
digitalWrite(speakerPin, LOW);
delay(2);
digitalWrite(speakerPin, HIGH);//speaker beep
delay(2);
digitalWrite(speakerPin, LOW);
delay(2);
}
}

//Serial.println(counter_IBI);
}

//Serial.println(counter_IBI);
//Alert to activate hazard light and hand on staring wheel and call home
if((BPM > 120) && (BPM < 200) && (IBI > 480) && (IBI < 506)){
sms.beginSMS(remoteNum);
sms.print(txtMsg2);
sms.endSMS();
Serial.println(txtMsg2);

for(int h=0;h<4;++h){
digitalWrite(hazardLedPin, HIGH);
delay(100); // wait for a second
digitalWrite(hazardLedPin, LOW); // turn the LED off by making the voltage LOW
delay(100);
}

for(i=0;i<100;i++){
digitalWrite(speakerPin, HIGH);//speaker beep
delay(2);
digitalWrite(speakerPin, LOW);
delay(2);
digitalWrite(speakerPin, HIGH);//speaker beep
delay(2);
digitalWrite(speakerPin, LOW);
delay(2);
}

}

}//end car on

}//end main

void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}

void sendDataToProcessing(char symbol, int data ){
Serial.print(symbol); // symbol prefix tells Processing what type of data is coming
Serial.println(data); // the data to send culminating in a carriage return
}

Please, can someone look at the posting on Apr. 23, 2015, I am schedule to do a presentation soon. The idle time for the GSM to connect is extremely long.