How to Send SMS Using GSM Modem

In this article we are going to learn, how to send SMS using GSM modem which is controlled by Arduino. Let us see, what GSM modem is, how to interface it with Arduino, how to send SMS with the setup.

By: Girish Radhakrishnan

We are also going to explore what are all applications we can achieve with GSM modem other than sending text message by a human.

What is GSM modem?

GSM stands for Global System for Mobile communications; it is a standard which was developed by ETSI (European Telecommunications Standard Institute) who described the protocols for 2G communication.

It is the first digital protocol for mobile communication which is optimized for full duplex voice communication. In a nutshell full duplex communication means both the parties can send/receive data (or voice) simultaneously.

The GSM protocol also allows transfer of packet data, such as GPRS and EDGE.

SIM800 GSM modem:

GSM modem is a hardware which accepts a valid SIM card (Subscriber Identity Module), basically any SIM will work, which supports GSM protocol and with a network subscription.

It is like a mobile phone without Screen and keypad. It has four I/O pins depending on the model you choose.

Two for TX and RX (transmit and receive), another two pins for VCC and GND, which is common in all.

It also consist of RS232 port for serial communication between the modem and computer, however we are not going to use in this project.

It has standard DC power jack, which can be powered from external power sources such as voltage adapters.

It has working voltage ranging from 5 to 12V on DC jack, depending on the model. It has 3 LED indicators, for power, status, and network.

The power LED indicates the presence of power, status LED indicates whether the GSM modem is operating or not, the Network LED indicates the establishment of mobile network.

Initially network LED blinks every one second while searching for network, once it establishes the mobile network it blinks every 3 seconds.

You need to press power button for 2 to 3 seconds for activating the GSM modem, once you done, it latch to the mobile network.

To verify that your GSM modem works, just call the number of which you have inserted the SIM card. You should get ring back tone. If it does, then your module is working fine.

We are going to use SIM800 GSM modem which supports quad-band 850/900/1800/1900 MHz. if you own a SIM900 modem, need not to worry, the program and circuit is compatible in this project.

Now, you would have gained some idea about GSM modem, now let’s learn how to interface it with arduino.

Circuit Diagram:

As you can infer form the diagram, the circuit connection is dead easy. You just need 3 male to female header pins. A USB cable is mandatory in this project, as we are going to communicate via serial monitor.

Always, power the GSM modem with external adaptor. The power from arduino is insufficient for the GSM modem; it could even overload the voltage regulator of the arduino.

That’s all about hardware part. Now, let’s move to coding.


//-------------Program developed by R.Girish---------------//
#include <SoftwareSerial.h>
#define rxPin 9  // gsm TX------> arduino 9
#define txPin 8  //gsm RX--------> arduino 8
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
char text[150];
String message="";
int x;
void setup()
while (!Serial){}
Serial.println("Write your message (with dot at end):");
void loop()
while( Serial.available()>0 )
text[x] =;
message += text[x];
if (text[x-1]==46)
Serial.println("Your message is sending......");
void SendTextMessage()
mySerial.print("AT+CMGS="+91xxxxxxxxxx"r");  // Replace x with your 10 digit phone number
void ShowSerialData()
//-------------Program developed by R.Girish---------------//

Don’t forget the dot (.) at every end of the message, otherwise it won’t sent the message to prescribed number in the program. Replace x with your 10 digital phone number in the program. Make sure you have a working SMS plan on your SIM card.

If you are not from India, please change the country code in the program.

For example:

For UK: +44
For US: +1
For Canada: +1
For Russia: +7

You can also automate the message which is sent by GSM modem by coding Arduino appropriately. You can receive automated message alerts on your phone such as: anti-theft alert, fire alarm alert, weather alert on your local area etc.

You can even connect to internet with GPRS in GSM modem, but it is subject of another article.

In one of the forth coming articles we will learn How to Receive SMS Using GSM Modem and Arduino

If you have further questions regarding how to send SMS using GSM Modem , feel free to ask in the comment section.

Need Help? Please send your queries through Comments for quick replies! And please Bookmark my site :)


madhu shankar said…
hello sir,
i am not getting the reply from gsm module..can you lease help to how to get the reply..and there was a error showing in the program at in this line
if we given like shown below its not showing any error

Contact me for Customized Circuits


Email *

Message *

 Follow on G+  Follow on Facebook   Follow on Tweeter  Follow on G+  Follow on G+

Follow Homemade Circuits