Introduction
In this article, I'll show you how can we use the GSM900 module using the Arduino Mega GSM-Global System For Mobile. The GSM module supports communication in the 900MHZ band. In India, most of the mobile network providers operate in the 900MHZ band. In the majority of the United States, the bandwidth provider is around (850-1900MHZ).
Requirements
- Arduino Mega
- Bread Board
- GSM900 Module
- Led
- Some Jumper Wires

Figure 1: Arduino Mega

Figure 2: Bread Board
- RX Pin to Arduino Mega 15
- TX Pin to Arduino Mega 16
- Gnd to Gnd
- Led Anode Pin to 13
- Cathode Pin to Gnd
Programming
Serial.available()
It reads all data available on the serial buffer.
And let's move to the function called void sndmsg():
It is the one type of the function we created in the Arduino Mega to send the SMS. First we want to set the GSM to the text mode; this can done through the "AT" commands AT means Attention we can send the sms through the serial port while writing ("AT+CMGF") and ("AT+CMGS=\"XXXXXXXXXX"\"\r") and set some delay time then upload the program to the Arduino mega board and open the serial monitor windows type "Hello C# Corner Iam Sending SMS Through GSM" and click send button. The SMS will send to the concert mobile number that you have been given in the code.
Test: It is used to check whether the command is supported to Modem or Not.
Syntax: AT<Command name>=?
- #include<SoftwareSerial.h>
- SoftwareSerial firstSerial(15,16); RX/TX
- int led=13;
- void setup()
- {
- pinMode(led,OUTPUT);
- firstSerial.begin(9600);
- Serial.begin(9600);
- delay(100);
- }
- void loop()
- {
- if(Serial.available()>0)
- digitalWrite(led,HIGH);
- switch(Serial.read());
- }
- void sndmsg()
- {
- firstSerial.println("AT+CMGF=1");
- delay(1000);
- firstSerial.println("AT+CMGS=\"+xxxxxxxxxx\"\r"); //Enter Your Mobile Number instead XXXX while Testing
- delay(1000);
- firstSerial.println("Hello C# Corner Iam Sending SMS Through GSM");
- delay(100);
- firstSerial.println((char)23);
- delay(1000);
- }
Explanation
We start with softwareserial.h library into the program in the next line creates the constructor for the serial port such as RX and the TX. In the Arduino Mega board 15 pin act as RX pin and 16 pin act as the TX pin while using the Arduino Uno "0" pin as TX "1st" pin as RX .void setup() In the setup() function we want to set the baud rate for the GSM because we want to communicate with the device to the Serial Monitor so we want to set the BaudRate as (9600) and set the delay time as 1000 I,e 1Sec and Now let's move to actual program void loop() is the one type of the condition function based upon our condition our GSM will work first we check the availability of the serial ports.
- if(Serial.available()>0)
To check any data that are coming to the serial port of the Arduino if it is available means the led will be on, else it will not be on Serial.read().
- firstSerial.println("AT+CMGF=1");
- delay(1000);
- firstSerial.println("AT+CMGS=\"+xxxxxxxxxx\"\r");
- delay(1000);
- firstSerial.println("Hello C# Corner Iam Sending SMS Through GSM");
- delay(100);
- firstSerial.println((char)23);
- delay(1000);
AT Command
AT Command is used to check the connection between the module and the computer.
CMGF: The Command is used to set the SMS mode.
E.g: ("AT+CMGF=<mode>" )
CMGS: The Command is used to send the SMS from the module to the device.
E.g: ("AT+CMGS=\"<mode>\">
Types of the "AT" Commands:

Figure 3: AT Commands Classification
Read: The Read Command is used to get the mobile phone number.
Syntax: AT<Command name>?
Set: The Set command is used to modify the mobile phone settings.
Syntax: AT<Command name>=value1...value N
Execution command
The execution command is used to make some operations.
Syntax: AT<Command name>=parameter1,....parameterN
Some Commonly used AT Commands for SMS Text Mode are:
| AT Command | SMS Text Mode |
| AT+CMGS | Send Message |
| AT+CMGR | Read Message |
| AT+CMGD | Delete Message |
| AT+CMGL | List Message |
| AT+CSAS | Save Settings |
| AT+CRES | Restore Settings |
"AT" Commands used in the following services:
- SMS Service
- MMS Service
- Fax Service
- Information and configuration pertaining to the mobile device.
- Data and voice link communication over to the mobile network.
Read more articles on the Internet of Things:

Delpin Susai RajPosted Aug 28, 2016, 4:43 AM
Nice
Kumaresh RajalingamPosted Feb 12, 2016, 6:51 AM
Thank u Gowtham sir
Gowtham KPosted Feb 11, 2016, 11:02 AM
Good One, Thanks for Sharing:)
Kumaresh RajalingamPosted Feb 11, 2016, 5:26 AM
Thank u Shubam Sir
Shubham KumarPosted Feb 11, 2016, 2:18 AM
nice
Kumaresh RajalingamPosted Feb 11, 2016, 1:52 AM
Thank u Sibeesh Sir
Sibeesh VenuPosted Feb 11, 2016, 1:51 AM
Nice Share
Kumaresh RajalingamPosted Feb 10, 2016, 8:07 PM
Thank u Mohammed sir
Kumaresh RajalingamPosted Feb 10, 2016, 8:07 PM
Thank u Santhakumar sir
Kumaresh RajalingamPosted Feb 10, 2016, 8:07 PM
Thank u SR
Sr KarthigaPosted Feb 10, 2016, 7:59 PM
Nice article keep it up
Mohammed IbrahimPosted Feb 10, 2016, 7:52 PM
nice
Santhakumar MunuswamyPosted Feb 10, 2016, 2:16 PM
Thanks for nice article