gsm modem interfacing with 8051 code
#1

source code for interfacing gsm with 8051 so as ti send and receive messages in ASM
Reply
#2
gsm modem interfacing with 8051 code

GSM is widely used mobile communication architecture used in most of the countries. This project demonstrates the interfacing of microcontroller AT89C51 with HyperTerminal and GSM module. It aims to familiarize with the syntax of AT Commands and their Information Response and Result Codes. The ASCII values of characters in the Information Response, Result Codes and their syntax can be monitored by an LED array. For the basic concepts, working and operation of AT commands and GSM module refer GSM/GPRS Module.The main principle of this circuit is to interface a GSM modem with the microcontroller. The microcontroller used is AT89C51 microcontroller. To communicate with GSM modem, AT commands are required. Microcontroller sends these commands to the GSM modem, which is then activated to perform the required operation.

Circuit Design of Interfacing of GSM Modem to AT89C51 Microcontroller:

The circuit of interfacing GSM to AT89C51 microcontroller mainly consists of GSM modem and 8051 family microcontroller. GSM has RS232 interface for serial communication. In between the GSM module and the microcontroller MAX232 IC is connected.

MAX232 IC is used for converting the logic levels. RS232 logic levels of GSM are converted to the TTL logic levels of the microcontroller using this MAX232 IC. MAX232 IC has 16 pins. This is a dual driver IC as it has two transmitters and receivers. Interfacing of GSM to AT89C51 microcontroller uses only one transmitter and receiver. The transmitter pin T1IN of max232 is connected to the transmitter pin of the microcontroller. The receiver pin R1out of the max232 is connected to the receiver pin of the microcontroller. The T1out pin of the IC is connected to the transmitter pin of the GSM modem. The R1IN pin of the IC is connected to the receiver pin of the GSM modem. Two 0.1 micro farad capacitors are connected to the pins of 1, 2 and 4 , 5. Another 1uf capacitor is grounded from pin6 and another capacitor is connected to the supply of 5v from the through the 2nd pin of the IC.

GSM modem used here has sim300 module. These wireless modems communicate with the microcontrollers and other devices. This has 4 pins compatible to TTL logic. These can be directly connected to the microcontroller as it has max232 or use the DB9 connector to connect to the controller. In this article, MAX232 pins are connected to the GSM modem. This should be connected to the power supply of 5v. It has a sim slot similar to a mobile to communicate with the network. GSM modem requires AT commands for activation. GSM modem responds to the AT command.

An LCD module is connected to the port2 of the microcontroller. This article also shows the interfacing of 4-bit LCD module to the microcontroller. Data bits D4-D7 of the LCD module are connected to the port2 of the microcontroller. A pot is connected to the LCD to adjust the intensity of the display. Here LCD is used for displaying the received message.A button is connected to the PORTB of the microcontroller. This button is used for sending a message.

How to Operate GSM Interfacing with 8051 Microcontroller Circuit?
Initially, connect the circuit as shown in the circuit diagram. Switch on the power supply. Now send a message from any other phone to the SIM present in the GSM module. Whenever a message is received by the GSM, it is displayed on the LCD. If you want to send a message press the button B1 connected to port B. This sends a message written in the code.

GSM Modem Interfacing with 8051 Circuit Applications:

This can be used in automatic accident detection and indication along with GPS.
This can also be used to control a robot.
This can also be used in GSM based telemedicine system.
ATM theft precaution system uses this to indicate the theft.
GSM based voting system uses this application.
GSM based vehicle security system uses this.
This circuit can be used in GSM based green house parameter monitoring system
Limitations of the Circuit:

Although GSM has many advantages there are some limitations. This cannot be used in applications where immediate result is required as it may not work if there are no signals.

8051 Primer Board The 8051 Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port. NXP’s 8051 (89V51RD2), 8051 Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit Microcontrollers. GSM (Global System for Mobile Communication) GSM is a digital mobile telephony system. GSM digitizes and compresses data, then sends it down a channel with two other streams of user data, each in its own time slot. It operates at either the 900 MHz or 1800 MHz frequency band. Interfacing GSM Fig. 1 shows how to interface the GSM with microcontroller. The GSM module is communicate the microcontroller with mobile phones through UART. To communicate over UART or USART, we just need three basic signals which are namely, RXD (receive), TXD (transmit), GND (common ground). GSM modem interfacing with microcontroller for SMS control of industrial equipments. The sending SMS through GSM modem when interfaced with microcontroller or PC is much simpler as compared with sending SMS through UART. Text message may be sent through the modem by interfacing only three signals of the serial interface of modem with microcontroller i.e., TxD, RxD and GND. In this scheme RTS and CTS signals of serial port interface of GSM Modem are connected with each other. The transmit signal of serial port of microcontroller is connected with transmit signal (TxD) of the serial interface of GSM Modem while receive signal of microcontroller serial port is connected with receive signal (RxD) of serial interface of GSM Modem. The SMS message in text mode can contain only 140 characters at the most. It depends upon the amount of information collected from GPS Engine that you need at the base station for tracking vehicle or person.

Interfacing GSM with 8051 We now want to display a text in mobile from 8051 Primer Board by using GSM module through UART. In 8051 Primer Board contains two serial interfaces that are UART0 & UART1. Here we are using UART0. The GSM modem is being interfaced with the microcontroller 8051 Primer Board for SMS communication. The SMS can be sending and receiving for the data sharing and situation information and control.

To compile the above C code you need the KEIL software. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In Keil, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without 8051 Primer Board.

The Flash Magic software is used to download the hex file into your microcontroller IC 8051 through UART0.

Testing the GSM with 8051

Give +5V power supply to 8051 Primer Board; connect the +9V adapter with GSM module which is connected with 8051 Primer Board through UART0. Open the Hyper Terminal screen, select which port you are using and set the default settings. Now the screen should show some text messages.

The following Commands and sequence of events performed for sending text message to a mobile phone through GSM Modem interfaced with microcontroller:

First select the text mode for SMS by sending the following AT Command to GSM Modem : AT+CMGF = 1 . This command configures the GSM modem in text mode.Send the following AT Command for sending SMS message in text mode along with mobile number to the GSM Modem : AT+CMGS =+923005281046 . This command sends the mobile number of the recipient mobile to the GSM modem.Send the text message string ("GSM Modem Test") to the GSM Modem This is a test message from UART".Send ASCII code for CTRL+Z i.e., 0x1A to GSM Modem to transmit the message to mobile phone. After message string has been sent to the modem, send CTRL+Z to the micro-controller, which is equivalent to 0x1A (ASCII value)

The acronym of the GSM modem is Global System for Mobile Communications, it is a wireless communication module, used to make a computer or any processor to communicate over a network. This modem uses a variation of TDMA(Time Division Multiple Access) and is the most commonly used of the digital wireless telephony technologies like TDMA, GSM and CDMA.A GSM modem needs a SIM card to operate through a n/w range subscribed by the network operator. This modem can be connected to a computer via a serial, Bluetooth or USB connection. A GSM modem is also a standard GSM mobile phone with a suitable cable and software driver to connect to a USB port on your PC. Generally, this modem is preferred instead of a GSM mobile phone. This article describes how GSM modem interfacing with 8051 microcontroller.

GSM Modem Interfacing with 8051 Microcontroller

Nowadays, many projects like car security system, home automation, remote controlled industrial machines are controlled by an SMS using GSM modem. This modem uses a SIM card and operates through a subscription with the mobile operator. Many people they don’t know how GSM module interfacing with 8051 microcontroller. Therefore, the following steps explain the basics of how GSM modem interfacing with 8051 microcontroller.

Steps to Interfacing a GSM Modem to the Microcontroller

Step1: Arranging the GSM Modem

The GSM modem is a one type of modem, which uses the SIM card for communication. First, insert a SIM card into the modem which uses the same number/ account as the caller phone. It supports AT commands for handling the messages. These commands are programmed into the microcontroller ensures ending or receiving of the SMS from the modem.
For instance: Initializing commands for several types of modem are shown below

Siemens: AT+CNMI=1,1,0,2,1
WaveCom: AT+CNMI=2,1,0,1,1
SonyEricsson: AT+CNMI=3,1,0,1,0
Motorola USB modem: AT+CNMI=3, 1,0,0,0
The modem is arranged to send notifications to the microcontroller upon receiving a new text.
Arrange the modem port speed as a rule such as 9600 or 19200 bps baud rates.
Step2: GSM Modem Testing

The GSM modem comprises of two light emitting diodes like green and red LEDs, which are used for the network connection indication. If there is no network is available, then the red LED glows, and if a network is available, then the green LED glows so that one can observe the working of GSM modem. Connect a power supply to a GSM modem which contains a SIM card and wait till it registers in the GSM network. For the testing of the modem, you can send an SMS to the modem. If it receives the message from the mobile, it is working properly, or else it is damaged.

Step3: GSM Modem Interfacing with 8051 Microcontroller

GSM modem works with 12V DC and the microcontroller works with 5V. So, interfacing of this modem with microcontroller directly is not possible due to mismatch of voltage levels. GSM modem is interfaced with 8051 microcontroller through MAX232 with the help of RS232 cable for serial communication. MAX232 device is used to convert TTL logic level to RS232 level during serial communication of microcontroller to the GSM modem. The RS232 device is an interface between data terminal equipment and data communication equipment using serial binary data exchange. The RS232 cable is commonly available with the 9 or 25 pin wiring and has jumpers to provide handshaking pins for those devices that require it.

Step4: Microcontroller Programming

Transmitting single character
Transmitting word
Receiving char
#include<reg51.h>
voidinit_RS 232();
voidTx_Char(unsigned char ch);
voidTx_String(unsigned char *str);
voidRx_Char();
voidinit_RS 232()
{
TMOD|=0×20; //Timer 1 in mode 2 ( Auto Reload mode)
TH1=0XFD; //0xFD for 9600bps
SCON=0×50; //Enable TI and RI pins using Serial control Register
TR1=1; //Start Timer 1;
}
voidTx_Char(unsigned char ch)
{
SBUF=ch; // Load the character into SBUF register to transmit.
while(!TI); //wait for TI flag to raise high

TI=0; //clear TI for further transmission.
}
voidTx_String(unsigned char *str)
{
while(*str)
Tx_Char(str++);
}
voidRx_Char()
{
while(RI==1); //wait for RI flag to receive any character
Ch=SBUF; // capture the character from SBUF into Ch variable
RI=0; //clear RI flag for further reception
}
In addition to the above program,if an operator wants to make an SMS to any other persons mobile via microcontroller upon interrupt either from internal or external device, the operator can follow the below program.

GSM modem interfacing with microcontroller 8051 for SMS control of industrial equipments
This is a beginner tutorial in which a GSM modem is being interfaced with the microcontroller AT89s51 for SMS communication. The SMS can be send and recieved for the data sharing and situation information and control. there are many application of the project based on microcontroller 8051 and GSM interfacing.
We can use it as a remote control of industrial machines or we can sue it for home automation or we can use it for the security of home or offices.gsm control 8051
The sending SMS through GSM modem when interfaced with microcontroller or PC is much simpler as compared with sending SMS through Modem in PDU Mode.Text message may be sent through the modem by interfacing only three signals of the serial interface of modem with microcontroller i.e.,TxD,RxD and GND.In this scheme RTS and CTS signals of serial port interface of GSM Modem are connected with each other.The transmit signal of serial port of microcontroller is connected with transmit signal (TxD) of the serial interface of GSM Modem while receive signal of microcontroller serial port is connected with receive signal (RxD) of serial interface of GSM Modem.The COMPIM Serial Port Model shown in the schematic diagram developed in Proteus VSM is equivalent to the serial interafce of GSM Modem.Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)
8051 projects based on message recived on mobile
block circuit diagram of GSM interface with microcontroller 8051
The following are the AT Commands and sequence of events performed for sending text message to a mobile phone through GSM Modem interfaced with microcontroller :

1. First select the text mode for SMS by sending the following AT Command to GSM Modem : AT+CMGF = 1 . This command configures the GSM modem in text mode.

2. Send the following AT Command for sending SMS message in text mode along with mobile number to the GSM Modem : AT+CMGS =+923005281046 . This command sends the mobile number of the recipient mobile to the GSM modem.

3. Send the text message string (“hello!”) to the GSM Modem This is a test message from UART”
4. Send ASCII code for CTRL+Z i.e., 0x1A to GSM Modem to transmit the message to mobile phone.After message string has been sent to the modem, send CTRL+Z to the micro-controller,which is equivalent to 0x1A (ASCII value) Every AT command is followed by i.e. carriage return and line feed
you are giving line feed first and carriage return after that.
“\r” stands for carriage return

Interfacing 8051 with gsm modem equipped with RS232 serial interface is the same as interfacing AVR with GSM modem is.
The SMS message in text mode can contain only 140 characters at the most.It depends upon the amount of information collected from GPS Engine that you need at the base station for tracking vehicle or person

The most important string of GPS is “$GPRMC…” which contains the minimum information required in tracking a target additionally you may need the information regarding the number of satellites that are visible to the GPS receiver.So it depends upon how much information you need to pack in 140 characters of SMS in text mode.
code for the interfacing the GSM modem with microcontroller 8051 for just testing of connection and serial communication is under:-
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<at89x51.h> // include at89x51 . h
#include<stdio.h>// include stdio . h
#include<stdlib.h>// include stdlib . h
void initialize_GSM_modem(void);
void initialize_serialcommunication(void);
unsigned char Command_CMGF[]="AT+CMGF=1\r";
// AT+CMGF for selecting Text Mode
unsigned char CtrlZ=0x1A;
// CTRL+Z for sedning SMS after the message has been entered
unsigned char Command_CMGS[]="AT+CMGS =+9233385xxxxx\r";
// recepient mobile number
unsigned char Command_AT[]="AT\r";
unsigned char msg02[]="Hello!";
void delay(void){
unsigned int i;
for(i=0;i<50;i++);
}
void delay2(void){
unsigned int i;
for(i=0;i<25000;i++);
}
void main (void) {
initialize_GSM_modem();
initialize_serialcommunication();
while (1) {
;
}
}
void initialize_GSM_modem(void){
delay2();
puts(Command_AT);
delay2();
puts(Command_CMGF);
delay2();
puts(Command_CMGS);
delay2();
puts(msg02);
delay2();
while(!TI); TI = 0;SBUF = 0x1A;
}
void initialize_serialcommunication(void){
TMOD = 0x20;
SCON = 0x50;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
}



Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: wavecom, 8051 gsm asm code, seminarska rabota po pravo, seminarska po angliski, stdio h, seminarska naloga, seminarska rabota po statistika,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  program code of solar tracking system using 8051 microcontroller 6 23,106 03-05-2018, 09:30 PM
Last Post: Guest
  circuit diagram dc motor speed and direction control over gsm mobile modem pdf 2 14,941 19-03-2018, 10:57 AM
Last Post: Guest
  vehicle tracking system using gsm and gps with arm 2 1,179 29-05-2017, 11:14 AM
Last Post: jaseela123d
  how to read sms from gsm modem and display on lcd 1 1,457 12-04-2017, 02:36 PM
Last Post: jaseela123d
  distance measurement using infrared sensor with adc0804 8051 microcontroller at89c51 1 2,098 12-04-2017, 12:57 PM
Last Post: jaseela123d
  8051 based automatic blind stick circuit diagram 1 952 10-04-2017, 04:02 PM
Last Post: jaseela123d
  street light control using gsm wiki pidia 1 866 07-04-2017, 04:25 PM
Last Post: jaseela123d
  code for interfacing 8051 with pir sensor 1 894 05-04-2017, 03:53 PM
Last Post: jaseela123d
  fault detection of optical fibre using 8051 1 771 04-04-2017, 05:01 PM
Last Post: jaseela123d
Thumbs Up 8051 microcontroller experiments lab manual pdf 1 1,037 04-04-2017, 04:12 PM
Last Post: jaseela123d

Forum Jump: