Hi,
I have a strange issue with my GSM Shield (SIM900 GSM / GPRS Module Shield IComSat).
This shield was working fine connected HardwareSerial when I last looked at it a week or so ago. Today I came back to carry on with the development and found the GSM AT commands no longer seemed to work ( I use them to send and receive SMS and make calls in my project). On the Mega, an "AT" command was echoed back at 9600 (The board was set to 57600 baud for my project) but the GSM response of OK never came.
I disconnected the board from the Mega and attached it to a UNO for testing using the code below, connected SoftwareSerial to pins 7 and 8 (Rx, Tx). See here if you want to see how the board is generally connected. I also have pins 6 & 9 connected to pin 6 & 9 respectively on the shield. Strangely the AT commend does not get echoed back on the Uno.
// Serial Relay - pass UART information between
// the computer and a software serial connection
#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8); // RX, TX
//#define GPRS Serial2
long myarray[10]= {300,1200,2400,4800,9600,19200,38400,57600,74880,115200} ;
int i = 0;
void setup()
{
GPRS.begin(myarray[i]); //Should have auto naud rate but does not appear to work, set to 57600 using AT+IPR=57600
Serial.begin(115200);
// Set PIN 9 to Power On the GPRS
pinMode(9, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(6, HIGH);
Serial.println(myarray[i],DEC);
}
void loop()
{
while(GPRS.available()) {
byte b = GPRS.read();
Serial.print("In RX - byte:");
Serial.write(b);
Serial.print(" Dec:");
Serial.println(b);
}
while (Serial.available()) {
byte b = Serial.read();
//Serial.write(b);
if ( b == '*')
GPRS.write( 0x1a ); // replace * with ctrl+z
else if ( b == '~')
GPRSReset(); // if ~ reset and turn off then on
else if ( b == '#')
GPRSPower(); // if # turn on power
else if ( b == '^'){
i++;
if (i > 9 ) i = 9;
GPRS.begin(myarray[i]);
Serial.println(myarray[i],DEC);
}
else
GPRS.write(b);
}
}
//*******************************************************************************
// Toggle GORS power on or off
//*******************************************************************************
void GPRSPower()
{
digitalWrite(9, LOW);
delay(1000);
digitalWrite(9, HIGH);
delay(2000);
digitalWrite(9, LOW);
delay(1000);
}
void GPRSReset()
{
digitalWrite(6, LOW);
delay(200);
GPRSPower();
delay(2000);
digitalWrite(6, HIGH);
delay(200);
GPRSPower();
digitalWrite(6, HIGH);
}
I've tried changing the baud rates, using the hat char (^), and also tried to reset the board, nothing seems to work.
So I thought the only way I couldget receive data was to text the GSM module. When I do this I get data at most low baud rates but never intelligible. See the output, above 19200 all that is returned is 0.
Considering it used to work, I think the board may now be scrap but wondered if anyone had any ideas. I have a 12v supply connected and I wonder whether this has fried something (From what I can find it can take up to 17v DC). It's surprising though that the phone still works, I just can't talk to it :o
GSM Out.txt (7.14 KB)