Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

By Ajish Alfred June 21, 2022

In certain applications the microcontroller based systems has to be connected with the GSM network which will enable a user to control the system by sending messages or making a call. The advantage of using a GSM communication with a system or device is that the user can control the system wirelessly no matter how far it is kept compared to any other wireless communication, provided that both the user and the device should be in a cellular coverage area.

The mobile phones have built in GSM modules which then be used by the processor inside the phone to make a call, send or receive message or even connect with the GPRS network.  When it comes to a microcontroller based system a separate GSM module is used rather than using a cell phone as such.  There are GSM modules available which can do serial communication with microcontroller based systems. The communication is done by sending or receiving AT commands with the GSM module. This particular project demonstrates how to interface a GSM module and read and display SMS on the 16*2 LCD.

Any AVR microcontroller based board which follows the standard Arduino schematic and is flashed with the Arduino bootloader can be called an Arduino board. The Arduino is refered to as open source hardware and the Arduino IDE is also open source and anybody can contribute their libraries to the Arduino. All arduino boards should be compatible with the Arduino IDE which can be used to program the Arduino boards.


 

The working of this project is explained based on the Arduino pro-mini board and the IDE version 1.0.3 for windows. The advantage of this board is that it comes in very small in size; any kind of connectors can be soldered on its periphery according to our requirements. It is very breadboard friendly and occupies very less space of a typical breadboard.

The image of the Arduino pro-mini board and the Arduino IDE are shown below:

Fig. 2: Typical Arduino Pro-Mini Board

Fig. 3: Arduino IDE Software Window

Since the Arduino pro-mini board has no circuitry for interfacing it with the serial port or the USB port of the PC, an external USB to TTL converter board is required to connect it with the PC. This hardware helps in programming the Arduino board and also helps in the serial communication with the USB port of the PC.

Fig. 4: External USB to TTL converter board for programming Arduino and serial communication

It is assumed that the reader has gone through the project how to get started with the Arduino and tried out all the things discussed there. The GSM module used in this project is a SIM900 based module which can communicate with other devices using RS232 serial communication port. It works on 9V power supply and the image of the same is given below:

Fig. 5: SIM900 GSM Module connected to Tx pin of Arduino board module through max232

The GSM module is connected with the Arduino board using the serial communication port. Since the module has RS232 port and the Arduino pro-mini can communicate using TTL logic levels a max232 IC is used to make a bi-directional conversion between the RS232 and TTL logic levels. The Tx pin of the Arduino board is connected to the Rx pin of the GSM module through the max232 and the Rx pin of the Arduino is connected to the Tx pin of the GSM module using max232 itself.

The code written in the Arduino is able to communicate with the GSM module using AT commands. The AT commands are send or received from the module using the serial communication functions provided by the Arduino library. The functions like Serial.begin() which helps to initialize the serial port with a given baud rate, Serial.write() to send a data to the serial port, Serial.available() and Serial.read() functions to read data from the serial port are used in this project and they are already discussed in previous projects on how to do serial communication with the Arduino, how to send and receive serial data using arduino and how to do serial debugging with the Arduino.

GSM modules respond “OK” when it receives the command “AT” and it is the best way of check communication between the module and the microcontroller.

+CMGF – This command is used to set the SMS mode. Either text or PDU mode can be selected by assigning 1 or 0 in the command. 

SYNTAX:         AT+CMGF=<mode>

0: for PDU mode

1: for text mode

 For example, 

AT+CMGF=1

+CNMI- This AT command is used to specify how newly arrived SMS messages should be handled. It can be used to set the GSM/GPRS modem or mobile phone either to route a received SMS messages directly to the serial port, or to save them in message storage and then notify the host device by sending a string through the serial port.

SYNTAX:         AT+CNMI=<mode>

For example to route the received message string to the serial port of the device, the code written for this project uses the following command;

AT+CNMI=2,2,0,0,0

Once a SMS is received the GSM module sends a long string to the Arduino board which consists of so many details regarding the message and also includes the original text.  The code is written in such a way that it will wait till any character is received through the serial port and once starts receiving it will check for the occurrence of fourth ‘ ” ’ and write the rest of the characters directly into the 16*2 LCD. The characters after the fourth ‘ “ ’ in the received string will be the original text and the rest of the characters are ignored in the code using the following lines;

    do

    {

        while ( !Serial.available() );   

    } while ( ‘”‘ != Serial.read() );

    do

    {

        while ( !Serial.available() );   

    } while ( ‘”‘ != Serial.read() );

    do

    {

        while ( !Serial.available() );   

    } while ( ‘”‘ != Serial.read() );

    do

    {

        while ( !Serial.available() );   

    } while ( ‘”‘ != Serial.read() );  

