Saturday, 21 December 2013

GSM INTERFACING CODE WITH ATMEGA 8

INTRODUCTION 


This GSM Modem can accept any GSM network operator SIM card and act just like a mobile phone with its own unique phone number. Advantage of using this modem will be that you can use its RS232 port to communicate and develop embedded applications. Applications like SMS Control, data transfer, remote control and logging can be developed easily.
 
The modem can either be connected to PC serial port directly or to any microcontroller. It can be used to send and receive SMS or make/receive voice calls. It can also be used in GPRS mode to connect to internet and do many applications for data logging and control. In GPRS mode you can also connect to any remote FTP server and upload files for data logging.
This GSM modem is a highly flexible plug and play quad band GSM modem for direct and easy integration to RS232 applications. Supports features like Voice, SMS, Data/Fax, GPRS and integrated TCP/IP stack.
GSM/GPRS MODEM is a class of wireless MODEM devices that are designed for communication of a computer with the GSM and GPRS network. It requires a SIM (Subscriber Identity Module) card just like mobile phones to activate communication with the network. Also they have IMEI (International Mobile Equipment Identity) number similar to mobile phones for their identification. A GSM/GPRS MODEM can perform the following operations: 

1.      Receive, send or delete SMS messages in a SIM.

2.      Read, add, search phonebook entries of the SIM.

3.      Make, Receive, or reject a voice call. 


The MODEM needs AT commands, for interacting with processor or controller, which are communicated through serial communication. These commands are sent by the controller/processor. The MODEM sends back a result after it receives a command. Different AT commands supported by the MODEM can be sent by the processor/controller/computer to interact with the GSM and GPRS cellular network.

APPLICATIONS

  •  SMS based Remote Control & Alerts
  • Security Applications
  • Sensor Monitoring
  • GPRS Mode Remote Data Logging

 FEAUTURES

  •  Highly Reliable for 24x7 operation with Matched Antenna
  • Status of Modem Indicated by LED
  • Simple to Use & Low Cost
  • Quad Band Modem supports all GSM operator SIM cards

 POWER SUPPLY REQUIREMENT


Use DC Power Adaptor with following ratings
  • DC Voltage: 12V
  • DC Current Rating at least: 1A· DC Socket Polarity: Centre +ve & Outside –ve
  • Current consumption in normal operation 250mA, can rise up to 1Amp peak while transmission so your power supply should be able to handle at least 1A mp current.Power supply is included in the packaging of this product.

GSM CODE

 #include<avr/io.h>
 #include<util/delay.h> 
  void enter(void);
void GSM_CMD_SEND(unsigned char *);
void GSM_MSG_SEND(unsigned char *CMDWRT ,unsigned char *MSG)  ;
void GSM_INIT(void);
void ENTER(void);
void RX_MSG();


int main(void)
{
GSM_INIT();
}

void GSM_INIT(void)
{
   
     unsigned char i=0;   

    unsigned char  *GSM_CMD[7]={"AT","ATE0","AT+CPIN=?","AT+CMGF=1",
                                    "AT+CNMI=2,2,0,0,0","AT&W","AT+CMGD=1"};
   
    GSM_CMD_SEND(GSM_CMD[0]);GSM_CMD_SEND(GSM_CMD[1]);GSM_CMD_SEND(GSM_CMD[2]);
    GSM_CMD_SEND(GSM_CMD[3]);GSM_CMD_SEND(GSM_CMD[4]);GSM_CMD_SEND(GSM_CMD[5]);
       
   
   
}


void GSM_CMD_SEND(unsigned char *CMDWRT)
{

    unsigned char i;
    for(i=0;*CMDWRT!='\0';i++)
    {   
    TX_DATA(*CMDWRT);
    CMDWRT++;
    }

    _delay_ms(50);

    ENTER();
   

    while(RX_DATA()!='O');
    while(RX_DATA()!='K');
   
    _delay_ms(30);

    }

void ENTER(void)
{
TX_DATA(0x0A);
TX_DATA(0x0D);

}


void GSM_MSG_SEND(unsigned char *CMDWRT ,unsigned char *MSG)
{
    unsigned char i;
    TX_STRING("AT+CMGS=");
    TX_DATA('\"');TX_DATA('+');
    for(i=0;i<12;i++)
    {   
    TX_DATA(*CMDWRT);
    CMDWRT++;
}
    TX_DATA('\"');
    ENTER();
    TX_STRING(MSG);
    TX_DATA(0x1A);
    _delay_ms(30);
    MSG=0;
}

No comments:

Post a Comment

share your thoughts