How to Send Message from GSM Module using Arduino
The GSM stands for Global System for Mobile communications. This is a global standard which is followed by the GSM modules inside the cellular phones which enables them to be connected with any mobile network around the globe. 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 systems can also send messages to the user to alert or inform about the status of the system running.
In all such cases a separate GSM module is used rather than using the mobile phones. 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.
This particular project demonstrates how to interface a GSM module and send SMS to other mobile numbers using an Arduino board. The AVR microcontroller boards which are provided with all the basic circuitry for the operation of the microcontroller which has been flashed with the Arduino boot-loader are called Arduino boards. The Arduino IDE is so simple to use that anyone who has basic knowledge of c programming can quickly get started with it. The project on how to get started with the Arduino explains about the steps required to get start with an Arduino board. The Arduino can communicate with the other devices using its digital I/O, serial port, I2C port, SPI port etc. and in this project the GSM module is interfaced using the serial port of the Arduino board.
The Arduino is open source hardware where the hardware schematic is open anybody can use those schematic to develop their Arduino board and distribute. 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 Arduino board used in this project is the Arduino pro-mini board and the IDE version of the Arduino is 1.0.3 for windows. The image of the Arduino pro-mini board and the Arduino IDE are shown below:
Since the arduino pro-mini board has no circuitary 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.
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.
In this particular project 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.
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:
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.
AT+CMGS – This command is used to send the SMS from a GSM module. The command should be followed by the number to which the message needs to be sent. After a Carriage return one can send the SMS text to the GSM module which is then send after it receives a <CTRL+Z>
The syntax for sending a SMS using the AT commands with a GSM module is shown below;
SYNTAX : AT+CMGS=”mobile_number” <ENTER><write the text><CTRL+Z>
For example to send an SMS “hello” to the number 123456789 the following command can be used;
AT+CMGS=”123456789”<ENTER>hello<CTRL+Z>The code is written in such a way that it will automatically send exactly the same commands to the GSM module using the serial communication functions and hence making them to send an SMS to the specified number in the code. The ENTER key is represented in the code using ‘\r’ and the CTRL+Z is represented using an ASCII value of 26.
Try to send the command using the PC with the help of any serial monitoring software and make sure that the module is sending message to the specified number. Then 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. Once the board is reset after successfully uploading the code the Arduino sends the same command to the GSM module enabling it to send SMS to the number specified in the code.
For more detail: How to Send Message from GSM Module using Arduino
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
This Post / Project can also be found using search terms:
- make door bell arduino send email
- arduino phone project
- arduino programming of a motor and gsm module
- basic gsm module module to send message