For the tutorial and example code click here:
https://www.youtube.com/watch?v=alq7UJxiDQo
GSM A6 modules:
Size: 22.8x16.8x16.8 mm
Working temperature: -30 °c to + 80 °c
Working voltage: 3.3 V to 4.2 V
Start voltage: > 3.4 V
Standby average current: Under 3mA
Support the GSM/GPRS four frequencies, including 850, 900, 1800, 1900MHZ
Sensitivity: < - 105
Support voice calls
Support SMS messages
Support GPRS data service, maximum data rate, download 85.6Kbps, upload 42.8 Kbps
Support standard GSM07.07, 07.05 the AT command and the expansion of Ai Thinker command
Support two serial port, a download serial port, an AT command port
Command support standard AT and TCP/IP command interface
Support digital and analog audio, support HR, FR, EFR, AMR speech coding;
Support the ROHS, FCC, CE, CTA certification;
42 pin SMT packaging
Arduino sample code:
#include <SoftwareSerial.h>
const int ArdRx = 4; // A6 TX to Arduino D4
const int ArdTx = 2; // A6 RX to Arduino D2
const String phoneNumber= "+923005930028"; //Enter phone number here
const String messageInit = "GSM A6 ready";
SoftwareSerial A6GSM(ArdRx, ArdTx); //Establishing serial connection
void Response(){ //Function waiting for "OK"
int a = 0;
Serial.println();
while(1){
if(A6GSM.available()){
String dataFromA6 =A6GSM.readString();
dataFromA6.trim();
Serial.println(dataFromA6);
a++;
if(dataFromA6.indexOf("OK")>0){break;}
}
if(a>500){a=0;break;}
delay(200);
}
}
void startAT(){ //Function used for synchronization, sending AT command to GSM
int nbAT = 0;
while(1){
if (nbAT==0){A6GSM.println("AT");Serial.print(".");}
if(A6GSM.available()){
String dataFromA6 =A6GSM.readString();
dataFromA6.trim();
Serial.println(dataFromA6);
if(dataFromA6.indexOf("OK")>0){break;}
}
delay(200);
nbAT++;
if(nbAT++>10){nbAT=0;}
}
}
void envoieSMS(String numeroEnvoi, String messageEnvoi) { //Function used to send sms
delay(200);
Serial.println("Mode of GSM, \"SMS\"");
A6GSM.println("AT+CMGF=1");
Response();
delay(200);
Serial.println("Test message");
A6GSM.print("AT+CMGS=\"");
A6GSM.print(numeroEnvoi);
A6GSM.println("\"");
delay(200);
A6GSM.print(messageEnvoi);
delay(200);
A6GSM.println (char(26));
Response();
}
void setup() {
A6GSM.begin(9600); //GSM serial connection establishment
Serial.begin(9600); //Arduino serial connection establishment
delay(200);
Serial.println("Initializing");
startAT(); //Start AT
envoieSMS(phoneNumber,messageInit);
}
void loop() {
}