I'm unable to get a proper response from my GSM modem300, sometimes it responds with nothing, sometimes it replies half of line of ONE message from full inbox, sometimes it just sends the command (AT+CMGR=1) I just sent, back many times.

Print screens:

I'm using Arduino, directly connecting the Tx and Rx of board to Rx and Tx of arduino, and GND to Arduino GND.


char incomingByte=0; 
void setup() 

 void loop()
    while (Serial.available() > 0) 
       incomingByte = Serial.read();              
       if(incomingByte!='\n'){ Serial.print(incomingByte); }
       if(incomingByte=='\n'){ Serial.print(incomingByte); }              

It might be worth mentioning that, I can send messages properly, and make and receive calls with no problem.

  • \$\begingroup\$ responds with half line of one message from FULL inbox!: imgur.com/zsmDcIc \$\endgroup\$
    – user280353
    Jan 14, 2014 at 10:17
  • \$\begingroup\$ responds with garbage: imgur.com/vTVSwyf \$\endgroup\$
    – user280353
    Jan 14, 2014 at 10:18
  • \$\begingroup\$ sorry to do this, -_-' site won't let me post more than 2 links. \$\endgroup\$
    – user280353
    Jan 14, 2014 at 10:19
  • \$\begingroup\$ Instead of posting links of images of GUI windows of text, could you cut & paste the text? Use small representative samples (not pagefulls) \$\endgroup\$ Jan 14, 2014 at 10:23
  • \$\begingroup\$ You are reading from serial in incomingByte and sending same byte on same serial! I am bit suspicious about this! And Not about problem, But You are doing same thing in if(incomingByte != '\n') and if(incomingByte == '\n') ... Why to write two conditions! \$\endgroup\$
    – Swanand
    Jan 14, 2014 at 10:24

1 Answer 1


See http://arduino.cc/en/Tutorial/SoftwareSerialExample

By using the same serial port to communicate with a modem and to communicate with your PC, you are causing confusion.

  • You are echoing the modem's reply back to the modem.
  • Modems usually echo commands back to you.

I'd use separate channels as shown in the Arduino serial tutorial.

Last time I did something like this (with an Arduino communicating with a MIDI serial device) I used a 16x2 LCD to display what was being received. But you could use software serial if you prefer (or don't have a character LCD)

  • \$\begingroup\$ Thanks GrittyBrick, I've tried software serial in a different way, now I'll try it again with the same code design and see what happens. If it works I'll let you know. \$\endgroup\$
    – user280353
    Jan 14, 2014 at 10:54
  • \$\begingroup\$ Still no luck, this is the reply: f~`8AT+CMGR=1 +CMGR: "REC READ","52266001",,"08/08/19,12:09:0 \$\endgroup\$
    – user280353
    Jan 14, 2014 at 11:36
  • \$\begingroup\$ no message body, not even other message headers \$\endgroup\$
    – user280353
    Jan 14, 2014 at 11:39
  • \$\begingroup\$ What happens if you replace the GSM modem with a wire link? Back in the day, we used to use a Peripheral And Processor Electronic Reactive Communications Link Interface Probe (P.A.P.E.R.C.L.I.P.) \$\endgroup\$ Jan 14, 2014 at 11:54
  • \$\begingroup\$ Getting the command replied back to me on hardware Serial, but on Software Serial I'm getting gibberish; diff baud rates too. \$\endgroup\$
    – user280353
    Jan 14, 2014 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.