Interfacing GSM with 8051
Contents at a Glance
8051 Primer Board ...........................................................3 GSM (Global System for Mobile Communication) .............3 Interfacing GSM ...............................................................4 Interfacing GSM with 8051...............................................6 Pin Assignment with 8051 ................................................6 Circuit Diagram to Interface GSM with 8051 .....................7 Source Code ....................................................................7 C Program to send a message from 8051 ..........................8 Testing the GSM with 8051 ............................................ 10 General Information ...................................................... 12
Join the Technical Community Today! http://www.pantechsolutions.net
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. Join the Technical Community Today! http://www.pantechsolutions.net
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.
Join the Technical Community Today! http://www.pantechsolutions.net
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.
Fig. 1 Interfacing UART to Microcontroller
Join the Technical Community Today! http://www.pantechsolutions.net
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. Pin Assignment with 8051
UART DB-9 Connector
UART0(P1)
8051 Lines P3.0 P3.1
Serial Port Section
ISP PGM
TXD-0 RXD-0 TXD-1 RXD-1
8051
MAX 3232
UART1
(P2)
P1.2 P1.3
Join the Technical Community Today! http://www.pantechsolutions.net
Circuit Diagram to Interface GSM with 8051
Source Code The Interfacing GSM module with 8051 program is very simple and straight forward, which send a message to mobiles from 8051 Primer Board through GSM module by using UART0. Some delay is occurring when a single data is sent to mobile through UART. C programs are written in Keil software. The baud rate of microcontroller is 9600.
Join the Technical Community Today! http://www.pantechsolutions.net
C Program to send a message from 8051
*************************************************************************************** Title : Program to send a message from 8051 to mobile through GSM *************************************************************************************** #include #include #define LED P0 void serial_init(void); unsigned int j; //Setup the serial port for 9600 baud at 11.0592MHz. //------------------------------------------------void serial_init(void) { SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 0xFD; /* TH1: reload value for 9600 baud @ 11.0592MHz*/ TR1 = 1; /* TR1: timer 1 run */ TI = 1; /* TI: set TI to send first char of UART */ } /* special function register declarations */ /* prototype declarations for I/O functions */ //define prot P0 for LED
//Delay Routine start here void delay1(int n) { int i; for(i=0;i