Friday, March 16, 2012

Interfacing GSM Module with 8051 microcontroller (AT89C51) without using PC

This project presents a way to interface GSM Module with microcontroller AT89c51 without making use of computer to send AT commands to the module. This is an improvement over the previous projects (see MC074 & MC075). Instead of using HyperTerminal or any other PC interface, the controller itself sends a fixed AT command to the GSM/GPRS module. The information response and result codes are received and displayed on a 16x2 LCD.

Instead of sending commands from the HyperTerminal, AT commands are sent to the GSM/GPRS module by the microcontroller itself. In this case, the receive (Rx) and transmit (Tx) pin of the GSM module’s RS232 port are connected to the transmit (Tx) and receive (Rx) pin of AT89c51’s serial port, respectively. This eliminated the role of computer and just the controller’s circuit provides a complete user interface for the module.


The controller is programmed to send a fixed command ‘AT’ to the module. The command AT is used to check the communication with module. It returns a result code OK if the module and the controller are connected properly. If either of the module or SIM are not working, it returns a result code ERROR.
The program complexities for display of information responses and result codes on LCD mentioned in MC075 remain same here as well.
Program Code: -

// Program to Interface GSM Module with 8051 microcontroller (AT89C51) without using PC

#include
#define port P1
#define dataport P2 // Data port for LCD
sbit rs = port^2;
sbit rw = port^3;
sbit en = port^4;
int count,i;
unsigned char check,str[15];
bit check_space;

void init_serial() // Initialize serial port
{
TMOD=0x20; // Mode2
TH1=0xfd; // 9600 baud
SCON=0x50; // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit, Receiving on
TR1=1; // Start timer
}
void delay(unsigned int msec) // Function for delay
{
int i,j;
for(i=0;i=0)
{
check=byte_check(); // Check the character
if(check!=0x00)
{
if(check==0x01)
{
if(check_space==1) // Check previous character
{
lcd_data(0x20);
check_space=0;
}
}
else
{
lcd_data(str[0]);
check_space=1;
}
}
count--;
for(i=0;i

6 comments:

Sam said...

Can you also send SMS through the GSM Module with out using the computer?

Anonymous said...

COPIED FROM ENGINEERS GARRAGE...COPY THE WHOLE THING...YOU LEFT THE REMAINING CODE THERE ITSELF...for(i=0;i ??

Anonymous said...

For any help, circuit and code for GSM and GSM, kindly contact:-
jitendra_mattolia@yahoo.com.

Unknown said...

please send remainig code.
kindly cintact to ashwini.rasur@yahoo.com

Anonymous said...

please provide me also the remaining code.
ramraut10@gmail.com

Unknown said...

I want code of SMS receiving...so please provide me
desaidilipkumar15@gmail.com