In this workshop we shall see how to control a GSM board with ARDUINO
Hardware required :
ARDUINO UNO board GSM 300 or 900 board
12v DC adapter for GSM board Connecting wires
The connection is simple.We shall use the Hardware Serial port of ARDUINO (pin 0 & pin 1).
Pin 0 (RX) of Arduino is connected to RX pin of GSM
Pin 1 (TX) of Arduino is connected to TX pin of GSM
General Rule is always TX to Rx & Rx to Tx.But the GSM board I’m using has a MAX232 level converter IC & the Tx ,Rx printed on board is that of MAX232’s T1 IN & R1 OUT.
Do not get confused .Always ensure that
Rx of Arduino (pin 0) goes to pin 11 (T1 IN) of Max232
Tx of Arduino (pin 1) goes to pin 12 (R1 OUT) of Max 232.
As we use TTL level logic we need not bother about the presence of 232 IC.
Do not power the GSM from Arduino.Use a separate adapter of minimum 1Amp rating.
Make GND pins of both GSM & Arduino common.
To start with place a valid SIM to the holder on the GSM board.Connect the power adapter to GSM.
Now dial a call from another phone to the SIM number & ensure that you get a Ring back tone .
This is the initial test to confirm that your GSM is ready to accept commands from Arduino.
Making a Call from GSM
First we shall see how to Dial a number.
We make use of AT commands to control a GSM.
Here are the Steps you do for making a call
1.Wake up GSM by giving AT command .
2.Dial a number using command ATDphone_no; ATD followed by phone number & a Semicolon.
3.Now the call is made.To hang the call feed ATH command.
The above steps are converted to code as below:
//Code for Dialling a number
Serial.begin(9600); //Open Serial Connection at baudrate 9600
Serial.println(“AT”); // Wake up GSM
Serial.print(“ATD”); //Dial the phone number using ATD command
Serial.println(“;”); // Semicolon is a must at the end
Serial.println(“ATH”); // After a delay of 5 secs Hang the call
// empty loop.If you enter the above code here,the call will be made FOR EVER repeatedly.
//Take Caution while coding under loop.At some condition you’ve to terminate the Call
Please note that you’ve to disconnect GSM from Arduino while Uploading the code to Arduino .
While issuing ATH command use Serial.println & not Serial.print.This println is to send Carriage
Return after the ATH command.Note the reasonable amount of Delay (10secs) used after issuing the ATD command.
This delay is mandatory for GSM to respond.
Sending SMS from GSM
Now we shall see the procedure to send SMS through GSM.
1.Wake up GSM by sending AT command
2.The GSM should be put on Text mode by feeding command AT+CMGF=1
3.Now give command AT+CMGS=”Mobile_number”
4.Verify whether the Modem responds with a > character
5.After getting > symbol ,feed your Message to SMS.
6.Press CTRL+Z to send the SMS.
The above steps are coded for Arduino to handle automatically
//Code to send SMS from Arduino
char phone_no=”9443303461″; //phone number
Serial.begin(9600); //Open Serial connection at baud 9600
Serial.println(“AT+CMGF=1”); //set GSM to text mode
Serial.print(“Test Message from Arduino GSM….HELLO..!!!”); //SMS body
Serial.write(0x1A); // sends ctrl+z end of message
Serial.write(0x0D); // Carriage Return in Hex
Serial.write(0x0A); // Line feed in Hex
//The 0D0A pair of characters is the signal for the end of a line and beginning of another.
Feed the above code in Arduino IDE & upload it.Do not forget to Disconnect GSM from Arduino
while uploading the code.
If you copy & paste the above code,you may get compile error.Type in the code wherever error is indicated.
Note the usage of Hex codes 0x1A for sending ctrl+z
0x0D for Carriage Return & 0x0A for LineFeed.
Watch this Video on making a Call &Sending SMS using Arduino & GSM :
The GSM & ARDUINO boards are available at :