EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / How to interface GSM modem TO atmega16

How to interface GSM modem TO atmega16

|

Microcontroller › AVR › How to interface GSM modem TO atmega16

  • This topic has 11 replies, 7 voices, and was last updated 10 years, 2 months ago by divya.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • February 22, 2011 at 7:21 pm #743
    hardeep
    Participant

    Sir i wanted to interface GSM modem SIM300 to Atmega16…i want to communicate both the ways…please help me out with the coding and the code explanation….I am using Code vision avr for writing the program…

    Thanks in advance sir…!!! 

    February 23, 2011 at 6:17 am #5592
    dagakshay
    Participant

    you can get the help from here its on 8051 but you can convert it into AVR

    http://www.engineersgarage.com/microcontroller/8051projects/gsm-interface-8051-microcontroller-circuit-code

    http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code

    http://www.engineersgarage.com/microcontroller/8051projects/interface-gsm-module-8051-microcontroller-circuit-code 

    March 29, 2011 at 5:07 pm #5837
    hardeep
    Participant

    I am not getting how to interface it with ATMEGA16…plz help me with the coding part…!!!

    How to send the string to the modem using usart and all…

    Individually my usart is running fine and GSM modem also running fine…but i m not able to interface modem to atmega16…!!!

    March 31, 2011 at 5:11 am #5844
    dagakshay
    Participant

    the links i have posted above shows how to interface gsm modem to 8051…

    let us know where exactly you got struct… are asking for algo???

    March 31, 2011 at 2:03 pm #5846
    hardeep
    Participant

    My GSM modem and AVR usart are working fine individually….but when i connect modem to controller,i 

     
    #include<avr/io.h>
    #include<util/delay.h>
    #define F_CPU 11059200UL
    #define USART_BAUDRATE 9600 // Baud Rate value
    #define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) – 1)
     
     
    #define LCD_DATA PORTB //LCD data port
     
    #define ctrl PORTD
    #define en PD2 // enable signal
    #define rw PD3 // read/write signal
    #define rs PD4 // register select signal
    void usart_putstr(char * s); 
    void LCD_cmd(unsigned char cmd);
    void init_LCD(void);
    void LCD_write(unsigned char data);
    void usart_init();
    static void usart_putch(unsigned char send);
    unsigned int usart_getch();
    void gotoxy(unsigned char row,unsigned char column);
    static void LCD_String(char *s);  
    int main()
    {
    unsigned char value,i;
    DDRB=0xff; // LCD_DATA port as output port
    PORTB=0x00;
    DDRD|=0xFC;
    init_LCD(); //initialization of LCD
    _delay_ms(50); // delay of 50 milli seconds
    usart_init(); // initialization of USART
    gotoxy(1,1);
    //char a[] = “AT”;
    char b[] = “AT+CMGS=”;
    char no[]=”+919595955635″;
    char body[] = “Successful”;
     
     
    {
     
    //usart_putstr(a);
    //_delay_ms(5);
    // usart_putstr(“rn”);
    // _delay_ms(100);
    usart_putstr(b);
    _delay_ms(100);
    usart_putch(‘”‘);
    // _delay_ms(100);
    usart_putstr(no);
    // _delay_ms(100);
    usart_putch(‘”‘);
    _delay_ms(100);
     
    usart_putch(‘r’);
    usart_putch(‘n’);
    _delay_ms(100);
    usart_putstr(body);
    _delay_ms(100);
    usart_putch(0x1A);
     
     
    // for (i=0;i<16;i++)
    // {
    // value=usart_getch(); // Call a function to get data from serial port
    // _delay_ms(100);
    // LCD_write(value); // write data to LCD
     
    // }
    // gotoxy(2,1);
       
    }
    return 0;
    }
     
    void init_LCD(void)
    {
    LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode
    _delay_ms(1);
     
    LCD_cmd(0x01); // clear LCD
    _delay_ms(1);
     
    LCD_cmd(0x0E); // cursor ON
    _delay_ms(1);
     
    LCD_cmd(0x80); // —8 go to first line and –0 is for 0th position
    _delay_ms(1);
    return;
    }
     
    void LCD_cmd(unsigned char cmd)
    {
    LCD_DATA=cmd;
    ctrl &=~ (1<<rs);
    ctrl&=~(1<<rw);
    ctrl|=(1<<en); // RS and RW as LOW and EN as HIGH
    _delay_ms(1);
    ctrl &=~ (1<<rs);
    ctrl&=~(1<<rw);
    ctrl&=~(1<<en); // RS, RW , LOW and EN as LOW
    _delay_ms(1);
    return;
    }
    void LCD_write(unsigned char data)
    {
    LCD_DATA= data;
    ctrl |= (1<<rs);
    ctrl&=~(1<<rw);
    ctrl|=(1<<en); // RW as LOW and RS, EN as HIGH
    _delay_ms(1);
    ctrl |= (1<<rs);
    ctrl&=~(1<<rw);
    ctrl&=~(1<<en); // EN and RW as LOW and RS HIGH
    _delay_ms(1); // delay to get things executed return ;
    }
     
     
    void usart_init()
    {
        UBRRL = 0x47;
    // UBRRL = (unsigned char)BAUD_PRESCALE; 
    // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
    // UBRRH = (unsigned char)(BAUD_PRESCALE>>8); // Load upper 8-bits of the baud rate value..
    _delay_ms(1);
    UCSRB |= (1 << RXEN) | (1 << TXEN);   // Turn on the transmission and reception circuitry
    UCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1); 
    // Use 8-bit character sizes
    }
     
    unsigned int usart_getch()
    {
    while (!(UCSRA & (1 << RXC)) ); 
    // Do nothing until data has been received and is ready to be read from UDR
    _delay_ms(1);
    return(UDR); // return the byte
    }
     
    static void usart_putch(unsigned char send)
    {
     
    while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
    // for more data to be written to it
    UDR = send; // Send the byte 
    }
     
     
     
     
     void gotoxy(unsigned char row,unsigned char column)
    {
    switch (row) 
     
      {
        case 1: LCD_cmd (0x80 + column – 1); break;
        case 2: LCD_cmd (0xc0 + column – 1); break;
        default: break;
      }
    }
     
     
     
     
     
    static void LCD_String(char *s) 
    {
       register char c;
     
       while((c = *s++))
       {
          _delay_ms(10);
    LCD_write(c);
       }
       
       return;
    }
    void usart_putstr(char * s) 
    { 
      while(*s) 
      { 
        usart_putch(*s++); 
      } 
    }
     

    am not receiving messages…

    April 3, 2011 at 5:25 pm #5867
    hardeep
    Participant

    Can anyone help me out with the programming logic ???

    May 18, 2011 at 11:38 am #6271
    saahil agrawal
    Participant

    Sir,

    i want to interface a sim900 with atmega16 using serial communication and i want the at,ega tp check in specific time interval whether there is any message in the inbox of the module and if yes i want to ddecode it accordingly. also i muxt be able to send sms.

                 thanking in advamce and i am eagerly waiting for the solution as i am nearimg the deadline of my project submission.

     

    August 19, 2011 at 11:48 am #6613
    reza
    Participant

    hi

    i think this program is betet 4 u .

    i did it .this program is working with pc (in codevision terminal )but it doesnt work with gsm 300!!!

     

     

    #include <mega16.h>
    #include <stdio.h>
    #include <delay.h>
     
    char Enter=13;
    char double_quote=34;
    char Ctrlz=26;
     
    void main(void)
    {
     
    PORTD=0x00;
    DDRD=0x00;
     
    UCSRA=0x00;
    UCSRB=0x18;
    UCSRC=0x86;
    UBRRH=0x00;
    UBRRL=0x33;
     
    while (1)
          { 
          
            if (PIND.2==0) {
            
              printf(“at%c”,Enter);
              delay_ms(500);
              
              printf(“AT+CMGF=1%c”,Enter);
              delay_ms(500);
              
              printf(“AT+CMGS=%c09351563176%c%c”,double_quote,double_quote,Enter);
              delay_ms(100);
              
              printf(“AVR Test 1%c”,Ctrlz);
              delay_ms(500);
              
            };
                       
           };
    }
     
    August 19, 2011 at 12:04 pm #6612
    reza
    Participant

    indecision

    November 1, 2012 at 5:43 am #8707
    5HUJ4
    Participant

    By using GSM SIM300M Module & Atmega8 Uc ,How to send SMS to 3 Different persons when one of the port pin of Atmega8 gets high … Plzz some body help me in dis regard for “coding part” ….!!!!

    July 22, 2014 at 7:26 am #11918
    HARESH
    Participant

    how to intreface gsm modem to avr microcontroller…..?

    please take it source code with programing …type instolll ….

     

    March 9, 2016 at 4:42 am #13770
    divya
    Participant

    sir, i want a code to interface gps and gsm module with  avr(atmega16) in MIKRO C.I am using GPS6MV2 module and GSM SIM900A. i want to receive the gps data(latitude and longitude values) through UART and display it on LCD. 

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Battery discharger May 20, 2026
  • Relay question May 19, 2026
  • Phone Charger 5v to 12v May 19, 2026
  • reviving old swordfish program but? May 18, 2026
  • Assistance locating a 'trail' camera gadget, please ? May 18, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise