Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

GSM Based AC Appliance Control

Description

Comments

thanks ganesh, i want to learn that how to make code to interface gsm module with 8051 pls send me code in c or in assembly

 

have the code in assembly?

Kya Bakchodi hai yar......Ek hi command bar..bar kyu define kiyeho....finally  i can say that this type of coding is done by little knowledge person only.....they don't know morw about programming.............again  i can say that*****************BACKCHODI**********

can i have the code of the gsm based ac appliances in C LANGUAGE

 

can you help me to missed call bsed relay on off in this avr 16a

my email id   [email protected]

pls sent your sell no

BROTHER , WHAT IS THE FILE DEFINITION OF LCD . WHAT IS THE DIFFERENCE  BETWEEN  lcd.h and LCD

EXPLANATION IS GOOD CODE IS BAKWAAAS .REMOVE THIS CRAP PL'Z.

hello ganesh ....

sir ,my keil compiler ask's for ..

<avr/io.h>  

<util/delay.h>

avr/wdt.h

avr/interrupt.h

inttypes.h

how to add this header files..

from where to analyse ...?

pls kindly show the path...

thanking you...

 

i cant see that picture clearly what i can i do|?

 

HIE GANESH, CAN I HAVE THE CODE OF THE GSM BASED HOME APPLIANCE CONTROL IN C LANGUAGE

How much MHz oscillator is used here?

Thanks a lot Ganesh for your valuable project .

I want to run your code using winavr . The following steps i am move on

First copy

=========

/*
 * gsmEG.c
 *
 * Created: 3/14/2014 1:21:32 PM
 *  Author: GANESH SELVARAJ
 */ 
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include <string.h>
#include "GSM.h"
#include "lcd.h"
void gsm_read()
{
int k;
clrscr();
LCD_write_string("System Activated");
gotoxy(1,16);
UART_Transmit_string("AT+CMGR=1\r");
gsm_waitfor('\r');
gsm_waitfor('\n');
if(UART_Receive()=='+')
{
gsm_waitfor('M');
if(UART_Receive()=='G')
{
gsm_waitfor('A');
gsm_waitfor(',');
gsm_waitfor('"');
for(k=0;k<13;k++)
number[k] = UART_Receive();
gsm_waitfor(',');
gsm_waitfor(',');
gsm_waitfor('+');
gsm_waitfor('\n');
for(k=0;k<9;k++)
msg[k]=UART_Receive();
gsm_waitfor('K');
gsm_waitfor('\n');
_delay_ms(300);
clrscr();
LCD_write_string("Ph:");
LCD_write_string(number);
gotoxy(1,0);
LCD_write_string("Msg:");
LCD_write_string(msg);
_delay_ms(2000);
if(!strcmp(msg,"Motor on "))
{
PORTB |= (1<<PB2);
}
if(!strcmp(msg,"Motor off"))
{
PORTB &= ~(1<<PB2);
}
gsm_delete();
}
}
_delay_ms(1000);
}
int main(void)
{
DDRB  |= (1<<PB2);
lcd_init();
LCD_write_string("Initializing... ");
gsm_init();
gsm_delete();
while(1)
{
gsm_read();
}
return 0;
}

==========

and save the file name

gsmEG.c

Second

=========

GSM




#ifndef GSM
#define GSM
#include <avr/io.h>
#include <util/delay.h>
#include <string.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include "lcd.h"
char msg[10];
char number[14];
int i,j;
void UART_Init( unsigned int baud );
void UART_Transmit_char( unsigned char data );
unsigned char UART_Receive( void );
void UART_Transmit_string( char *string );
void UART_Init( unsigned int baud )
{
  /* Set baud rate */
  UBRRH = (unsigned char)(baud>>8);
  UBRRL = (unsigned char)baud;
  /* Enable receiver and transmitter */
  UCSRB = (1<<RXEN)|(1<<TXEN);
  /* Set frame format: 8data, 1stop bit */
  UCSRC = (1<<URSEL)|(0<<USBS)|(3<<UCSZ0);
}
void UART_Transmit_char( unsigned char data )
{
  /* Wait for empty transmit buffer */
  while ( !( UCSRA & (1<<UDRE)) )
  ;
  /* Put data into buffer, sends the data */
  UDR = data;
}
unsigned char UART_Receive( void )
{
  /* Wait for data to be received */
   while ( !(UCSRA & (1<<RXC)) )
   ;
   /* Get and return received data from buffer */
   return UDR;
}
void UART_Transmit_string( char string[] )
{
  int i=0;
  while ( string[i] > 0)
  UART_Transmit_char(string[i++]);
}
/*************************************************************/
void gsm_init(void);
void gsm_read(void);
void gsm_send(char *number,char *string);
void gsm_delete(void);
void gsm_waitfor(char c);
void gsm_waitfor(char c)
{
//enabling watchdogtimer with a time of 2.1secs
wdt_enable(7);
//waiting for the byte to be received
while(UART_Receive()!= c);
//resetting watchdogtimer and turning off the watchdogtimer
wdt_reset();
wdt_disable();
}
void gsm_init()
{
UART_Init(103); // baudrate=9600
gotoxy(1,0);
LCD_write_string(" Testing Modem  ");
_delay_ms(500);
UART_Transmit_string("AT\r");
gsm_waitfor('O');
gsm_waitfor('K');
gotoxy(1,0);
LCD_write_string("   Modem : OK   ");
_delay_ms(1000);
INS:
gotoxy(1,0);
LCD_write_string(" Checking SIM   ");
_delay_ms(500);
UART_Transmit_string("AT+CSMINS?\r");
gsm_waitfor( '\n');
gsm_waitfor(',');
if(UART_Receive() == '2')
{ 
gotoxy(1,0);
LCD_write_string("  SIM NOTFOUND  ");
_delay_ms(1000);
goto INS;
}
else if(UART_Receive() == '1');
gsm_waitfor( 'K');
gsm_waitfor( '\n');
gotoxy(1,0);
LCD_write_string("   SIM FOUND    ");
_delay_ms(1000);
REG:
gotoxy(1,0);
LCD_write_string(" Network Status ");
_delay_ms(500);
UART_Transmit_string("AT+CREG?\r");
gsm_waitfor( '\n');
gsm_waitfor(',');
if(UART_Receive() == '2')
{
gotoxy(1,0);
LCD_write_string("Network NotFound");
_delay_ms(1000);
goto REG;
}
else if(UART_Receive() == '1');
gsm_waitfor( 'K');
gsm_waitfor( '\n');
gotoxy(1,0);
LCD_write_string(" Network Found  ");
_delay_ms(1000);
UART_Transmit_string("AT+CMGF=1\r");
gotoxy(1,0);
LCD_write_string("Setting Textmode");
gsm_waitfor('O');
gsm_waitfor('K');
gotoxy(1,0);
LCD_write_string("  Textmode set  ");
_delay_ms(1000);
}
void gsm_delete()
{
UART_Transmit_string("AT+CMGD=1\r");
gsm_waitfor('K');
gsm_waitfor('\n');
_delay_ms(500);
}
#endif

=======

save the file name GSM.h

Third

=========

LCD





#include<avr/io.h>
#include<util/delay.h>
#include<inttypes.h>
#include "lcd.h"
void LCD_write_string(const char *str) //store address value of t                                        he string in pointer *str
{
int i=0;
while(str[i]!='\0') // loop will go on till the NULL character in                           the string
{
if (str[i]=='*')
{
i++;
int8_t cc=str[i]-'0';
if(cc>=0 && cc<=7)
{
dis_data(cc);
}
else
{
dis_data('%');
dis_data(str[i]);
}
}
else dis_data(str[i]); // sending data on LCD byte by byte
i++;
}
return;
}
void lcd_init() // function for initialize
{
DDRA=0xFF;
dis_cmd(0x02); // to initialize LCD in 4-bit mode.
dis_cmd(0x28); //to initialize LCD in 2 lines, 5X7 dots and 4bit                     mode.
dis_cmd(0x0C);
dis_cmd(0x06);
dis_cmd(0x0E);
custom_char();
gotoxy(0,0);
}
void dis_cmd(char cmd_value)
{
char cmd_value1;
cmd_value1 = ((cmd_value>>4) & 0x0F); //shift 4-bit and mask
lcdcmd(cmd_value1); // send to LCD
cmd_value1 = cmd_value & 0x0F; //mask lower nibble because PA4-PA                                 7 pins are used.
lcdcmd(cmd_value1); // send to LCD
}
void dis_data(char data_value)
{
char data_value1;
data_value1=((data_value>>4)&0x0F);
lcddata(data_value1);
data_value1=data_value&0x0F;
lcddata(data_value1);
}
void lcdcmd(char cmdout)
{
PORTA=cmdout;
PORTA&=~(1<<rs);
PORTA&=~(1<<rw);
PORTA|=(1<<en);
_delay_ms(1);
PORTA&=~(1<<en);
}
void lcddata(char dataout)
{
PORTA=dataout;
PORTA|=(1<<rs);
PORTA&=~(1<<rw);
PORTA|=(1<<en);
_delay_ms(1);
PORTA&=~(1<<en);
}
void clrscr()
{
_delay_ms(10);
dis_cmd(0x01);
_delay_ms(100);
}
void gotoxy(char a,char b)
{
if(a==0)  a=0b10000000;
else if(a==1) a=0b11000000;
else if(a==2) a=0b10010100;
else if(a==3) a=0b11010100;
dis_cmd(a+b); 
}
void custom_char()
{
unsigned char c[]={0x04, 0x0E, 0x0E, 0x1F, 0x1F, 0x0E, 0x0E, 0x04, //Char0
0x1F, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04, 0x04,  //Char1
0x01, 0x01, 0x01, 0x05, 0x05, 0x15, 0x15, 0x15, //Char2
0x00, 0x00, 0x00, 0x04, 0x04, 0x14, 0x14, 0x14, //Char3
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, //Char4
0x00, 0x00, 0x0A, 0x00, 0x04, 0x1F, 0x0A, 0x04, //Char5
0x00, 0x04, 0x0A, 0x11, 0x1F, 0x00, 0x00, 0x00, //Char6
0x00, 0x00, 0x00, 0x1F, 0x11, 0x0A, 0x04, 0x00, //Char7
};
uint8_t a[]={72,80,88,96,104,112,120,64};
uint8_t i,j;
for(i=0;i<sizeof(a);i++)
{
dis_cmd(a[i]);
for(j=0;j<sizeof(c);j++)
{
dis_data(c[j]);
}
}

}

=========

gsm.h

 

then i can not understand what should i do to save the file , i lost the file saving sequence

Please help me

 

 

Hi it is very good but circuit diagram is not clear to see. Please replace it with good resolution.

 

In source code why coding is repeated? When I build code there is error like:

Error GSM.h: No such file or directory GccApplication1 C:\Users\RnD\Documents\Atmel Studio\7.0\GccApplication1\GccApplication1\main.cpp 12
 whhat is solution for it?
Please say as soon as possible.
Sir my gsmmodule network led continuosly blink fastly when sim is inserted and in xctu window the dot running fastly i am not able enter the command sir plz help me it is my colg project
Can i use this code to mak gsm control switch . This some explanation Mm i doing smart extension using microcontroller and gsm modem. I can on/off the swicth just by sending message .

what to do after the testing moden plzz expalin step wise

 

how to give gsm_waitfor   command to the board

 

Sir,

I am really impressed in your project and I wish to do the same project myself.could you please inform me more about the project through my email. my mail id is:[email protected]

pls i need this same code in arduino uno. my email is [email protected].

 thks

Sir, pls tell me the software that I hv to use or send me the link of the software to my email [email protected]

 

sir, also  send me the library filles of gsm

 

This project is very important for everyone

pls sent your sell no;

how can i get c nad hex code of this program?

 

why this person has given different codes for different use.

 

Anyone with the combined code of the application(i.e. gsm based ac appliance control using any controller)

please mail me at [email protected] asap.:)

what is the use of this  "ganesh"

unsigned char c[]={0x04, 0x0E, 0x0E, 0x1F, 0x1F, 0x0E, 0x0E, 0x04, //Char0
0x1F, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04, 0x04,  //Char1
0x01, 0x01, 0x01, 0x05, 0x05, 0x15, 0x15, 0x15, //Char2
0x00, 0x00, 0x00, 0x04, 0x04, 0x14, 0x14, 0x14, //Char3
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, //Char4
0x00, 0x00, 0x0A, 0x00, 0x04, 0x1F, 0x0A, 0x04, //Char5
0x00, 0x04, 0x0A, 0x11, 0x1F, 0x00, 0x00, 0x00, //Char6
0x00, 0x00, 0x00, 0x1F, 0x11, 0x0A, 0x04, 0x00, //Char7
};

//// plz reply

 

Hi friend please change the code to pic 16f877a in ..........

good but what is the steps in saving and running the codes?

 

 

 

hi, same method of circuit, but i use ic AT89c51, it possible.

Hi brother I want the source code of the project.... Can I get the code plz.... My mail id is [email protected]

sir can u explain gsm_waitfor()..how does it work?

sir i need code for gsm controlled based appliances ,and i use ISI 7 proteus and CVAVR 

its very urgent...

 

Grear (Y)  really impressed :)

need your help for my FYP 

Email= [email protected]

Kindly provide us ur contact detail at [email protected]