The SMS text is written to the 16*2 LCD using the functions from the library <LiquidCrystal.h> which can be used to interface an external LCD module with the Arduino board. The functions which can be used to access the LCD are already discussed in previous projects on how to interface an LCD, how to display sensor value on LCD, how to connect the LCD with the PC and how to make an LCD scrolling display.

One can verify and upload the code which can send the same commands to the Arduino board as explained in the project how to get started with the Arduino. Make sure that the GSM module has been turned on at least 2 minutes before the Arduino board starts sending the commands so that the GSM can establish a communication with the cellular network corresponding to the SIM card inserted in it.

You may also like:

  • beginners guide
    Basic Electronics 01 – Beginners guide to setting up an…

  • What are the top tools for developing embedded software?

  • What is the Modbus protocol and how does it work?

  • What is a Robot Operating System (ROS)?

  • What is FreeRTOS?

  • What is LiDAR and how does it work?

Project Source Code

###




/*============================ EG LABS ===================================//

 Demonstration on how to receive an SMS using GSM module


 The circuit:

 LCD:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 7

 * LCD D5 pin to digital pin 6

 * LCD D6 pin to digital pin 5

 * LCD D7 pin to digital pin 4

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD pin 3

 * LED anode attached to digital output 9

 * LED cathode attached to ground through a 1K resistor


 GSM:

 RX PIN OF GSM TO TX0 PIN OF ARDUINO 

 SHORT THE GROUND PINS OF ARDUINO AND XBEE

============================== EG LABS ===================================*/



#include 

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);


// give the pin a name:

int led = 9;

// incoming serial byte

int inByte = 0;         


void setup()

{

  pinMode(9, OUTPUT);     

  lcd.begin(16, 2);

  lcd.print("ENGINEERS GARAGE");

  lcd.setCursor(0, 1);

  lcd.print("   GSM SMS  ");

  delay(1000);

  

  // initialize the led pin as an output.

  pinMode(led, OUTPUT);  

  // start serial port at 9600 bps

  Serial.begin(9600);

  // wait for a while till the serial port is ready

  delay(100);


// send the initial data once //    

  Serial.print("AT+CMGF=1nr");

  delay(500);

  Serial.print("AT+CNMI=2,2,0,0,0nr");

  delay(2000);

  

  digitalWrite(led, HIGH);       

}


void loop()

{

    do

    {

        while ( !Serial.available() );    

    } while ( '"' != Serial.read() );

  

    do

    {

        while ( !Serial.available() );    

    } while ( '"' != Serial.read() );

  

    do

    {

        while ( !Serial.available() );    

    } while ( '"' != Serial.read() );

    

    do

    {

        while ( !Serial.available() );    

    } while ( '"' != Serial.read() );

    

    while ( !Serial.available() );

    inByte = Serial.read();     

    while ( !Serial.available() );

    inByte = Serial.read();

    

    lcd.clear();

    while(1)

    {

        while ( !Serial.available() ); 

        inByte = Serial.read();

        

        if ( inByte == 'r' )

          break;

        else;

        

        lcd.write ( inByte );

    }

}

###

 


Circuit Diagrams

Circuit-Diagram-Receiving-SMS-Using-GSM-Module-Arduino

Project Components

  • Arduino Pro Mini
  • Capacitor
  • LCD
  • LED
  • MAX232
  • Potentiometer
  • Resistor

Project Video


Filed Under: Arduino Projects, Electronic Projects
Tagged With: Arduino, gsm, sms
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions.

  • Soft-start re-arm for UC1842A
  • Incremental Delta-Sigma
  • Why does nobody talk about the actual cost of a single PCB layout mistake in production?
  • Simulator phantom DC level in Current sense transformer
  • Symmetrical tail inductor simulation in SonnetSuite

RSS Electro-Tech-Online.com Discussions

Featured Tutorials

Learn - AWS IoT Tutorials

  • How to enable device-to-device messaging on AWS IoT Core using MQTT
    How to enable device-to-device messaging on AWS IoT Core using MQTT
  • How to connect Raspberry Pi to Amazon AWS IoT Core using MQTT
    How to connect Raspberry Pi to Amazon AWS IoT Core using MQTT
  • How to connect ESP32 to AWS IoT Core using MQTT
    How to connect ESP32 to AWS IoT Core using MQTT
  • How to connect a computer to AWS IoT Core
    How to connect a computer to AWS IoT Core
  • Arduino compatible coding 02: Getting started with Arduino
    Arduino compatible coding 02: Getting started with Arduino
  • Arduino compatible coding 03: Basics of Arduino sketches and Embedded C
    Arduino compatible coding 03: Basics of Arduino sketches and Embedded C
More Tutorials >

Recent Articles

  • Nuvoton launches Cortex-M23 MCU for measurement
  • Synopsys launches 1.6T ESUN IP solution
  • Samtec introduces 35-pin bus connectors for UxV
  • Infineon launches UWB chip for secure access
  • Sensata launches dual-trigger HV protection device

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe