Home Documentation
Home Documentation
Home Documentation
Working:
The working model is explained as:GSM Modem: GSM modem is a plug and play device and is attached to the microcontroller which communicates via RS232 port. GSM modem is a bridge responsible for enabling/ disabling of SMS capability. Cell Phone: Mobile device communicates with the GSM Modem via radio waves. The mode of communication is wireless and mechanism works on the GSM technology. Cell phone has a SIM card and a GSM subscription. This cell phone number is configured on the system. User transmits instructions via SMS and the system takes action against those instructions.
1.4 ADVANTAGES
The main advantages of Home automation are Global Range Low Cost Low Power Requirement
This can be explained in below: Our mini project has many advantages such as remote controlling of home appliances, availability and ease of users. The user can get alerts anywhere through the GSM technology thus making the system location independent. The system contains low cost components easily available which cuts down the overall system cost. Moreover system alerts user about breach via SMS providing home security also it allows secure access due to pre-configured number. The ease of deployment is due to wireless mode of communication. GSM technology provides the benefit that the system is accessible in remote areas as well. The system reliability increases due to the useful features such as battery level checking, charging status and signal strength indicating the system about threats. The system integration is simple and is also scalable and extensible. The auto-configuration capability allows the system auto enabling/disabling of certain features. As we are using gsm technology we can operate our home from any where .
1.5 APPLICATIONS
POWER SUPPLY
GSM MODEM
LCD
8051 MICRO
CONTROLLER
GSM
Mobile
RELAY
load
Implementation
Devices are connected to an embedded system. The embedded system is programmed to control the devices according to commands from a remote.
GSM, the Global System for Mobile communications, is a digital cellular communications system, which has rapidly gained acceptance and market share worldwide, although it was initially developed in a European context. In addition to digital transmission, GSM incorporates many advanced services and features, including ISDN compatibility and worldwide roaming in other GSM networks. The advanced services and architecture of GSM have made it a model for future third-generation cellular systems, such as UMTS. This paper will give an overview of the services offered by GSM, the system architecture, the radio transmission structure, and the signaling functional architecture
2.3.2 RS232
In order to connect micro controller or a PC to GSM or ZIGBEE modem a serial port is used. Serial, is a very common protocol for device communication that is standard on almost every PC. Most computers include RS-232 based serial ports. Serial is also a common communication protocol that is used by many devices for instrumentation. In serial communication, the data is sent one bit at a time where as in parallel communication; the data is sent a byte or more at time. Serial communication uses a single data line where as the parallel communication uses 8 bit data line, this makes serial communication not only inexpensive but also makes it possible for two computers located in two different cities to communicate over the telephone.
RS-232 WAVEFORM
The diagram above shows the expected waveform from the UART when using the common 8N1 format. 8N1 signifies 8 Data bits, No Parity and 1 Stop Bit. The RS-232 line, when idle is in the Mark State (Logic 1). A transmission starts with a start bit which is (Logic 0). Then each bit is sent down the line, one at a time. The LSB (Least Significant Bit) is sent first. A Stop Bit (Logic 1) is then appended to the signal to make up the transmission. The data sent using this method, is said to be framed. That is the data is framed between a Start and Stop Bit.
RS-232 LEVEL CONVERTER Standard serial interfacing of microcontroller (TTL) with PC or any RS232C Standard device , requires TTL to RS232 Level converter . A MAX232 is used for this purpose. It provides 2-channel RS232C port and requires external 10uF capacitors. GSM BASED HOME AUTOMATION 9
10
Features :
The basic architecture consists of the following features: an eight bit ALU 32 discrete I/O pins (4 groups of 8) which can be individually accessed two 16 bit timer/counters full duplex UART 6 interrupt sources with 2 priority levels 128 bytes of on board RAM separate 64K byte address spaces for DATA and CODE memory
11
Pin diagram:
Pin Description:
VCC: Supply voltage. GND: Ground. Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, GSM BASED HOME AUTOMATION 12
they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL ) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification
Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL ) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups.Port 3 receives some control signals for Flash programming and verification.Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table.
Port pin P3.0 Alternate functions RXD (serial input port)
13
TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory write strobe) RD (external data memory read strobe)
RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN: Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to GSM BASED HOME AUTOMATION 14
FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCCfor internal program executions.This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier
Pin Description
Pin Number Description
18 9 10 17 18 19 20 21 28 29 30 31 32 39 40
P1.0 - P1.7 - Port 1 RST - Reset P3.0 - P3.7 - Port 3 XTAL2 - Crystal XTAL1 - Crystal GND - Ground P2.0 - P2.7 - Port 2 PSEN - Program Store Enable ALE - Address Latch Enable EA - External Access Enable P0.7 - P0.1 - Port 0 Vcc - Positive Power Supply
15
3.2.1Description:
A GSM modem can be an external modem device, such as the Wavecom FASTRACK Modem. Insert a GSM SIM card into this modem, and connect the modem to an available serial port on your computer. A GSM modem can be a PC Card installed in a notebook computer, such as the Nokia Card Phone. A GSM modem could also be a standard GSM mobile phone with the appropriate cable and software driver to connect to a serial port on your computer. Phones such as the Nokia 7110 with a DLR-3 cable, or various Ericsson phones, are often used for this purpose. A dedicated GSM modem (external or PC Card) is usually preferable to a GSM mobile phone. This is because of some compatibility issues that can exist with mobile phones. For example, if you wish to be able to receive inbound MMS messages with your gateway, and you are using a mobile phone as your modem, you must utilize a mobile phone that does not support WAP push or MMS. This is because the mobile phone automatically processes these messages, without forwarding them via the modem interface. Similarly some mobile phones will not allow you to correctly receive SMS text messages longer than 160 bytes (known as concatenated SMS or long SMS). This is because these long messages are actually sent as separate SMS messages, and the phone attempts to reassemble the message before forwarding via the modem interface When you install your GSM modem, or connect your GSM mobile phone to the computer, be sure to install the appropriate Windows modem driver from the device manufacturer. To simplify configuration, the Now SMS/MMS Gateway will communicate with the device via this driver. An additional benefit of utilizing this driver is that you can use Windows diagnostics to ensure that the modem is communicating properly with the computer
16
Figure: GSM modem Now SMS/MMS gateway can simultaneously support multiple modems, provided that your computer hardware has the available communications port resources
Global System for Mobile Communications (GSM) modems are specialized types of modems that operate over subscription based wireless networks, similar to a mobile phone. A GSM modem accepts a Subscriber Identity Module (SIM) card, and basically acts like a mobile phone for a computer. Such a modem can even be a dedicated mobile phone that the computer uses for GSM network capabilities. A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. It is a Most Popular Mobile Technology Launch -1991by Radio linja in Finland Frequencies -900/1800MHz Range Global Interface Subscriber Identity Module Services SMS, MMS, GPRS, EDGE
17
3.2.2 AT Commands :
In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like:
* * *
Reading, writing and deleting SMS messages. Sending SMS messages. Reading, writing and searching phone book entries.
AT commands features: Line settings: A serial link handler is set with the following default values. Autobaud,
8 bits data, 1 stop bit, no parity, flow control. Command line: Commands always start with AT (which means attention) and finish with a <CR>character. .
18
The message reference, <mr>, which is returned to the application is allocated by the product. This number begins with 0 and is incremented by one for each outgoing message (successful and failure cases); it is cyclic on one byte (0 follows 255). Note: this number is not a storage number - outgoing messages are not stored.
19
Fig. LCD Display The LCD display consists of two lines, 20 characters per line that is interfaced with the PIC16F73.The display contains two internal byte-wide registers, one for commands (RS=0) and the second for characters to be displayed (RS=1). It also contains a user-programmed RAM area (the character RAM) that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h will be chosen Port1 is used to furnish the command or data type, and ports 3.2 to 3.4 furnish register select and read/write levels.
20
3.3.1 PIN DIAGRAM The Pin diagram for LCD is shown in the following fig and the pin description is also explained in Table
GN D
+5 v
VD
D
15
16
D5 D6 D7
21
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD will require a total of 7 data lines. If an 8-bit data bus is used, the LCD will require a total of 11 data lines. The three control lines are EN, RS, and RW. Note that the EN line must be raised/lowered before/after each instruction sent to the LCD regardless of whether that instruction is read or write, text or instruction. In short, you must always manipulate EN when communicating with the LCD. EN is the LCD's way of knowing that you are talking to it. If you don't raise/lower EN, the LCD doesn't know you're talking to it on the other lines.
22
3.4.RELAYS
A relay is an electromagnetic switch. In other words it is activated when a current is applied to it. Normally a relay is used in a circuit as a type of switch (as you will see below). There are different types of relays and they operate at different voltages. Relays are switching devices, it has two fixed positions i.e., ON and OFF positions. Circuit symbol of relay:
NO -"Normally Open", NC -"Normally Closed". COM -common connection for double pole switches
A relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways:
Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called a Form A contact or "make" contact. Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called a Form B contact or "break" contact. Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called a Form Ccontact or "transfer" contact ("break before make"). If this type of contact utilizes a "make before break" functionality, then it is called a Form D contact.
23
Electromagnetic relay:
Out of different types of relays, Most commonly used relay is Electromagnetic Relay. The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energized, by passing current through it, the core becomes temporarily magnetized.
The magnetized core attracts the iron armature. The armature is pivoted which causes it to operate one or more sets of contacts. When the coil is de-energized the armature and contacts are released. The coil can be energized from a low power source such as a ransistor while the contacts can switch high powers such as the mains supply. The relay can also be situated remotely from the control source. Relays can generate a very high voltage across the coil when switched off. This can damage other components in the circuit. To prevent this a diode is connected across the coil. The cathode of the diode is connected to the most positive end of the coil.The springsets (contacts) can be a mixture of n.o, n.c and c.o. Look at the page on switches to see how they can be used in circuits. Various coil operating voltages (ac and dc) are available.The actual contact points on the springsets are available for high current and low current operation. The REED RELAY has a much faster operation than the relays described above.
24
The following designations are commonly encountered: SPST Single Pole Single Throw. These have two terminals which can be connected or disconnected. Including two for the coil, such a relay has four terminals in total. It is ambiguous whether the pole is normally open or normally closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the ambiguity. SPDT Single Pole Double Throw. A common terminal connects to either of two others. Including two for the coil, such a relay has five terminals in total. DPST Double Pole Single Throw. These have two pairs of terminals. Equivalent to two SPST switches or relays actuated by a single coil. Including two for the coil, such a relay has six terminals in total. The poles may be Form A or Form B (or one of each). DPDT Double Pole Double Throw. These have two rows of change-over terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has eight terminals, including the coil. The "S" or "D" may be replaced with a number, indicating multiple switches connected to a single actuator. For example 4PDT indicates a four pole double throw relay (with 14 terminals). EN 50005 are among applicable standards for relay terminal numbering; a typical EN 50005-compliant SPDT relay's terminals would be numbered 11, 12, 14, A1 and A2 for the C, NC, NO, and coil connections, respectively.
Fig. SPST, PDT, DPST, DPDT diagrams
Circuit symbols of relays. "C" denotes the common terminal in SPDT and DPDT types
25
AC I/P
Transformer
Rectifier
Filter
Regulator
Load
Transformer
The potential transformer will step down the power supply voltage (0-230V) to (06V) level. Then the secondary of the potential transformer will be connected to the precision rectifier, which is constructed with the help of opamp. The advantages of using precision rectifier are it will give peak voltage output as DC, rest of the circuits will give only RMS output.
26
Bridge rectifier
Bridge rectifier is used to maintain the proper DC polarity at the input to the circuit, irrespective of telephone line polarity. It comprises of four diodes connected to form a bridge. It uses the entire AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in fig below.
IN4007 IN4007
AC I/P
IN4007
IN4007 O/P
IC Voltage Regulators:
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the circuitry for reference source, comparator amplifier, control device, and overload protection all in a single IC. Although the internal construction of the IC is somewhat different from that described for discrete voltage regulator circuits, the external operation is much the same. IC units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an adjustably set voltage.
27
Vout
The series 78 regulators provide fixed regulated voltages from 5 to 24 V. Unregulated input voltage Vin is filtered by capacitor C1 and connected to the ICs IN terminal. The ICs OUT terminal provides a regulated + 12V which is filtered by capacitor C2. The third IC terminal is connected to ground (GND). The Power
Section consists of a centre tapped step-down transformer, which is used to step down the 230V AC into 12V. This 12V is given to bridge rectifier. The output from the diodes is a full-wave rectifier output. Any unwanted ac ripples are filtered out using a filter. This is fed to the 7805 voltage regulator that gives anoutput voltage of +5v.
28
29
A new window appears as shown in figure 2 below and you are now required to configure your setup to target the specific MicroController device you wish to use (in this example we will be using the ADuC834) and the output file format generated after the compilation stage. This is achieved by completing the following steps.
Next, you need to configure your target output options. This is done by clicking on the options for target item located in the project pull-down menu. Alternatively you can select this option by clicking on the icon from the compile toolbar situated at the top of the screen and shown in figure 3 below.
A new window appears as shown in figure 4. Enable the option to Create Hex File by ticking the check-box and pressing OK as shown circled in figure 4 below.
30
Now you can begin writing your C program. In the main window, choose the File pulldown menu and select New. A new window named <text1> will appear on the screen. Type the C source code that is included in Appendix A of this tech note into the <text1> window. Once you've typed all the code, again choose the File pull-down menu and select Save.
31
COMPILING A C PROGRAM Our C code is compiled by selecting Build Target from the Project pull-down menu on the main tool-bar. The compile option can also be initiated by selecting the F7 special function key or by clicking on the Build Target icon in the compile toolbar as shown in figure 6 below.
If the compilation completes successfully a message indicating that the compile job has completed with 0 errors will appear in the build dialog screen. Sometimes warnings may be generated for information purposes to indicate multiple function calls etc. If the resultant compilation message indicates that there were 1 or more errors, then the output files will not be created. In this case, the file has been entered incorrectly and clicking directly on any error message forces uVision to highlight where in the code the error has occurred.
4.2.SIMULATING C-SOURCE CODE Another powerful feature of the uVision2 IDE is that it allows you to run your code in a MicroController specific simulation environment. To start a simulation session you simply click on the on Start/Stop Debug Session option available from the Debug pulldown menu. Alternatively you can press <Cntrl+F7> or the Debug icon available in the File toolbar as shown in figure 7.
32
CREATING THE SIMULATION ENVIRONMENT The following steps will allow you to create a generic simulation environment that you may want to further customize to your own requirements. From the top Debug toolbar, click on the icon buttons that are shown in figure 8 below which open a Serial I/O peripheral window as well as a code Performance Analyzer window. Note: If the Debug toolbar does not appear at the top of the screen, simply select the Debug Toolbar option available from the View pull-down menu.
33
4.3SOURCE CODE
Program : #include<c51.h> void transmit(unsigned char *); void serial_init(); sbit led=P1^3; unsigned char *tx_dat; unsigned char a[70],y[5]; unsigned char b[3],c[3]={"Son"},c1[3]={"Sof"}; int i=0,j=0,k=0,x=0,l=0,Z=0; void main() { LCD_Init(); lprintf("Gsm-recv",1,1); Delay(100); LCD_Cmd(0x01); led=0; serial_init(); ///////////////// AT /////////////////////// while(1) { LCD_Cmd(0x80); tx_dat="at"; transmit(tx_dat); SBUF=13; j=0; while(j<70) { if((a[j]=='O')&&(a[j+1]=='K')) { GSM BASED HOME AUTOMATION 34 //Polling for OK //Transmit AT command //Transmit ENTER //led off
LCD_Data(a[j]); LCD_Data(a[j+1]); Z=1; break; } j++; } if(Z==1) { Z=0; loop: while(1) { Delay(50); LCD_Cmd(0x01); lprintf("send read command",1,1); tx_dat="at+cmgr=1"; transmit(tx_dat); SBUF=13; Delay(50); j=0; lprintf("wait for error",2,0); while(j<70) { LCD_Cmd(0x01); if((a[j]=='E')&&(a[j+4]=='R')) { lprintf("ERROR",1,1); goto loop; } j++; } GSM BASED HOME AUTOMATION //delay
//Display OK
/////RECEIVE//////
35
j=0; Delay(50); LCD_Cmd(0x01); lprintf("reading message",1,1); while(j<70) { if((a[j]=='#')&&(a[j+4]=='!')) { b[0]=a[j+1]; b[1]=a[j+2]; b[2]=a[j+3]; break; } j++; } LCD_Cmd(0x01); LCD_Cmd(0xc0); LCD_Data(b[0]); LCD_Data(b[1]); LCD_Data(b[2]); if((b[0]==c[0])&&(b[1]==c[1])&&(b[2]==c[2])) { Delay(50); LCD_Cmd(0x01); lprintf("led on",1,1); led=1; Delay(50); } if((b[0]==c1[0])&&(b[1]==c1[1])&&(b[2]==c1[2])) { Delay(50); LCD_Cmd(0x01); GSM BASED HOME AUTOMATION 36 //compare with sof //led on //compare with son //display message //Polling for message
lprintf("led off",1,1); led=0; Delay(60); } b[0]='\0'; b[1]='\0'; b[2]='\0'; Delay(50); LCD_Cmd(0x01); lprintf("send delet command",1,1); tx_dat="at+cmgd=1"; transmit(tx_dat); SBUF=13; j=0; while(j<70) { if((a[j]=='O')&&(a[j+1]=='K')) { LCD_Cmd(0x80); lprintf("Message Deleted",1,1); Delay(100); break; } j++; } } } } } /* void delay(unsigned int x) { GSM BASED HOME AUTOMATION 37 //Polling for OK /////delete////// //Trasmit delete command //Trasmit ENTER //led of
void intr(void) interrupt 4 { if(RI) { RI=0; a[i]=SBUF; if(i==69) { //a[69]='\0'; i=0; } i++; } GSM BASED HOME AUTOMATION 38
} void transmit(unsigned char *tx) { while(*tx) { SBUF=*tx++; Delay(15); } SBUF=13; Delay(2); TI=0; i=0; } C51.h program: #include<reg51.h> #include<intrins.h> // Device Mapping #define LCD_Port P2 sbit LCD_RS=P1^0; sbit LCD_RW=P1^1; sbit LCD_EN=P1^2; sbit LCD_BP=P0^7;
// Global variables unsigned char bc=0,pflag=0,fstore=0; unsigned char xdata RData[100]; unsigned char xdata Msg[20];
// Functions Prototype Declaration void lprintf(unsigned char *,unsigned char,unsigned char); void LCD_Init(); void LCD_Cmd(unsigned char); void LCD_Data(unsigned char); void Delay_10ms(); void Delay(int); GSM BASED HOME AUTOMATION 39
void LCD_Busy(); void ClrLCD(); void SConfig(void); void Send_Char(unsigned char); void Send(unsigned char *); /*----------------------------------------------*/ // To Clear LCD /*----------------------------------------------*/ void ClrLCD() { LCD_Cmd(0x01); } /*----------------------------------------------*/ // Displaying String /*----------------------------------------------*/ // Displaying String void lprintf(char *str,unsigned char ln,unsigned char col) { static int li; unsigned char line; if(li==0) { li=1; LCD_Init(); } switch(ln) { case 1: line = 0x80; break; case 2: line = 0xc0; break; case 3: line = 0x94; break; case 4: line = 0xD4; break; } LCD_Cmd(line+col-1);
40
/*----------------------------------------------*/ //LCD Initilization void LCD_Init() { LCD_Cmd(0x30); LCD_Cmd(0x30); LCD_Cmd(0x30); LCD_Cmd(0x38); LCD_Cmd(0x06); LCD_Cmd(0x01); LCD_Cmd(0x0c); } /*----------------------------------------------*/ // LCD Command Run void LCD_Cmd(unsigned char cmd) { LCD_Busy(); LCD_Port=cmd; LCD_BP=0; _nop_(); LCD_BP=1; LCD_RS=0; LCD_RW=0; LCD_EN=1; _nop_(); _nop_(); LCD_EN=0; } /*----------------------------------------------*/ //LCD Data Out Function void LCD_Data(unsigned char dt) { LCD_Busy(); LCD_Port=dt; LCD_BP=0; _nop_(); LCD_BP=1; LCD_RS=1; LCD_RW=0; LCD_EN=1; GSM BASED HOME AUTOMATION 41
_nop_(); _nop_(); LCD_EN=0; } /*----------------------------------------------*/ // LCD BUSY Check Function void LCD_Busy() { /* LCD_Port=0xff; LCD_RS=0; LCD_RW=1; while(1) { LCD_EN=0; _nop_(); _nop_(); LCD_EN=1; if(!LCD_BP) break; } Delay(1); */ unsigned int i; for(i=0; i<800; i++); } /*/*----------------------------------------------*/ // Delay Function void Delay(int n) { while(n) { Delay_10ms(); n--; } }
for(i=0; i<1825; i++); } /*-------------------------------------------*/ //Functions For Serial Communication /*-------------------------------------------*/ // Serial Configuration void SConfig() { TMOD=0x20; TH1=-6; TL1=-6; SCON=0x50; TR1=1; } /*-------------------------------------------*/ // Function to Tx a single Character void Send_Char(unsigned char ch) { unsigned char flag=0; SBUF=ch; while(!TI); TI=0; } /*-------------------------------------------*/ // Funciton to Tx a given String void Send(unsigned char *str) { while(*str) { Send_Char(*str); str++; } } /*-------------------------------------------*/ // Interrupt Subroutien Function Serial_Int() interrupt 4 using 1 { unsigned char t; if(RI) { t=SBUF; GSM BASED HOME AUTOMATION 43
RI=0; if(t == 'A') fstore =1; if(fstore) { RData[bc++]=t; RData[bc]='\0'; } if(bc>40) { pflag=1; fstore=0; bc=0; } // LCD_Data(RData[bc-1]); // Send_Char(RData[bc-1]); Interrupt. } }
44
FUTURE ENHANCMENTS
In this project in future we can add a multimedia camera to see what is going inside the home by sitting in office or somewhere. It can be used for high security in banks and other organizations Provision to store mobile numbers Control of more devices Theft Alert.
CONCLUSION
In the paper low cost, secure, ubiquitously accessible, auto-configurable, remotely controlled solution for automation of homes has been introduced. The approach discussed in the project is novel and has achieved the target to control home appliances remotely using the SMS-based system satisfying user needs and requirements. GSM technology capable solution has proved to be controlled remotely, provide home security and is cost-effective as compared to the previously existing systems. Hence we can conclude that the required goals and objectives of HACS have been achieved. In addition, which is an era when the number of mobile phone users growing at a high rate, this system makes use of the mobile networks to provide the users with a simple and cheap Home Automation System.
45
REFERNCES
Reference Books:
The 8051 Microcontroller and Embedded Systems The 8051 Micro-controller Programming and customizing the 8051 -Muhammad Ali Mazidi - Ayala - Myke Predko
Websites:
www.atmel.com www.analogicgroup.com www.philips.com www.google.com www.gsmworld.com
46