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

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


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
  // reserve 200 bytes for the inputString:

void loop() {
  // 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.print( "AT+CMGR=1" );

void mySerialEvent() {
  while (mySerial.available()) {
    // get the new byte:
    char inChar = (char);
    // 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 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
+CMGR: "REC READ","phonenumber","","9/9/13,03:40:

Please help me resolve this issue.

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.

Posts: 61439
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.