MEL PICBASIC Forum - Project - GSM Shield SIM900D + PIC16F877A


  • Project - GSM Shield SIM900D + PIC16F877A

    Hi there!..So this is my partial project for my research proposal on how I integrated my GSM Shield module, specifically the SIM900D, with the PIC16F877A microcontroller unit. In this project, I only constructed a sending process function by using a push-button. Therefore, every time I would press the push-button, a fixed message would be sent to a specific recipient. This is only a basic construction of understanding the GSM Shield function and its AT Commands.


    The image that is shown below is the GSM Shield SIM900D that I used for my project. You can purchase this at http://www.e-gizmo.com/KIT/gsm shield.html for about 1,995.00 pesos.





    Features and Specifications of GSM/GPRS Shield:
    Industry proven SIMCOM SIM900D Module
    Buffered UART provides additional layer of protection
    Fused power input
    On board LDO voltage regulator
    UART/SUART switch selectable port (gizDuino)
    On board manual power switch
    SIM Card Holder


    Here is the circuit I made by integrating the PIC16F877A (datasheet:http://www.kynix.com/uploadfiles/pdf...F877A-I2fL.pdf)and the GSM Shield:







    Be sure to connect the Tx of the GSM Shield to the Tx of the PIC and the Rx of the GSM Shield to the Rx of the PIC. Take note also that the GSM needs to be powered by a 1.5A and 5VDC supply and its ground must be COMMON to the ground of the circuit.


    For the PIC16F877A programming code, I used a programming language which is the "MikroC Pro for PIC". MikroC has an awesome and numerous features of built-in libraries along with examples of small programs in order for the user to simply understand the functions. Here is my program code: (REMEMBER: This is only a sending process, it does not consist of a receiving capability yet.)




    Code:
    /*---------------------------FLEET MANAGEMENT SYSTEM-------------------------
          MikroC Programming by Kirk Macaraeg
    -------------------------------------------------------------------------------------------*/
    
    
    void GSM_Init(void);
    void GSM_send(void);
    void GSM_receive(void);
    
    
    void main(void) {
    
    
    TRISD=0b00000010;     //RD1 is an input
    PORTD=0x00;                //The rest of RD pins are output
    
    
    UART1_Init(9600);     //Initialize and establish communication at 9600 bps
    Delay_ms(250);
    UART1_Write_Text("AT+CMGD=1");  //Delete mesage sotred in inbox1
    UART1_Write(0x0D);              //<cr>
    
    
    while(1)
    {
    
    
    if(PORTD.F1==0)           //if pushbutton is pressed
    {
      PORTD.F0=0;               //LED OFF
    
    
      GSM_Init();                   //calls GSM_Init function
      GSM_send();                 //calls GSM_send function
    
    
      PORTD.F0=1;                //LED1 blinks 3 times
      Delay_ms(250);
    
    
      PORTD.F0=0;
      Delay_ms(250);
    
    
      PORTD.F0=1;
      Delay_ms(250);
    
    
      PORTD.F0=0;
      Delay_ms(250);
    
    
      PORTD.F0=1;
      Delay_ms(250);
    
    
      PORTD.F0=0;
      Delay_ms(250);
      }
    
    
    
    
     }
    }
    /*----------------------------------------------------------------------
                          GSM INITIALIZING PROCESS
    ----------------------------------------------------------------------*/
    
    
    void GSM_Init(void)
    {
      UART1_Write_Text("AT\r");
      UART1_Write_Text("AT+CMGF=1");      //Text Mode
      UART1_Write(0x0D);                                //<cr>
      Delay_ms(250);
      UART1_Write_Text("AT+CMEE=2");      //Write Mode
      UART1_Write(0x0D);                               //<cr>
      Delay_ms(250);
      UART1_Write_Text("AT+CFUN=1");      //Full Phone Functionality
      UART1_Write(0x0D);                               //<cr>
      Delay_ms(250);
    }
    
    
    /*----------------------------------------------------------------------
                           GSM SENDING PROCESS
    ----------------------------------------------------------------------*/
    
    
    void GSM_send(void)
    {
      UART1_Write_Text("AT+CMGS=\"09429185691\"");    //send SMS to this number
      UART1_Write(0x0D);                              //<cr>
      Delay_ms(250);
      UART1_Write_Text("F.M.S. GSM with PIC Testing\r");  //message to be sent
      UART1_Write(0x1A);                                  //<ctrl+z>
      Delay_ms(250);
    
    
    }
    Here is an actual video of what I have made:
    https://youtu.be/VNscy_3T840?list=UU...ZYNrrnTw8Ktdfw</ctrl+z></cr></cr></cr></cr></cr>
    This article was originally published in forum thread: Project - GSM Shield SIM900D + PIC16F877A started by louyueqing View original post