Professional Documents
Culture Documents
ADVANCED PROCESSORS
EXPERIMENT NO: 2
Aim: GSM (Global System for Mobile Communication) interfacing with LPC2148.
Objectives: After performing this experiment, the learner will be able to interface GSM
module with LPC 2148 using Embedded C program and observe the output on display.
Apparatus: LPC2148 Evaluation Board, USB to Serial communication cable, Power supply
adaptor. PC with Keil uVision4 and Flash Magic software, GSM Module.
Theory:
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.
Fig. 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 equipment’s.
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.
Inferfacing Diagram:
Procedure:
1. Provide +5v dc power supply to ARM LPC2148 board .
2. connect ARM LPC2148 board to computer using USB cable .
3. Open Keil uVision4
4. Select new project
5. Then go on local drives (desktop) & create folder and give file name related to our
project and save this file.
Algorithm :-
Main Routine:-
1. 1. Start
2. Declare TxD0 and RxD0 pin for UART0
3. Initialize UART0
4. Declare different functions used in Main program
5. Send mobile Number through AT command
6. Send message through AT command
7. Stop
Start
Initialize UART0
Stop
TE ELECTRONICS Page No.
Dept. of Electronics and Telecom. ADVANCED PROCESSORS
Code:
#include "lpc214x.h"
#include "UART.h"
#include "stdio.h"
#include "string.h"
int main()
{
unsigned char *msg = "ADVANCED PROCESSOR\r";
Uart0Init(9600);
Uart1Init(9600);
printf("GSM program\r\n");
GSM_cmd("ATE0\r\n");
//Turn OFF echo
delay(3000);
GSM_cmd("ATD7757901312;\r\n"); //Call
(CHANGE THIS NUMBER)
delay(20000);
GSM_cmd("ATH0\r");
//disconnect call
delay(3000);
GSM_cmd("AT+CMGF=1\r\n");
//Send SMS: Select Text mode
delay(1000);
GSM_cmd("AT+CSCS=\"GSM\"\r\n"); //GSM
Character Set
delay(1000);
GSM_cmd("AT+CMGS=\"7757901312\"\r\n"); //Number
(CHANGE THIS NUMBER)
delay(1000);
UART1_PutS(msg); //Send
string
delay(1000);
UART1_PutChar(0x1A);
//SUBSTITUTE character <CTRL+Z>
while(1);
return 0;
}
/**************************************************************************
End Of File
**************************************************************************/
Output:-
Conclusion:
Thus we have studied GSM interfacing with LPC 2148 and also ATD commands.