GSM module M95 Qucetel with Arduino Due rev 3

I have been working with the M95 module and the Arduino Uno for two weeks now, and finally it works 95%.

First it is essential that one uses an external power source, 6-12 V, in the pin Vin and GND on the M95-module.

Then the module cannot be placed direct on the duo-board due to that pin #0 and #1 are used by UART for communication with the serial monitor.

Third, after having tried to use pin #2 and #3 on arduino with corresponding setup in SoftwareSerial, I got amounts of funny characters when listening on the TX-port (M95-module), I changed it to A4 and A5. All problems are gone :slight_smile:
AND whats also good to know, is that if You program the Arduino AND You leave out the "Serial.begin(xxxx)", that is You do not send anything or read anything with the ordinary Serial-command, then You set the RX to pin 0 and TX to pin 1, and connect the GSM-mudule directly on the Arduino, and it works great! This means You have to inactivate thouse lines in the sketch.

Fourth: It seems that the RX-pin on M95-module shall be connected to the pin You setup in the sketch as RX. That was confusing as I always have connected RX to TX and viceversa. But if I set up "SoftwareSerial mySerial(A4, A5)", and connect M95-#0 to A4 and M95-#1 to A5, everything works.

Fifth: You must connect GND on Arduino to one GND-pin on the M95-module.

Sixth: You must set pin #8 and #10 on M95-module to HIGH, inorder to power up the module and be able to communicate with it.

As You will discover the sketch here also listen after recieved SMS, which will be printed on the monitor. BUT there is some limitations about the amount of characters to recieve and print om the monitor. I think the arduino and SoftwareSerial is a bit limited there. But You will be able to send long messages :slight_smile: frpm the arduinoFörformatterad text. I think the mentioned limitations are from buffersize in softwareSerial, 64 bytes

Here is a sketch for sending SMS:

#include <SoftwareSerial.h> 

#define RX A4  //Define A4 as RX
#define TX A5  //Define A5 as TX
#define PWK 8  //pin 8 must be sett HIGH in order to power on the module POWERKEY ON
#define ENABLE 10  //pin 10 must be HIGH in order to communicate with M95

char text[150];   
String message="";
int i;
   
SoftwareSerial mySerial(RX,TX);

void setup() {
  pinMode(PWK, OUTPUT);
  pinMode(ENABLE, OUTPUT);

  gsmOn();  //Starta modulen

  Serial.begin(9600);  //Initiate software serial
  while(!Serial){  //waiting for Serial to be TRUE
    ;
  }
  Serial.println("Serial communikation is open");
  
  mySerial.begin(57600);
  delay(10);
  Serial.println("Serial com via M95 is now opend!");
  delay(5000);
  mySerial.println("AT+CNMI=1,2,0,0,0"); // Decides how newly arrived SMS messages should be handled

  Serial.println("Write your SMS:"); 
}

void loop(){   

i=0;   
while( Serial.available()>0 ){     
 text[i] = Serial.read();   
 message += text[i];   
 i++;   
 if (text[i-1]==10){  
  Serial.println("Send SMS......");  
  SendTextMessage();  
  ShowSerialData();  
  delay(1000);   
  Serial.println("Success");   
  message="";  
  i=0;  }}
  ShowSerialData();  
  delay(1000);
}  


void SendTextMessage(){ 
  
mySerial.print("AT+CMGF=1\r"); 
delay(1000);  
mySerial.print("AT+CMGS=\"+46123456789\"\r");  //Change this number to landcode+phone
delay(1000);  
mySerial.println(message);  
mySerial.print("\r");  
delay(1000);  
mySerial.write(26);  
 }  


void ShowSerialData(){  

while(mySerial.available()!=0)  
 Serial.write(mySerial.read());}

void gsmOn() {
  digitalWrite(PWK, HIGH);
  digitalWrite(ENABLE, HIGH);
}


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.