Parse Received SMS - SIM900 GSM

Hey guys,

I have a problem with the parsing of received sms via my sim900 module. I can’t figure out since 6 hours how exactly this kind of process could be programmed.

It’s a very easy task (i thought): I want to receive a sms and save it in a string for further usage. But i can’t either print the sms via the serial port or save it in a string.

Do you know some functioning solutions?
Serial 1 is PC to/from Arduino and Serial 3 is to/from GSM module.

Would be thankful for every answer! :slight_smile:

Here my Code:

unsigned char buffer[100] = "0"; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array
char Benutzer1[] = "+436606587778"; 

void setup()
    Serial3.begin(19200);               // the GPRS baud rate
    Serial.begin(19200);             // the Serial port of Arduino baud rate.

void loop()
    if (Serial3.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
        receivesms();                       // set counter of while loop to zero

    if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
    Serial3.write(;       // write it to the GPRS shield

void receivesms()
  Serial3.print("AT+CMGL=\"REC UNREAD\"\r");

  while(Serial3.available())          // reading data into char array
    buffer[count++];     // writing data into array
    if(count == 100)break;

  Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
    //for(int i=0;i<=100;i++)  //Also don't work, here i only get numbers in the array?
  count = 0;

Thor2018: Serial 1 is PC to/from Arduino and Serial 3 is to/from GSM module.

You are NOT using Serial1 for PC communication, you are using Serial.

Try getting rid of all your delay() and flush() calls. They are most likely unnecessary.

As an aside: I suggest learning about how to write code with consistent and easy to read formatting

Also, change

unsigned char buffer[100] = "0";


unsigned char buffer[100] = '0';