Hi - I've been having a bit of a problem receiving SMS messages with a SIM900 GSM shield (one of [ur=http://linksprite.com/wiki/index.php5?title=SIM900_GPRS/GSM_Shieldl]these[/url] to be precise). I'm finding that after the first 13 characters are received, aside from a couple of random characters, the remainder of the message is lost.
The test message I am sending is "The quick brown fox jumps over the lazy dog". If I send it three times, the following is what is displayed in the serial monitor (I have hidden my phone number for obvious reasons!):
ÿÿÿÿÿÿÿÿ
RDY
+CFUN: 1
+CPIN: READY
Call Ready
AT+CM
+CMT: "+447*********","","14/09/11,11:01:12+04"
The quick browud
+CMT: "++447*********","","14/09/11,11:01:59+04"
The quick brow z
+CMT: "++447*********","","14/09/11,11:02:13+04"
The quick brow
I have been fiddling with this shield since I bought it a few days ago and this issue has gotten worse over that time. Initially I would have to send a very long message to get the gobbledegook at the end, now it consistently can't seem to handle more than 13 characters without breaking.
I am using the following code on an Uno:
#include "SoftwareSerial.h"
// define GSM shield pins
SoftwareSerial SIM900(7, 8);
// container for text messages received
char incoming_char=0;
void setup(){
// open comms to the serial monitor
Serial.begin(115200);
// initialise the GSM shield
SIM900.begin(19200); // for GSM shield
SIM900power(); // turn on shield
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
}
void loop() {
while (SIM900.available() > 0)
{
incoming_char=SIM900.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(12000);
}