Friday 10 May 2019

GSM 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.
    Block diagram:
    Block diagram
    GSM modem








    • 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.
      AT Commands
      Pin assignment with LPC2148:

      Uart pins of LPC2148

      Algorithm :
      1. Start
      2. Initialise UART1 serial interface.
      3. Transmit different AT commands through UART.
      4.  If transmission buffer is Empty,Transmit AT commands.
      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
      Code: GSM interfacing with LPC2148


      /**********************************************************
      Expt. ***: GSM interfacing with to LPC2148
      Platform:  LPC2148 Development Board.
      College: PICT
      **********************************************************/       
      

      #include<lpc21xx.h>   //Includes LPC2148 register 

      unsigned char GsmSendMsg(unsigned char *msgStr);
      void DelayMs(unsigned int count);
      void uart1Init(void);
      void uart1Putch(unsigned char ch);
      void Uart1PutS(unsigned char *Str);

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

      unsigned char GsmSendMsg(unsigned char *msgStr)
      {
          Uart1PutS("AT+CMGF=1\r\n");//Send SMS: Select Text mode
          DelayMs(100);
          Uart1PutS("AT+CMGS=\"9960XXXXXX\"\r\n"); //Send SMS to mobile number
          DelayMs(100);  
          Uart1PutS(msgStr);
          DelayMs(100);  
          Uart1PutCh(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++);
      }



      void uart1Init(void)      
      {
          PINSEL0=0x00050000;// port 0 tx P0.8 and rx P0.9 
          U1LCR=0x83; //8bit data, no parity, 1 stop bit
          U1DLL=97;// 9600 baud rate @15Mhz Pclk
          U1LCR=0x03;// DLAB=0
        
      }
      void uart1Putch(unsigned char ch)
      {
          U1THR=ch;    // Transmitter holding register
          while(!(U1LSR & 0x20));// wait still THR=0 
      }

      void Uart1PutS(unsigned char *Str)
      {
      int i=0;
      while(Str[i]!='\0')
       {
         uart1Putch(Str[i]);
         i++;
       }
      }

      No comments:

      Post a Comment