Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Gsm presentation

7,454 views

Published on

Gsm presentation

  1. 1. Interfacing GSM Modem With Microcontroller By: Gaurav Arora
  2. 2. Building a Embeded system with ability to Send Sms using an GSM modem. Objective
  3. 3. WORK FLOW <ul><li>Initialize system to set parameters for transmission and interrupt </li></ul><ul><li>System waits to be triggred using a sensor or an manual External interrupt like Switch. </li></ul><ul><li>Detecting interrupt Atmega 16 Checks availability of modem and tries to send SMS using GSM Modem using AT Commands. </li></ul>
  4. 4. Defining Modules <ul><li>System Consist of three modules: </li></ul><ul><li>> Interrupt Detection. </li></ul><ul><li>> Activating USART module Transmitting and Receving Data. </li></ul><ul><li>> Sending AT commands to GSM Modem. </li></ul>
  5. 5. GSM MODEM <ul><li>A GSM modem is a wireless modem that works with a GSM wireless network. </li></ul><ul><li>AT commands are used to control modems. </li></ul><ul><li>Operations Performed by GSM Modem. </li></ul><ul><li>Reading, writing and deleting SMS messages. </li></ul><ul><li>Sending SMS messages. </li></ul><ul><li>Reading, writing and searching phone book entries. </li></ul><ul><li>GSM Modem Datasheet : 1122_datasheet.pdf in your kit </li></ul>
  6. 6. Confiuring GSM Modem <ul><li>· Insert SIM card : Press the yellow pin to remove the tray from the SIM cardholder. insert SIM card </li></ul><ul><li>Connect RS232 Cable : (Cable provided for RS232 communication) Default baud rate is 9600(using 2400) </li></ul><ul><li>with 8-N-1, no hardware handshaking. </li></ul><ul><li>o Pin 2 is RS232 level TX out </li></ul><ul><li>o Pin 3 is RS232 level RX in </li></ul><ul><li>o Pin 5 is Ground </li></ul><ul><li>Send AT commands. </li></ul>
  7. 7. Some Terms <ul><li>BAUD RATE-A baud Rate is the measurement of the number of times per second a signal in a communications channel changes. bps = baud per second x the number of bit per baud </li></ul><ul><li>8-N-1 – this config means 8 databits,no parity bit,1 stop bit. </li></ul><ul><li>RS232 - RS-232 (Recommended Standard 232) is a standard for serial binary single-ended data and control signals connecting . It is commonly used in computer serial ports. </li></ul>
  8. 8. AT commands <ul><li>AT is the abbreviation of ATtention. </li></ul><ul><li>AT commands are instructions used to control a modem. </li></ul><ul><li>AT commands used to send SMS </li></ul><ul><li>AT ; -To check if the device is available </li></ul><ul><li>AT+CMGF=1; - select the operating mode GSM or mobile using 0 and 1(GSM) </li></ul><ul><li>AT+CMGS=”mobile no.”<CR>Text Message<Ctrl+Z>; -AT commands +CMGS can be used to send SMS messages </li></ul><ul><li>All AT commands are available in 1122_at_AT_Commands.pdf in your kit </li></ul>
  9. 9. Interfacing Modem with Microcontroller
  10. 10. Output of hyper-terminal for AT commands to modem
  11. 11. USART <ul><li>USART - Universal synchronous and asynchronous receiver and transmitter. </li></ul><ul><li>Main Registers – UCSRA,UCSRB,UCSRC,UBRR,UDR </li></ul><ul><li>UCSRx – USART Control and Status Register A,B,C. </li></ul><ul><li>UBRR – USART Baud rate Register </li></ul><ul><li>UDR – USART Data Register. </li></ul><ul><li>Two UDR USART register to transmit and receive to provide full duplex mode. </li></ul><ul><li>Must Read Status Bits before receiving or transmitting Data (most important) </li></ul><ul><li>TXC and RXC flags. </li></ul>
  12. 12. Initializing USART module
  13. 13. Activating USART module(1) <ul><li>we have to enable the UART Receiver and Transmitter using bit RXEN and TXEN in UCSRB register </li></ul>
  14. 14. Activating USART module(2) <ul><li>Bit 3 – TXEN: Transmitter Enable </li></ul><ul><li>Writing this bit to one enables the USART Transmitter. The Transmitter will override nor-mal port operation for the TxD pin when enabled. The disabling of the Transmitter </li></ul><ul><li>In UCSRC register UPM1:0: bit are used to set parity bits to 0,Bit 3 – USBS:to select Stop bits, Bit 2:1 – UCSZ1:0: to select character size to 8 bits. </li></ul>
  15. 15. Activating USART module(3) <ul><li>Setting Baud Rate: </li></ul><ul><li>Set values of UBRR -USART Baud rate register according to table: </li></ul>
  16. 16. USART initialization code <ul><li>UBRRH=0x00; </li></ul><ul><li>UBRRL = (unsigned char)BaudRate; /* Set the baud rate */ </li></ul><ul><li>UCSRB = 0b00011000; // enable transmitter and reciever </li></ul><ul><li>UCSRC = 0b10000110; // 8 bit data, no parity bit, 1 stop bit. </li></ul>
  17. 17. USART Transmission <ul><li>In UCSRA register Bit 5 – UDRE: USART Data Register Empty </li></ul><ul><li>The UDRE flag indicates if the transmit buffer (UDR) is ready to receive new data. If </li></ul><ul><li>UDRE is one, the buffer is empty, and therefore ready to be written. </li></ul><ul><li>If UDRE is one put data in the buffer. </li></ul>
  18. 18. Problem with Baud rates <ul><li>GSM modem supports a wide range of baud rates 1120-12000 </li></ul><ul><li>We cannot send data using higher baud rate while transmitting USART as higher baud rate require higher clock speed which is not available on board </li></ul><ul><li>4800 and 9600 baud rates are not supported with 1MHz oscillator. </li></ul>
  19. 19. USART RECEPTION <ul><li>In UCSRA register bit 7:• Bit 7 – RXC: USART Receive Complete </li></ul><ul><li>This flag bit is set when there are unread data in the receive buffer and cleared when thereceive buffer is empty (i.e., does not contain any unread data). </li></ul>
  20. 20. Interrupt Detection <ul><li>Code sniplets used to set Interrupt. </li></ul><ul><li>GICR = 0x40; // enable external interrupt 0 </li></ul><ul><li>MCUCR = 0x02; // activate external interrupt0 (on pin16) it recognizes rising edge </li></ul><ul><li>sei();//set enable interrupts. </li></ul><ul><li>If externel interrupts is provided to system then control goes to interrupt handler and set a flag variable to one. </li></ul><ul><li>And send the required Sms. </li></ul>
  21. 21. Have a look on code!! Any Questions??
  22. 22. Thank You!

×