Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Arduino SIM300 help in reading SMS
Moderators: adafruit_support_bill, adafruit

Forum rules
Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!
Please be positive and constructive with your questions and comments.

Arduino SIM300 help in reading SMS

by PallaviN on Sun Oct 06, 2013 10:55 pm

Hello,

I am new to micro controller programming.I am trying to connect SIM300 with Arduino duelmilanove ATmega168.

I was able to send SMS,call and other functions required for my project.I was even able to receive data from SIM300.Now I stuck at reading SMS from Memory.

For testing the reading part of my code is as follows:
Code: Select all | TOGGLE FULL SIZE
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
const int buttonPin = 5;
int index = 0;
boolean stringComplete = false;  // whether the string is complete
String inputString = "";
int buttonState = 0;


void setup() {
  // initialize serial:
  mySerial.begin(9600); // the GPRS baud rate
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  //inputString.reserve(1200);
   mySerial.println("AT");
   delay(2000);
}

void loop() {
  mySerialEvent();
  // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println("Loop input String = " + inputString + "...");
    // clear the string:
     inputString = "";
    stringComplete = false;
  }
 
  buttonState = digitalRead(buttonPin);
  if (buttonState == LOW) { 
      mySerial.println("AT+CMGF=1");
      delay(2500);
      mySerial.print( "AT+CMGR=1" );
  }
  }


void mySerialEvent() {
 
  while (mySerial.available()) {
    // get the new byte:
    char inChar = (char)mySerial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
  //Serial.println("Outside while inputstring=" + inputString + "...");
}
 


I am able to read and get all other response but for reading SMS from memory...it keep coming out of while loop before reading the complete msg...It keep truncating the msg at time of the SMS.

Output is as follows:
Code: Select all | TOGGLE FULL SIZE
AT+CMGR=1
+CMGR: "REC READ","phonenumber","","9/9/13,03:40:


Please help me resolve this issue.

Thanks,
Pallavi
PallaviN
 
Posts: 1
Joined: Sun Oct 06, 2013 10:42 pm

Re: Arduino SIM300 help in reading SMS

by adafruit_support_mike on Thu Nov 07, 2013 2:49 pm

I'm afraid that's not one of our products, so we don't have any in-house experience working with it.

Your best source for information would be the vendor who sold you the device in the first place. See if they have datasheets or sample code that you can use as a reference.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.