How to send SMS from GSM modem using arduino

This article explains about Text messaging using GSM modem. Here we are sending TEXT messages from GSM modem with Arduino UNO using AT commands.send SMS from GSM modem using arduino

Arduino code 
void setup()
 //Set Exact Baud rate of the GSM/GPRS Module.
 /*Replace XXXXXXXXXX to 10 digit mobile number &  ZZ to 2 digit country code*/
 //The text of the message to be sent.
 Serial.print("HELLO WORLD");   
void loop()

The set of operation code is placed in the void setup (). Each time when the Arduino is powered ON’s an SMS will send, as the void setup function only run once. Or Resetting the Arduino board (press the reset switch on the Arduino board) also sends a message.

In the AT commands,

AT+CMGF=1\r,  put the modem in SMS text format mode.

AT+CMGS=\”+ZZ XXXXXXXXXX\”\r, The SMS will send to the 10 digit  number written as XXXXXXXXXX with 2 digit country code ZZ.

Here the TEXT is “Hello world”, replace it with the TEXT need to be sent.

0x1A, it is the hexadecimal of decimal character code 26, which is  Substituted (SUB) symbol in ASCII control characters.

Refer: GSM module Hardware interface with Arduino

1 Star2 Stars3 Stars4 Stars5 Stars Rate Us!

You may also like...

4 Responses

  1. Pradeep Bhikaji Thombre says:

    Sir how to send current location via sms to phone using gsm module and aurdino

  2. tamil says:

    Sir how to store the data from ultra sonic for every 15mins and stored data’s are to be averaged{(15 +15+15+15) ÷4} by 1 hour.finally the one hour data to send the receiver.plz send the coding logic to my mail

    • admin says:

      This is the complete code to display almost all the available data in the GPS. If you need only the latitude and longitude values use the code given in the article.

      #include <SoftwareSerial.h>
      #include <TinyGPS.h>
      TinyGPS gps;
      SoftwareSerial serialgps(4,3);
      int year;
      byte month, day, hour, minute, second, hundredths;
      unsigned long chars;
      unsigned short sentences, failed_checksum;
      void setup()
      Serial.println("GPS Shield QuickStart Example Sketch v12");
      Serial.println(" ...waiting for lock... ");
      void loop()
      int c =; 
      float latitude, longitude;
      gps.f_get_position(&latitude, &longitude);
      Serial.print("Lat/Long: "); 
      Serial.print(", "); 
      Serial.print("Date: "); Serial.print(month, DEC); Serial.print("/"); 
      Serial.print(day, DEC); Serial.print("/"); Serial.print(year);
      Serial.print(" Time: "); Serial.print(hour, DEC); Serial.print(":"); 
      Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC); 
      Serial.print("."); Serial.println(hundredths, DEC);
      Serial.print("Altitude (meters): "); Serial.println(gps.f_altitude()); 
      Serial.print("Course (degrees): "); Serial.println(gps.f_course()); 
      Serial.print("Speed(kmph): "); Serial.println(gps.f_speed_kmph());
      Serial.print("Satellites: "); Serial.println(gps.satellites());
      gps.stats(&chars, &sentences, &failed_checksum);

Leave a Reply

Your email address will not be published. Required fields are marked *