Today, GSM networks are widely-used, whether for making calls or sending SMSes. But some places need urgent messages like in colleges, railway stations, events, share market and so on, and this information should be in real-time. This GSM based messaging using Arduino project is an experiment to give a start to the era of sending messages in real-time. It is about writing the message, which is to be displayed on mobiles, and sending it as an SMS to the receivers. The received message is fetched into a microcontroller (MCU) and, after authentication, is displayed on an LCD screen.
Circuit and working
Circuit shown in Fig. 1 operates using a 12V power supply (connected across CON1). An Arduino MCU requires only 5V but a GSM modem requires 12V. As Arduino Uno has an inbuilt 5V voltage regulator, a common 12V supply can be used for the whole system.
The brain of the circuit is Arduino Uno MCU board (BOARD1). A 16×2 LCD display (LCD1) is used for receiving and displaying the messages. Pins of LCD1, namely, RS, EN, D4, D5, D6 and D7 are connected to Arduino digital pins 12, 11, 5, 4, 3 and 2. When you want to show some information or message, you send an SMS to the GSM modem. Then, Arduino’s MCU reads the GSM modem and sends it to the LCD. Here, the LCD is used in 4-bit mode, which means only four data lines are required to display the data.
GSM modem SIM900A (connected with CON2 and CON3) sends the commands in text mode to Arduino Uno using an RS232 interface. CON3 is connected with DB9 connector of the GSM modem. RS232 voltage levels are at ±12V, whereas both MCU input and output operate at 0V to +5V. Since RS232 is not compatible with the MCU, MAX232 (IC1) is utilised to enable the communication between the GSM modem and Arduino Uno by converting RS232-level signals to TTL-level signals. Rx (DB9.3) and Tx (DB9.2) pins of the GSM modem are connected through IC1 at Tx and Rx pins of Arduino, respectively.
The code written in Arduino can communicate with the GSM modem using AT commands. AT commands are sent or received from the modem using serial communication functions provided by Arduino library.
Serial.begin(9600) function helps to initialise the serial port with a baud rate of 9600.
Serial.available() function is always called before reading a data byte from the serial port of Arduino. This function returns a positive value when the data byte reception is complete; otherwise, it returns a non-positive value. It serves the purpose of waiting till the data byte reception is complete, so that there are no errors in reading the data byte.
Serial.read() function reads a data byte from the serial port of Arduino. It can return the data byte, which can then be stored in a variable or used for some condition check.
GSM modem responds OK when it receives command AT.
This is the best way to check communication between the modem and the MCU.
+CMGF command is used to set the SMS mode. Either text or PDU mode can be selected by assigning 1 or 0 in the command.
+CNMI AT command is used to specify how newly-arrived SMSes should be handled. It can be used to set the GSM/GPRS modem or mobile phone either to route the received SMS messages directly to the serial port or to save these in message storage and then notify the host device by sending a string through the serial port.
For example, to route the received message string to the serial port of the device, the code written for this project uses AT+CNMI=2,2,0,0,0 command.
Once an SMS is received, the GSM modem sends a long string to Arduino board, which consists of many details regarding the message including the original text. The code is written in such a way that it waits till any character is received through the serial port. Once it starts receiving, it checks for the occurrence of sixth ‘ “ ’ and writes the rest of the characters directly into the 16×2 LCD. Characters after the sixth ‘ “ ’ in the received string is the original text.
Download source code
Construction and testing
A single-side PCB pattern of the wireless notice board is shown in Fig. 2 and its component layout in Fig. 3. For convenience, we have designed the PCB as an Arduino shield. You can modify the design as per requirement. Also, you can test PCB with Arduino board using a cable connector.
Download PCB and component layout PDFs: click here
Download the program in Arduino. Connect CON2 and CON3 with the GSM modem power and DB9 connector, respectively. Insert a SIM card in the GSM modem SIM slot. Power on the PCB using 12V supply to CON1. Send the SMS to the inserted SIM card number. LCD1 as well as Arduino serial port will display the message.
My intention is to get new message from the simwhich is mounted in the ‘sim 900a’ and display in the lcd.will this project do the same thing.need little clarification and also need complete code for this project.
thanks you sir.
Please I NEED MORE OF THIS WORK
Sir I want to know that what does the CON1 and CON2 in this circuit.
These connectors are for 12V power supply
where can I find the code for this project