Aim:
GSM (Global System for Mobile Communication) technology lets user to
communicate with others across mobile networks hence it offers a vast
area of coverage. Interfacing GSM technology with microcontroller will
enable us to extend the communication to cover large area. This tutorial
will teach you about interfacing GSM module with atmega8 AVR
microcontroller and program it to communicate it with another user.
Description:
STEP 1: MODEM TESTING:
The Modem consists of two indicating LED’s Green and Red to indicate the
availability of the network. Green indicates the availability of the
network whereas red indicates its absence. Turn the modem ON and wait
for sometime to register itself in GSM network.
STEP 2: INTERFACING WITH AVR MICROCONTROLLER:
The Communication between AVR and modem takes place through USART
protocol. GSM Modem SIM900 works on TTL level hence we can interface
directly to RXD and TXD pins of AVR microcontroller. There is no need of
using Voltage or level converter between them. However if you ever
happen to buy a SIM300 or other module which operates above TTL level,
you may want to use MAX232 level converter IC to make the communication
possible.
STEP 3: INITIALIZING MODEM:
The modem must be Initialized using the commands and then the process
you are about to carry out must be selected. In this tutorial am going
to initialize the modem and them make it to send a message “Hi Raghav”
to my mobile using the GSM modem.
Block Diagram
Schematic
Code
// ********************************************************* // Project: Interfacing GSM to atmega8 microcontroller // Author: Hack Projects India // Module description: Operate GSM // ********************************************************* #include <avr/io.h> #include <util/delay.h> void USART_Init() { UBRRL=0x33; UCSRB=(1<<TXEN)|(1<<RXEN); UCSRC=(3<<UCSZ0)|(1<<UMSEL); } unsigned char USART_Receave() { while(!(UCSRA&(1<<RXC))); UCSRA=(0<<RXC); return UDR; _delay_ms(100); } void USART_Transmit(unsigned char data) { UDR=data; while(!(UCSRA&(1<<TXC))); UCSRA=(0<<TXC); _delay_ms(100); } void Tx_String( char *str) { while(*str) { USART_Transmit(*str); str++; _delay_ms(50); } } void Tx_Number(char *str) { Tx_String("AT+CMGS="); USART_Transmit('"'); while(*str) { USART_Transmit(*str); str++; _delay_ms(50); } USART_Transmit('"'); USART_Transmit('\r'); Tx_String("Hi Raghav"); USART_Transmit('\r'); USART_Transmit(0x1a); } int main(void) { DDRC=0x00; DDRB=0xff; int j; USART_Init(); Tx_Number("9999999999"); While(1); }
Downloads:
The code was compiled in Atmel Studio 6 and simulation was made in Proteus v7.7.
To download code and proteus simulation click here.
Further Reading suggestions:
You may also like,
- Interfacing keypad with AVR
- nterfacing DAC with AVR
- Interfacing with UART of AVR controller
- Interfacing SPI communication with AVR
- AVR Displaying Custom Characters on LCD
- AVR Graphical LCD
- RTC interfacing using I2C in AVR
- Interfacing ultrasonic sensor with AVR
- Interfacing GPS Modu with AVR
- Interfacing PWM in AVR
- Interfacing ADC with AVR
- Scrolling string on LCD using AVR
- Interfacing keypad with AVR
- nterfacing DAC with AVR
- Interfacing with UART of AVR controller
- Interfacing SPI communication with AVR
- AVR Displaying Custom Characters on LCD
- AVR Graphical LCD
- RTC interfacing using I2C in AVR
- Interfacing ultrasonic sensor with AVR
- Interfacing GPS Modu with AVR
- Interfacing PWM in AVR
- Interfacing ADC with AVR
- Scrolling string on LCD using AVR
No comments:
Post a Comment