A6 GSM is introduced by the makers of ESP8266 , AI-THINKER.
The module is much cheaper than SIM900 & connections are quite simple.In this post we shall see how to connect with Arduino to make a call & send SMS.
A mobile adapter is enough to power up the A6 GSM module.The Vcc pin of GSM must be looped with PWR_KEY pin.This acts as a chip enable.You can leave this connected or remove after a moment.The module just requires a HIGH trigger at PWR_KEY pin while started.
A valid SIM is used at the back side of the module.The SIM slot provided is for a Micro SIM.If you ‘ve a Nano SIM you need to use a converter to fit the slot.
The RxD pin of A6 GSM is connected to Tx of Arduino
The TxD pin of A6 goes to Rx of Arduino.
GND pin of A6 to GND of Arduino.
Power up the module & then after a moment make a call to the SIM number used in the GSM module from another phone.If you get the RING Back tone , it means the module is ready.As there is no LED indication provided , this initial step is required to confirm working.
Making a CALL
Connect the USB cable of PC to Arduino & upload this code for making a call.Remember to disconnect connections at Rx/Tx before uploading the code.
The mobile number to be called is stored in an Array of char variable.
In the void setup() code we begin Serial communication at 9600 baud.Though the default baud rate of A6 GSM is 115200 , it is effective to use 9600 baud .
ATD command followed by the number to be called is used to make a call.
A semicolon at the end is not a must as in SIM900.The call will be made even if you do not use a semicolon.
After a delay of 8 secs ATH command is sent to terminate the call.
You can open the Serial monitor of Arduino & watch the AT commands landing.You should set the baud rate as 9600 in the Serial monitor as well.
The void loop() function is left empty.In case you try the code inside loop , the call will be repeatedly
made for ever.
Now let us see the method to send SMS.
Following screenshot shows the code for sending SMS.
DOWNLOAD Arduino code HERE
which will allow you to read and write SMS messages as strings instead of hexadecimal characters.
Serial.println is used to send the AT command with a New line (Enter).
After a delay of 2 seconds next command
is sent.The target phone number is to be given within double quotes. Note the usage of
Serial.write(0x22) which is the ASCII equivalent for double quotes.
0D followed by 0A are the ASCII equivalents for CARRIAGE RETURN & LINE FEED.
The delay of 2 seconds is a must after setting the GSM to text mode AT+CMGF=1
Try this code without the delay , you won’t get response.
After the 0D , 0A a delay of 2 seconds is provided & then the message to be sent is given.
CTRL+Z is finally given to send the message.
This is provided by the ASCII equivalent 1A or char(26)
Watch this video :