GSM Module interfacing with LPC2148

Global System for Mobile Communication


  • GSM (Global System for Mobile Communications) is the technology that underpins most of the world's mobile phone networks.
  • GSM is an open, digital cellular technology used for transmitting mobile voice and data services.
  • GSM operates in the 900MHz and 1.8GHz bands GSM supports data transfer speeds of up to 9.6 kbps, allowing the transmission of basic data services such as SMS.
  • The SIM300 module is a Triband GSM/GPRS solution in a compact plug in module featuring an industry-standard interface

Features of GSM MODEM


  • Single supply voltage 3.2v-4.5v
  • Typical power consumption in SLEEP Mode: 2.5mA.
  • SIM300 tri-band
  • MT,MO,CB, text and PDU mode, SMS storage: SIM card
  • Supported SIM Card :1.8V,3V

GSM module sim300GSM Module sim900

GSM block diagram

GSM Module


  • GSM/GPRS module is used to establish communication between a computer and a GSM-GPRS system.
  • Global System for Mobile communication (GSM) is an architecture used for mobile communication in most of the countries.
  • Global Packet Radio Service (GPRS) is an extension of GSM that enables higher data transmission rate

GSM Mobile Vs GSM Module


  • A GSM mobile is a complete system in itself with embedded processors that are dedicated to provide an interface between the user and the mobile network.
  • The AT commands are served between the processors of the mobile termination and the terminal equipment.
  • The mobile handset can also be equipped with a USB    interface to connect with a computer, but it may or may not support AT commands from the computer or an external processor/controller.
  • The GSM/GPRS module, on the other hand, always needs a computer or external processor/controller to receive AT commands from.
  • GSM/GPRS module itself does not provide any interface between the user and the network, but the computer to which module is connected is the interface between user and network.
  • An advantage that GSM/GPRS modules offer is that they support concatenated SMS which may not be supported in some GSM mobile handsets
  • Applications of GSM/GPRS module The GSM/GPRS module demonstrates the use of AT commands. They can feature all the functionalities of a mobile phone through computer like making and receiving calls, SMS, MMS etc. These are mainly employed for computer based SMS and MMS services.
AT Commands

  • AT commands are used to control MODEMs.AT is the abbreviation for Attention.
  • These commands come from Hayes commands that were used by the Hayes smart modems.
  • The Hayes commands started with AT to indicate the attention from the MODEM.
  • The dial up and wireless MODEMs need AT commands to interact with a computer.
  • AT commands with a GSM/GPRS MODEM
GSM AT Commands and their functions
AT CommandFunction of AT Command
ATDDial
AT+CGMSSend SMS Message
AT+CMSSSend SMS Message from storage
AT+CMGLList SMS Messages
AT+CMGRRead SMS Messages
AT+CSCA?Service Centre Address
AT+CPMSTo choose storage from ME or SM
AT+IPR=0To choose auto from baud rate
AT+CMGF=To choose PDU Mode or Text Mode

Interfacing of GSM Module


Interfacing Diagram

GSM module interfacing with arm7

Pin assignment with LPC 2148

Pin Assignments
 

UART DB-9 Connector

LPC2148 Processor Lines

UART0 (P1) ISP PGM

TXD-0P0.0
RXD-0P0.1

UART1 (P2)

TXD-1P0.8
RXD-1P0.9
Algorithm for GSM module interfacing with LPC2148

1) Start

2) Initialise UART0 or UART1 serial interfface using following i nstruction

PINSEL0=0X0000 0005;//Enable P0.0-TxD0,P0.1-RxD0
U0LCR=0X83;  //8-BIT Character lenth,NO parity,1 stop bit
U0DLL=97; //Baud rate=9600@PCLK=15Mhz
U0LCR=0X03;//Dlab=0

3) Transmit different AT commands through UART module using instruction

while(!(U0LSR&0X20));//Monitor TI flag

4) If transmission buffer is Empty,Transmit AT commands 

U0THR=ch;

5) Provide delay while transmitting each command

6) To transmit a single character use PUTCH function & to transmit a string use PUTS function 

7) END

Video Tutorial



Embedded C Code


/**************************************************************************/
/* Project Name:- GSM Module Interfacing with LPC2148 using UART module      */
/* Device:- LPC2148                          */
/* Compiler:- KeilUvision4                   */
/* Language:- Embedded C  */
/* Visit www.wikinote.org for more Details   */
/******************************************************************************************/
#include<lpc21xx.h>   //Includes LPC2148 register definitions
#include "serial.h"
unsigned char GsmSendMsg(unsigned char *msgStr);
void DelayMs(unsigned int count);

int main(void)
{  
   Uart0Init();
   Uart0PutS("AT\r\n");
   DelayMs(500);
   Uart0PutS("ATE0\r\n");  //Turn echo off
  DelayMs(500);
   Uart0PutS("ATD9503XXXXXX;\r\n"); //replace xxxxxxxxxx with number to call
  DelayMs(20000);
   Uart0PutS("ATH0\r\n");      //disconnect call
  DelayMs(3000);
   GsmSendMsg("WIKINOTE FOUNDATION");
  while(1);
}

unsigned char GsmSendMsg(unsigned char *msgStr)
{
    Uart0PutS("AT+CMGF=1\r\n");//Send SMS: Select Text mode
   DelayMs(100);
    Uart0PutS("AT+CMGS=\"9503XXXXXX\"\r\n"); //Send SMS to mobile number
   DelayMs(100);  
    Uart0PutS(msgStr);
    DelayMs(100);  
    Uart0PutCh(0x1A);          //CNTL + Z
   DelayMs(3000);
   return (1);
}

void DelayMs(unsigned int count)
{
   volatile unsigned int j,k;
   for (j=0;j<count;j++)
       for (k=0;k<6000;k++);
}


Note:- As I am sending these AT Commands using UART , So i need to add Program for Serial Communication Hence Add Serial.c and Serial.h file 

Download Project : Click Here 

References


  • WikiNote Foundation


Last modified: Saturday, 18 April 2020, 3:38 PM