title: Arduino read AT Commands from Quectel M95 GSM Module
body: <p><strong>Objective</strong>: Submit AT Commands to the Quectel M95 (GSM2 Click <a href="http://www.mikroe.com/click/gsm2/" rel="nofollow noreferrer">http://www.mikroe.com/click/gsm2/</a>) via SoftwareSerial/Arduino and parse responses; no Arduino GSM library.</p>
  
  <p><strong>Current condition</strong>: Able to fully communicate with the M95 via terminal at a variety of baud rates (9600 - 115200). AT Commands can be submitted and the desired result codes are present. I have tried with a different modem (DroneCell) with same results. All wiring has been checked 10 times and verified correct. If I submit AT commands via SoftwareSerial I know the modem is receiving the data as I can send an SMS, enact GPRS, etc; just can't get valid responses.</p>
  
  <p><strong>Issue</strong>: Arduino is unable to read GSM Module responses using the below code. Result is garbled text/chars - variable and unpredictable. The expected response when submitting AT Command "AT" is "OK."</p>
  
  <p><strong>Images</strong>:</p>
  
  <p>Success via terminal:</p>
  
  <p><img src="https://i.stack.imgur.com/0r3UK.gif" alt="enter image description here"></p>
  
  <p>Arduino response:</p>
  
  <p><img src="https://i.stack.imgur.com/0PDXj.gif" alt="enter image description here"></p>
  
  <pre><code>#include &lt;SoftwareSerial.h&gt;
  
  #define rxPin 10
  #define txPin 11
  
  SoftwareSerial mySerial(rxPin,txPin); // RX, TX
  
  void setup(){
  
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
  
    Serial.begin(9600);
    Serial.println("Arduino serial initialized!");
    delay(10);
  
    mySerial.begin(9600);
    Serial.println("Software serial initialized!");
    delay(10);
  }
  
  void loop(){
    issueCommand("AT");
    readSerial();
    delay(500);
  
  
    while(true){
      readSerial();
    }
  }
  
  void issueCommand(char* msg){
    mySerial.println(msg);
    Serial.print(msg);
    delay(10);
  }
  
  void readSerial(){
    while (mySerial.available()){
      Serial.write(mySerial.read());
      delay(10);
    }
  }
  </code></pre>