46
“DESIGN AND IMPLEMENTATION OF HOME AUTOMATION SYSTEM USING GSM TO CONTROL ELECTRICAL APPLIANCES” Certificate of Approval We accept the work contained in this report titled, “DESIGN AND IMPLEMENTATION OF HOME AUTOMATION SYSTEM USING GSM TO CONTROL ELECTRICAL APPLIANCES” as a confirmation to the required standard for the partial fulfillment of the degree of Bachelor of Electrical Engineering. __________________ __________________ Chairman, EED Supervisor __________________ __________________ Internal Examiner External Examiner 1

Design and implementation of home automation system using gsm to control electrical appliances

Embed Size (px)

Citation preview

Page 1: Design and implementation of home                         automation system using gsm to    control electrical appliances

“DESIGN AND IMPLEMENTATION OF HOME AUTOMATION SYSTEM USING GSM TO CONTROL ELECTRICAL APPLIANCES”

Certificate of Approval

We accept the work contained in this report titled, “DESIGN AND IMPLEMENTATION OF HOME

AUTOMATION SYSTEM USING GSM TO CONTROL ELECTRICAL APPLIANCES” as a confirmation to

the required standard for the partial fulfillment of the degree of Bachelor of Electrical

Engineering.

__________________ __________________

Chairman, EED Supervisor

__________________ __________________

Internal Examiner External Examiner

1

Page 2: Design and implementation of home                         automation system using gsm to    control electrical appliances

Declaration of AuthorshipWe declare that this thesis titled, “Designing control systems for human leg” and the work presented in it are our own. We confirm that:

This work was done wholly or mainly while in candidature forBachelor of Electrical Engineering degreeat this University.

Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this hasbeen clearly stated.

Where we have consulted the published work of others, this is always clearlyattributed.

Where we have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely our own work. We have acknowledged all main sources of help.

Project Members:

1) IZAZ ALI

2) BILAL

3) HAROON KHAN

2

Page 3: Design and implementation of home                         automation system using gsm to    control electrical appliances

ACKNOWLEDGMENTThe satisfaction and euphoria that accompany the successful completion of any project would be incomplete without a mention of people who made it possible and whose constant guidance and encouragement crown all the efforts. This project was special because it was our final year project and we took a great interest while completing it. It was not only a technical project but also the initiation of us, (the fresher), into the practical world.

We extend our sincere vote of thanks to ENGR. HASHMAT KHANfor his guidance and support throughout the completion of this Project.

We would also like to thank Department of Electrical Engineering for taking genuine interest in any queries we put up and promptly replying back. All their support and encouragement has carried us all through the project.

Above all we are highly grateful to our parents whose continuous support throughout our education carrier helped us in achieving our academic goals.

3

Page 4: Design and implementation of home                         automation system using gsm to    control electrical appliances

ABSTRACTWith advancement of technology things are becoming simpler and easier for us. Automatic systems are being preferred over manual system. This project puts forth the equipment which enables users to control their home appliances using their cellular phone. It shows the construction and working of the device to wirelessly control the home appliances based on GSM networking and AT89c52 microcontroller. Initially an authenticated signal is sent from the user’s cellular phone via Global System for Mobile Communication (GSM) network to equipment. This signal or code consists of the information about the function or action to be taken place i.e. what appliance should be turned off or turned on? The receiver phone receives the SMS message that is send from the user’s phone and then sends it to the GSM modem which in turn sends the output digital signal to the microcontroller. Then the microcontroller, based on the received signal, controls the different relays and triggers the required appliance.

4

Page 5: Design and implementation of home                         automation system using gsm to    control electrical appliances

CHAPTER 1

INTRODUCTION With advancement of technology things are becoming simpler and easier for us. Automation is the use of control systems and information technologies to reduce the need for human work in the production of goods and services. In the scope of industrialization, automation is a step beyond mechanization. Whereas mechanization provided human operators with machinery to assist them with the muscular requirements of work, automation greatly decreases the need for human sensory and mental requirements as well. Automation plays an increasingly important role in the world economy and in daily experience. Automatic systems are being preferred over manual system. Through this project we have tried to show automatic control of a house as a result of which power is saved to some extent.

1. Home automationHome/office automation is the control of any or all electrical devices in our home or office, whether we are there or away. Home/office automation is one of the most exciting developments in technology for the home that has come along in decades. There are hundreds of products available today that allow us control over the devices automatically, either by remote control; or even by voice command.

Home automation (also called domestics) is the residential extension of "building automation". It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, and other systems, to provide improved convenience, comfort, energy efficiency and security. Disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care. [3]

A Many systems which proclaim "Home Automation" introduce automation for the sake of automation and sacrifice practicality and functionality. Due to this fundamental issue, Home Automation has not become mainstream but rather a fringe product support by a scattering of different companies with different ideas and solutions [5].

Buildings require security: Any automation system must address this issue and integrate security as a key element to the automation that the system will bring to the building heating and cooling control are also fundamental elements in all building. An automation system must be able to control these functions.

5

Page 6: Design and implementation of home                         automation system using gsm to    control electrical appliances

Figure 1.1: Home Automation System.

Many systems have modules capable of switching audio and video signals to different rooms. Rapid development of new technologies and formats such as High Definition TV and Blue Ray all quickly render existing home automation systems incompatible with the emergence of the new technology. Since a home automation system is integral to the core of a building and since the cost of these systems is relatively high, a home automation system must have a life span of at least 25 years. However the fast development of audio and video technologies forces the life span to be significantly less. Due to this trend it makes sense to isolate the automation system from any function than may render it pre-maturely obsolete. Our GSM based Home Automation system is designed around stable technologies and as such does not attempt to automate audio of video switching. In fact while this type of automation looks "flashy" in reality it is not automation but rather control.

Many home automation systems have gone down the path of elaborate graphic interfaces with touch LCD screens making the systems look very high tech and elaborate. And while these systems look great and can do some practical tasks, the fundamental purpose of home automation is to reduce the complexity in carrying out these control functions. When a light has to be turned on or off by first entering a menu on an LCD display, it cannot possibly be simpler, easier and faster than flicking a traditional light switch.

So what makes GSM based Home Automation different?Well, first of all, to turn on a light you could do exactly as you would now, that is flick the light switch. Similarly to turn off the light you could turn off the light switch. A fundamental element that it is impossible to beat is the simplicity of a light switch. This means an automation system must maintain and provide this form of control. Obviously a home automation system must introduce some "fundamental benefit". GSM based Home Automation can perform the added functions in controlling that one light:

Delay the light from turning off after the switch is turned off Disable the light from turning on from the switch when it is daytime outside Turn the light off when it gets bright outside Automatically turn the light on (for a pre-determined period of time) when it becomes

dark outside Automatically turn the light on when the alarm is armed or disarmed (or both) for a

pre-determined period of time, only when it is dark, or light, or both. Flash the light on and off when the Burglar alarm is tripped Flash the light to indicate an alarm arming or disarming is occurring Turn the light on when the alarm is tripped

6

Page 7: Design and implementation of home                         automation system using gsm to    control electrical appliances

Randomly turn the light on and off, after it has gone dark and the alarm has been armed

Timeout the light switch when it has been left on for a pre-determined period of time Turn the light on when another switch (in a different location) is turned on Turn the light on when an alarm sensor has detected motion, or an alarm switch has

opened (with or without the alarm being armed) Turn the light on and off via 8 programmable real time timers Turn the light on remotely via an SMS message from your GSM mobile phone Turn the light off remotely via an SMS message Disable the light from being turned on by any of the trigger conditions via an SMS

message Determine the state of the light from a report message sent to your mobile phone via

an SMS Turn the light on or off via the menu on the LCD screen on the main control unit Control the light with none, one or even all of the above conditions simultaneously

GSM based Home Automation takes the existing function of the traditional on/off light switch and adds significant automation benefits to control a light. The true power of GSM based Home Automation is that all the different automation controls can co-exist and work in unison in operating the light. GSM based Home Automation incorporates a series if easily programmable complex trigger conditions which provide truly accurate control [3].

For example if the light was located on the porch at the front of a house, the system could be programmed to control the light in the following manner.

When the front door was opened and it was night time the light would turn on for a pre-programmed period of time through an alarm sensor switch located on the door.

When a transition from dusk to night occurred the light would turn on for a period of time.

When the burglar alarm was armed or disarmed the light would flash to indicate the alarm state was being changed.

When the burglar alarm was armed or disarmed the light would stay on for a period of time, to light the way when the occupants leave or enter the house.

When the Burglar alarm was tripped the light would flash continuously, to clearly identify the street location of the alarm.

When the burglar alarm was armed and night time occurred the light would be turned on and off randomly for periods of time to give the impression someone was home controlling the light.

Using this configuration the front porch light would be operating in automatic mode. While a switch could still be used to control the light, in reality the automatic control would take care of all scenarios.

1.1Motivation As a reason of drastic developments in the field of wireless communications these days, the applications of this technology can be used in various sectors for making daily tasks comfortable and easy.

7

Page 8: Design and implementation of home                         automation system using gsm to    control electrical appliances

One such application can be used for control of electrical appliances which results in effective and efficient use of electrical power reducing the loss. This area has yet to be explored in major parts of the world. So we would like to take this opportunity to put forward a cost effective method for the wireless switching of the electrical appliances.

1.2Aims and Objectives

The main aim of the design provided in this project is to develop a system to have wireless control of home electrical appliances. The device can be made sure to be available at a low cost so that everyone can afford it.

This is basically a device built for home appliances control system that can provide remote access to house hold electrical appliances at low cost and in efficient way. The electrical devices connected in the home, office or any place, consume electrical power, and there is an absolute necessity of saving of power as per present day situations.

So it is necessary to control electrical devices more effectively and efficiently at anytime from anywhere. So this project is built for the sole purpose of efficient control of electrical appliances.

This project is basically built on the process of wireless communication through the GSM network. GSM plays a very important role in the present day life of a person.

Each and every person now-a-days has a cell phoned with him, and GSM network makes the people across the world to communicate with each other. So as technology is increasing so vastly now-a-days, everything in the world is being automated and wireless for the comfort of man.

So here we are building a device based on the GSM network to control the electrical appliances through a cellular phone. Here we are going to design a cell phone based remote control of electrical appliances.

This system is designed for controlling arbitrary devices according to the necessity. It includes a cell phone which is connected to the designed system. Basically for the system to work a phone call is made to the designated number or a message is being sent containing a password.

As the caller press the specific password, it results in turning ON/OFF of the particular device. The switching of devices is achieved by relays.

To eliminate the need of being physically present in any location for tasks. Involving the operation of appliances within a household/office. Minimize power and time wastage.

General Objectives of the Project

To co-ordinate appliances and other devices through the GSM network To eliminate the need of being physically present in any location for tasks involving

the operation of appliances within a household/office Minimize power and time wastage.

2.2Aim of the project

The aim of the project is to develop a system, which uses Mobile technology that keeps control of the various units of the automobiles, Computer system, which executes with respect to the signal sent by the mobile.

2.2Significance and applications

8

Page 9: Design and implementation of home                         automation system using gsm to    control electrical appliances

GSM based home automation plays a very important role in domestic applications. The ease of operation of the kit and low cost add up as an additional advantage for its usage.

2.2.1 ReliabilityReliability is one such factor that every electrical system should have in order to render its services without malfunctioning over a long period of time. \

2.2.2 CostThe design is implemented at a very economical price. The total cost incurred by us in designing this kit is very less and further we have developed the GSM based Home Automation which is more economical rather than just interfacing those which are readily available in the market [4].

For utilization of appliances the new concept has been thought to manage them remotely by using GSM, which enables the user to remotely control switching of domestic appliances. Just by dialing keypad of remote telephone, from where you are calling you can perform ON / OFF operation of the appliances.The ranges of appliances that can be controlled through tale remote systems are many in numbers. Some of them are as follows and this depends upon the usage priority of the appliances i.e. Lights, Music System or other electrical / electronic appliances.

CHAPTER 2 LITERATURE REVIEW

2.1History and BackgroundNow-a-days there is huge advancement in communication sector, almost everyone have access to mobile phones and thus the world has indeed become a global village. At any given moment, any person across the world can be contacted with the help of a mobile phone.

9

Page 10: Design and implementation of home                         automation system using gsm to    control electrical appliances

Mobile phones can not only be used for the calling and sending SMS but also new ideas can be generated and techniques can be developed from it that can further enhance its capabilities. There are huge technological advancements in wireless communication like Infra-red and Bluetooth which mostly took place in the recent years showing that further improvements are on the horizon to make our lives easier and comfortable. Having wireless control of almost all the things in a person’s life is a growing interest and many systems are developed providing such controls. With the inception of home automation labor saving machines were first priority of inventors. Self-contained electric or gas powered home appliances became viable in the 1900s with the introduction of electric power distribution and led to the introduction of water heaters in 1889 later washing machines in 1904 followed by refrigerators, sewing machines, dishwashers, and clothes dryers. In recent history i.e. 1975 X10 the first general purpose home automation network technology was developed, which is a communication protocol for electronic devices. It primarily uses electric power transmission wiring for signaling and control, where the signals involve brief radio frequency bursts of digital data and remains the most widely available. By 1978, X10 products included a 16 channel command console, a lamp module, and an appliance module. Soon after came the wall switch module and the first X10 timer [2]. In a research by ABIin United states 1.5 million home automation systems were installed by 2012. Here our main objective is to design a system that will enable us to have a complete control of the interface on which it is based.

2.2GSM Technology

GSM implies worldwide framework for versatile correspondence. GSM is a global advanced cell telecommunication. European Telecommunications Standard Institute coined GSM standard in 1989 its primary business administrations were launched in 1991 and after its initial presentation in Europe; the standard went worldwide in 1992. From that point forward GSM has turned into the most broadly embraced and quickly developing advanced standard, and it is situated to turn into the world's overwhelming cell standard. Today's third era GSM systems convey excellent and secure versatile voice and information administrations with full abilities over the world which is a massively fruitful engineering accomplishment. Since the first GSM system was industrially launched, it turned into, the world's heading and fastest developing portable standard. The GSM Association evaluates that advances characterized in the GSM standard serve 80% of the worldwide portable business, including more than 5 billion individuals scattered over more than 212 nations and domains, making GSM the most omnipresent of the numerous guidelines for cell systems.

Today's GSM stage is living, developing and advancing and as of now offers an extended and characteristic-rich "family" of voice and empowering administrations. The Global System for Mobile Communication (GSM) system is cell telecommunication system with an adaptable structural planning following the ETSI Gsm900/GSM 1800 standard. Seimen's usage is the advanced cell versatile correspondence framework D900/1800/1900 that uses the precise most recent innovation to meet each prerequisite of the standard [1].

2.3DTMF (Dual Tone Multi Frequency)

The main principle of the DTMF is that it takes a number code from the number pad converts it to DTMF (Dual tone multi frequency) signal and a DTMF decoder converts the DTMF signal to a digital code that can be fed to a microcontroller. A DTMF generator generates two

10

Page 11: Design and implementation of home                         automation system using gsm to    control electrical appliances

frequencies corresponding to a number or code in the number pad which is transmitted through the communication networks, constituting the transmitter section which is simply equivalent to a mobile set. In the receiver part, the DTMF detector IC, for example MT8870 detects the number code represented by DTMF back, through the inspection of the two transmitted frequencies. The DTMF frequencies representing the number codes are shown below [3].

Table 1: DMFT frequency corresponding to different numbers codes

1 2 3 A 697HZ

4 5 6 B 770HZ

7 8 9 C 852HZ

* 0 # D 941HZ

1209HZ 1336HZ 1477HZ 1633HZ

DTMF generation is a composition of two audio signals or two tones between the frequency 697Hz and 1633Hz. In a DTMF each row has its own unique tone frequency and also each column will have its own unique tone. The tone frequencies are selected such that harmonics and intermodulation products will not cause any unreliable signal. Each and every tone falls within a proper band pass before valid decoding takes place. If one tone falls outside the band pass spectrum, the decoder will become unreliable. A DTMF decoder’s main purpose is to detect the sinusoidal signals in the presence of noise.

CHAPTER 3METHODOLOGY

3.1 Home Appliance Control System (HACS)Home appliance control system is based on GSM network technology for transmission of SMS from sender to receiver. SMS sending and receiving is used for ubiquitous access of appliances and allowing breach control at home.The system proposes two sub-systems. Appliance control subsystem enables the user to control home appliances remotely whereas the security alert subsystem provides the remote security monitoring. The system is capable enough to instruct user via SMS from a specific cell number to change the condition of the

11

Page 12: Design and implementation of home                         automation system using gsm to    control electrical appliances

home appliance according to the user’s needs and requirements. The second aspect is that of security alert which is achieved in a way that on the detection of intrusion the system allows automatic generation of SMS thus alerting the user against security risk.

3.2 Methodology

The methodology followed in the HACS is given as. GSM hardware tests are run in order to check the hardware support. The system will

call GSM modem and it will get activated After activation the Modem will check for hardware support. If the hardware is

missing or some other hardware problem there will be error, resulting in communication failure and the application will be terminated

If hardware responds then the serial port will be opened for communication and GSM hardware will allow transmission of SMS

The system will then connect and after connection establishment the system will be able to detect intrusion and will alert user about the breach and similarly the system will update status of appliances by receiving SMS from the pre-defined cell number

SMS will be silently ignored if cell number is unauthorized

3.3 Circuit Design and Procedure

The block diagram of our project is shown below. It is an outline description of how we have implemented our project and the various steps involved in it. From the block diagram given below, the first mobile station is used as a transmitting section from which the user sends a code that contains commands and instructions to the second mobile station which is based on a specific area where our control system is located, through GSM network. The received code can be in either DTMF format which is send to the DTMF decoder connected via headset jack of the phone or through an SMS.

Figure 3.2: Block Diagram of project

The DTMF decoder converts it into digital signal and sends it to the microcontroller interfaced to it. Then the microcontroller processes the code and carries out the specific operations. The ULN2003 is used to drive the relay circuits which switches the different appliances connected to the interface.After connecting the circuit properly and assuming all the connections are right the following steps are to be followed:

The remote user send authenticated signal including commands to the receiver phone Through the GSM network the signal is received by the receiver phone on the device

12

Page 13: Design and implementation of home                         automation system using gsm to    control electrical appliances

Then that DTMF signal is passed to the DTMF decoder to convert it to the digital signal, and it sends them to microcontroller

Microcontroller issues commands to the appliances and the devices connected will switch ON/OFF

If we are using GSM module, that is SMS mode, the signal send in the form of SMS is send to the GSM module and then to microcontroller through serial communication and then microcontroller command the relays to switch the devices

3.4 Working Explanation

In this project, AT89c52 is used for controlling the whole process. Here we have used GSM technology for controlling home appliances. We send some commands like “*11 to one*”, *10 to off*” and so on for controlling AC home appliances. After receiving given commands by AT89c52 through GSM, AT89c52 send signal to relays, to switch ON or OFF the particular appliance using a relay driver.When we send SMS to GSM module by Mobile, then GSM receives that SMS and sends it to AT89c52. Now AT89c52 reads this SMS and extract main command from the received string and stores in a variable. After this, AT89c52 compare this string with predefined string. If match occurred then AT89c52 sends signal to relay. Relaydriver for turning ON and OFF the home appliances. Relative result also prints on 16x2 LCD by using appropriate commands..

Figure 3.2: Block Diagram of project

Table 2: AT Commands instruction for userS.NO Message Operation

1 *11 Light 1 ON

2 *10 Light 1 OF

3 *21 Light 2 ON

13

AT89c52

Page 14: Design and implementation of home                         automation system using gsm to    control electrical appliances

4 *20 Light 2 OF

5 *31 Light 3 ON

6 *30 Light 3 OF

7 *41 Light 4 ON

8 *40 Light 4 of

3.5 GSM ModuleGSM module is used in many communication devices which are based on GSM (Global System for Mobile Communications) technology. It is used to interact with GSM network using a computer. GSM module only understands AT commands, and can respond accordingly. The most basic command is “AT”, if GSM respond OK then it is working good otherwise it respond with “ERROR”. There are various AT commands like ATA for answering a call, ATD to dial a call, AT+CMGR to read the message, AT+CMGS to send SMS etc. AT commands should be followed by Carriage return i.e. \r (0D in hex), like “AT+CMGS\r”. We can use GSM module using these commands:

ATE0 - For echo offAT+CNMI=2,2,0,0,0<ENTER>-Auto opened message ReceivingATD<Mobile Number>;<ENTER>- making a call (ATD+91961012659;\r\n)AT+CMGF=1 <ENTER>- Selecting Text modeAT+CMGS=”Mobile Number” <ENTER>-Assigning recipient’s mobile number>>Now we can write our message>>After writing messageCtrl+Z send message command (26 in decimal).ENTER=0x0d in HEX

CHAPTER 4HARDWARE COMPONENTS

4.1Equipment Required

14

Page 15: Design and implementation of home                         automation system using gsm to    control electrical appliances

AT89c52 GSM Module ULN2003 (Optional) Relay 5 volt Electric appliance Connecting wires LCD Power supply Cell phone

LCDLiquid crystal display (LCD) screen is display electronic device. A 20x4 LCD screen is widely used in electronic and electrical equipment’s. This module is used instead of using 7 segment display and LEDs for displaying purposes. The reason behind is that it’s widely used device:

Economical to use in any device Easily programmable and interfaces It can display special character unlike 7- segments display Animations can be display on it

A 20x4 LCD mean that it can display 20 characters per line and there are 4 lines in it. The LCD consists of 2 registers, one is data register and other is command registerRegister refers to a memory storing cells in the form of binary data. Combination of flip flops are used to store bits of information in a device known as registerThe command register store the set of instruction given to LCD, such as controlling display, clear the screen, set the position etc. while data register store the data which can be displaying on LCD.

Figure 3.3: Pin Description of LCD

15

Page 16: Design and implementation of home                         automation system using gsm to    control electrical appliances

Table 3: LCD Pin Configuration

4.2Electrical Power supply

It is an electronic circuit or device which delivers electrical energy to a load. The purpose and advantage of Electrical Power Supply is to change one variety of Electric Energy into desire electrical form. It is sometime called electrical power convertors. Electrical power supply take energy from source for two purposes, one purpose is to convert it to desire form for load operation and other purpose is their own consumption during operation. Basically any electronic circuit runs with a power supply. Here we are giving a 5v supply to the various IC’s used in the design presented here. We get a 240V supply in our house at any instant. So in order to provide our circuit appropriate supply voltage a different power circuit is to be made based on our requirement. The various steps included in the circuit are explained below stepwise. And also various precautions are to be taken for the safety of the electronic circuit designed. The different stages of the design of the circuit are given below.

4.3Transformer

We need a step down transformer of 220/12v output to supply all the electronics involved. Here in this device all the equipment require a DC input of 5v and since the regular input to the houses is 220v we need a transformer to step down voltages.A transformer is a static device which converts one form of Electrical parameter to another form. Electrical parameter may be voltage, frequency, current. Normally transformer is used to step-up or step-down the voltage level. The transfer of electrical energy in a transformer takes place through electromagnetic induction (Faraday’s law of Electromagnetic induction).

16

Page 17: Design and implementation of home                         automation system using gsm to    control electrical appliances

Figure 4.6: transformer

A step down transformer is used in our project. Secondary of step down transformer is connected to backup storage circuit to power up AT89c52. AT89c52 (+5V DC on board and GND) supply is further used to power up LCD, GSM and RTC

4.4Bridge RectifierThe equipment needs a DC supply, so the output from the transformer is connected to a bridge rectifier to make it DC. A bridge rectifier basically has four diodes connected as shown below to provide rectification. This configuration is a widely used, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.

Figure 4.7: Bridge Rectifier

4.5Filter CircuitThe filter circuit is simply a capacitor of 1000μF associated in parallel to the power circuit. It goes about as a filter that seems to be, it filters outs the ripples present in the circuit brought on throughout the rectification from the diodes in the bridge circuit. Regardless of the amount consideration is taken there are still ripples in the output voltage of the circuit, which is destructive for the IC's utilized. So filter capacitor evokes them, along these lines helping keeping up security in the outlined circuit.

4.6Voltage RegulatorThen at last voltage controllers are associated over the circuit to secure the supplies from any kind of voltage variances. All the gadgets we utilize are delicate and sensitive, so protection

17

Page 18: Design and implementation of home                         automation system using gsm to    control electrical appliances

from any kind of variances is very important. A voltage controller is intended to naturally keep up a consistent voltage level.

Figure 4.8: Power supply

4.7 Power supply components

Step down transformer (220/12,14)V Bridge rectifier Capacitor (220u,0.1u,100u)f Resistor (4.7k) LM7805 LED Switch

4.8Diode (1N400x series)It is an electronic component use for rectification. Rectification is conversion of AC voltage or signal to DC voltage. Diode is PN junction type semiconductor, which consists of anode and cathode. The current is flowing from anode to cathode in a diode. In reverse direction it acts as open circuit. 1N4007 diodes can withstand a reverse voltage of higher than 1000V.

Figure 4.9: Diode symbol

4.9Optocoupler (4N25)Optocoupler is an IC (integrated circuit) that consists of Phototransistor and LED. It is used to inter-connect two electrical circuits by light interface. It is also used to convert sinusoidal AC voltage to square signal (pulsating signals).

18

Page 19: Design and implementation of home                         automation system using gsm to    control electrical appliances

Figure 4.10: Opto-couple

4.10 GSM Module (SIM 900A)SIM900 GSM Module supports communication in 900MHz band. GSM is quad cell phone, which can be used to send messages, call, or access to internet. AMR926EJ-S is the processor inside GSM module.

Figure 4.11: GSM module

GSM module SIM900A is being used in the project here. It is just like a cell phone with all the facilities of sending and receiving a message, sending and receiving calls. It has a communication that can be programmed using AT commands. The signal names for the GSM modem communication port include the following; audio input and output pins (for connecting external hands free audio devices), mute control pin, flash programming signal pins, external power pins, and receiver and transmitter pins.

Here the RX and TX pins are used for the serial communication with the microcontroller. There are various AT commands to check the signal strength and connection and SIM status etc. Here the Hyper Terminal is used to initially interface with the computer to check the module. It also has an antenna to receive the GSM signal from the user’s phone. The basic AT commands are loaded into the program of microcontroller for it to interface with the GSM module. The figure given below shows a GSM module.

SIM-Com presents an ultra-compact and reliable wireless module. The SIM900A is a complete Dual-band GSM/GPRS module in a SMT type which is designed especially for Chinese market, allowing you to benefit from small dimensions and cost-effective solutions.

19

4N25

Page 20: Design and implementation of home                         automation system using gsm to    control electrical appliances

Featuring an industry-standard interface, the SIM900A delivers GSM/GPRS 900/1800MHz performance for voice, SMS, Data, and Fax in a small form factor and with low power consumption. With a tiny configuration of 24mm x 24mm x 3 mm, SIM900A can fit almost all the space requirements in your applications, especially for slim and compact demand of design.

4.10.1General Features Dual-Band 900/ 1800 MHz Control via AT commands (GSM 07.07 ,07.05 and SIMCOM enhanced AT Commands) SIM application toolkit Supply voltage range : 3.1 ... 4.8V Low power consumption: 1.5mA(sleep mode)

4.10.2Interfaces Interface to external SIM 3V/ 1.8V analog audio interface RTC backup SPI interface Two Serial interfaces Antenna pad I2C GPIO PWM ADC

20

Page 21: Design and implementation of home                         automation system using gsm to    control electrical appliances

Figure 4.13: GSM module with Labels

4.11 AT89C5The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8Kbytes of Flash programmable and erasable read only memory (PEROM). The devices manufactured using Atmel’s high-density nonvolatile memory technology and iscompatible with the industry-standard 80C51 and 80C52 instruction set and pinout.The on-chip Flash allows the program memory to be reprogrammed in-system or by aconventional nonvolatile memory programmer. By combining a versatile 8-bit CPUwith Flash on a monolithic chip, the AtmelAT89C52 is a powerful microcomputerwhich provides a highly-flexible and cost-effective solution to many embedded controlapplications.

Figure 4.14: AT89c52

The AT89c52 can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm

21

Page 22: Design and implementation of home                         automation system using gsm to    control electrical appliances

center-positive plug into the board's power jack. Leads from a battery can be inserted in the GND and VIN pin headers of the POWER connector.

• Compatible with MCS-51™ Products• 8K Bytes of In-System Reprogrammable Flash Memory• Endurance: 1,000 Write/Erase Cycles• Fully Static Operation: 0 Hz to 24 MHz• Three-level Program Memory Lock• 256 x 8-bit Internal RAM• 32 Programmable I/O Lines• Three 16-bit Timer/Counters• Eight Interrupt Sources• Programmable Serial Channel• Low-power Idle and Power-down Modes

The controller differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-to-serial converter.

The power pins are as follows: VIN: The input voltage to the AT89c52 board when it's using an external power

source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

4.11.1Programming The AT89c52 come preburned with a bootloader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol (reference, C header files).

You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header.

4.11.2Technical SpecificationPort Pin Alternate FunctionsP3.0 RXD (serial input port)P3.1 TXD (serial output port)P3.2 INT0 (external interrupt 0)P3.3 INT1 (external interrupt 1)P3.4 T0 (timer 0 external input)P3.5 T1 (timer 1 external input)P3.6 WR (external data memory write strobe)P3.7 RD (external data memory read strobe)

Port 1 is an 8-bit bi-directional 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, they are pulled high bythe 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 thetimer/counter 2 external count input (P1.0/T2) and thetimer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table.

22

Page 23: Design and implementation of home                         automation system using gsm to    control electrical appliances

Port 1 also receives the low-order address bytes duringFlash programming and verification.PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analogWrite() function.

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the AT89c52 /Genuine Uno and the old Duemilanove and DiecimilaAT89c52 boards.

LED: 13: There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

TWI: 20 (SDA) and 21 (SCL). Support TWI communication using the Wire library. Note that these pins are not in the same location as the TWI pins on the old Duemilanove or DecimalAT89c52 boards.

The Mega 2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analog Reference() function.

ARE: Reference voltage for the analog inputs. Used with analogReference ().

Reset: Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

4.11.3CommunicationThe board has a number of facilities for communicating with a computer, another board, or other microcontrollers. The controller provides four hardware UARTs for TTL (5V) serial communication. An ATmega16U2 (AT 8U2 on the revision 1 and revision 2 boards) on the board channels one of these over USB and provides a virtual com port to software on the computer (Windows machines will need a .in file, but OSX and Linux machines will recognize the board as a COM port automatically. The AT89c52 Software (IDE) includes a serial monitor which allows simple textual data to be sent to and from the board. The RX and TX LEDs on the board will flash when data is being transmitted via the ATmega8U2/ATmega16U2 chip and USB connection to the computer (but not for serial communication on pins 0 and 1.

Figure 4.15: AT89c52 picture

23

Page 24: Design and implementation of home                         automation system using gsm to    control electrical appliances

4.12 DTMF Decoder

Today, most telephone equipment use a DTMF receiver IC. One commonDTMF receiver IC is the MT8870 that is widely used in electronic communications circuits. The MT8870 is an 18-pin IC. The pins are all connected as per the diagram shown below. The input is given at the pin in+/- and the digital output is taken from the pins Q1, Q2, Q3, and Q4.

Figure 4.16: DTMF (Dual tone multi frequency)decoder4.13 ULN2003

ULN2003 is a high voltage and high current Darlington array IC. It contains seven open collector Darlington pairs with common emitters. It is an arrangement of a pair of bipolar transistors. Each channel or pair in ULN2003 is rated at 500mA and can withstand a peak current of 600mA. The inputs and outputs are provided opposite to each other in pin layout. Each driver additionally holds a suppression diode to dissipate voltage spikes while driving inductive loads. The logical output for it is a negation, i.e. it gives a low o/p for a high I/p and a high o/p for a low I/p. The logical diagram for the IC is shown below.

Figure 4.17: Relay driver

4.14 RelaysThe relays are the final stage of this device which plays a very prominent role to control the final appliances. The principle on that the relays work is electromagnetic force. When electricity starts flowing through a coil, it becomes an electromagnet. Steel plates are attracted by this electromagnetic coils get attracted, which is attached to a switch. So the switch’s motion (ON or OFF) is controlled by current flowing through the coil, or not respectively.A relay’s very useful feature is that it can be used to isolate different parts of a circuit electrically. It allows a low voltage circuit (e.g. 5v DC) to switch the power in a high voltage circuit (e.g. 100v AC or more).

24

Page 25: Design and implementation of home                         automation system using gsm to    control electrical appliances

CHAPTER 5INTERFACING

5.1Circuit Diagram

5.1Interfacing of LCD with AT89c52

The LCD (Liquid Crystal Display) used in this project is 16x2, Hitchi Company. 16x2 LCD consists of 16 column and 2 rows. 16 characters can be display in each row, total 32 characters at the same time on the screen.

VSS, VEE/V0, RW, D0, D1, D2, D3 and back-/K of LCD is connected to ground. VDD and back+/A of LCD are connected to 5V DC. Ground and +5V DC can be provided to LCD from external battery or from AT89c52 pins of 5V and GND.

Pin RS is attached to pin 33 of AT89c52. Pin E is attached to pin 34 of AT89c52. Pin D4 is joined to pin 35 of AT89c52. Pin D5 is attached to pin 36 of AT89c52. Pin D6 is attached to pin 37 of AT89c52. Pin D7 is attached to pin 39 of AT89c52. A variable resistor (No. = 102) is connected to VDD, VSS and V0/VEE pins of LCD

to adjust contrast. A resistor of 150 Ω is used to limit the current. This resistor is connected between

VDD and back+/A pins of LCD.

5.1Power supply components Step down transformer (220/12,14)V Bridge rectifier Capacitor (220u,0.1u,100u)f Resistor (4.7k) LM7805 LED Switch

5.1Components of relay circuit

25

Page 26: Design and implementation of home                         automation system using gsm to    control electrical appliances

Step down transformer (220V/12V) Bridge rectifier Capacitors (220uF, 0.1uF, 100uF) Resistors (4.7 kΩ, 1 kΩ) LM7805 Voltage Regulator Relay (RWH-SH-105D) Transistor (2N3904) Freewheeling diode (1N4148) Battery source 9V DC 2 pins PCB connector

5.1Operation of relay circuitRelay coil is an electromagnet as well as it is an inductor. So it store current flowing through it. A diode called “freewheeling diode” is used in parallel with relay coil in order to avoid reverse current flow and protect switching transistor from being damage. When biased voltage is apply to the base of NPN transistor. Then transistor start conducting or we can say transistor is ON. 5V is appearing across the coil of relay which attracts the movable contact towards itself. Thus relay becomes closed from open position.5.1Interfacing of GSM SIM900A with AT89c52

S_Rx of GSM is connected to RX1 (19) pin of AT89c52. S_Tx of GSM is connected to TX1 (18) pin of AT89c52. VBAT pin of GSM is attached to 5V DC. Ground of GSM is attached to GND pin of controller. 16V-1000uF capacitor is connected in parallel with VBAT and GND, to enhance

voltage and filter out ripples (If any). Diode is connected in series with VBAT pin, to avoid reverse power flo

CHAPTER 7

26

Page 27: Design and implementation of home                         automation system using gsm to    control electrical appliances

CONCLUSIONANDFUTURE RECOMMENDATIONCONCLUSION

The project is aimed to design and implement a GSM based wireless control of house hold electrical appliances. After doing different tests and programming different codes, eventually the obliged outcome is put forward. It is a fast and efficient approach to control the devices. This equipment works anywhere with a

great gathering of sign. At last the obliged result is attained with GSM module Sim900A based outline for effective and compelling result.

The project “GSM BASED HOME AUTOMATION” has been successfully designed and tested. Integrating features of all the hardware components used have developed it.

Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced IC’s and with the help of growing technology the project has been successfully implemented.

Embedded systems are emerging as a technology with high potential. In the past decades microprocessor based embedded system ruled the market.

The last decade witnessed the revolution of Microcontroller based embedded systems. With regards to the requirements gathered the manual work and the complexity in counting can be achieved with the help of electronic devices.

FUTURE RECOMMENDATIONFollowing are the recommendation for future in this project;

One of the places that automation can have a big impact is in our home. Now there is more to it than speakers in every room and movie distribution. Let’s look at a few ideas that could be turned into projects.

Future will be of Automation of all products. Each and every product will be smart devices that we use daily and that will be controlled through a smart chip called microcontrollers. Each and Every home appliances will be controlled either by PC or hand held devices like PDA or mobile handsets. Some examples of it are when you want you can switch on/off Fan of your home by mobile handset or PC.

Smart Grid: Home automation technologies are viewed as integral additions to the Smart grid. The ability to control lighting, appliances, HVAC as well as Smart applications (load shedding, demand response, real-time power usage and price reporting) will become vital as Smart Grid initiatives are rolled.

Garage Door; with help of automation you can open the garage door when you left home.

CHAPTER 8CODE DESCRIPTION

27

Page 28: Design and implementation of home                         automation system using gsm to    control electrical appliances

In programming part of this project, first of all in programming we includes library for liquid crystal display and then we defines data and control pins for LCD and home appliances.#include<LiquidCrystal.h>LiquidCrystallcd(6,7,8,9,10,11);#define Fan 3#define Light 4#define TV 5int temp=0,i=0;int led=13After this serial communication is initialized at 9600 bps and gives direction to used pin.void setup()lcd.begin(16,2);Serial.begin(9600);pinMode(led, OUTPUT);pinMode(Fan, OUTPUT);pinMode(Light, OUTPUT);pinMode(TV, OUTPUT);For receiving data serially we have used two functions one is Serial. Availablethis checks whether any serial data is coming and other one is Serial.read which reads the data that comes serially.While (Serial.available()) charinChar=Serial.read();After receiving data serially we have stored it in a string and then waiting for Enter.voidserialEvent() while(Serial.available()) if(Serial.find("#A."))digitalWrite(led, HIGH);delay(1000);digitalWrite(led, LOW);while (Serial.available()) charinChar=Serial.read();str[i++]=inChar;if(inChar=='*')temp=1;return; When Enter comes program start to compare received string with already defined string and if string matched then a relative operation is performed by using appropriate command that are given in code.void check()if(!(strncmp(str,"tv on",5)))

28

Page 29: Design and implementation of home                         automation system using gsm to    control electrical appliances

digitalWrite(TV, HIGH);lcd.setCursor(13,1); lcd.print("ON ");delay(200); else if(!(strncmp(str,"tv off",6)))digitalWrite(TV, LOW);lcd.setCursor(13,1); lcd.print("OFF ");delay(200);

CODE#include<LiquidCrystal.h>LiquidCrystallcd(6,7,8,9,10,11);----------------------------------------------------------------------------------------------------------------#define Fan 3#define Light 4 #define TV 5----------------------------------------------------------------------------------------------------------------

int temp=0,i=0;int led=13;charstr[15];----------------------------------------------------------------------------------------------------------------

void setup()lcd.begin(16,2);Serial.begin(9600);pinMode(led, OUTPUT);pinMode(Fan, OUTPUT);pinMode(Light, OUTPUT);pinMode(TV, OUTPUT);----------------------------------------------------------------------------------------------------------------lcd.setCursor(0,0);lcd.print("GSM Control Home");lcd.setCursor(0,1);lcd.print(" Automaton ");delay(2000);delay(1000);lcd.setCursor(0,1);lcd.print("System Ready");Serial.println("AT+CNMI=2,2,0,0,0");delay(500);Serial.println("AT+CMGF=1");delay(1000);lcd.clear();lcd.setCursor(0,0);lcd.print("Fan Light TV ");

29

Page 30: Design and implementation of home                         automation system using gsm to    control electrical appliances

lcd.setCursor(0,1);lcd.print("OFF OFF OFF "); -------------------------------------------------------------------------------------------------------------void loop()lcd.setCursor(0,0);lcd.print("Fan Light TV");if(temp==1)check();temp=0;i=0;delay(1000);----------------------------------------------------------------------------------------------------------------voidserialEvent() while(Serial.available()) if(Serial.find("#A."))digitalWrite(led, HIGH);delay(1000);digitalWrite(led, LOW);while (Serial.available()) charinChar=Serial.read();str[i++]=inChar;if(inChar=='*') temp=1;return; ----------------------------------------------------------------------------------------------------------------void check()if(!(strncmp(str,"tv on",5)))

digitalWrite(TV, HIGH);lcd.setCursor(13,1); lcd.print("ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"tv off",6)))

30

Page 31: Design and implementation of home                         automation system using gsm to    control electrical appliances

digitalWrite(TV, LOW);lcd.setCursor(13,1); lcd.print("OFF ");delay(200); -------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"fan on",5)))digitalWrite(Fan, HIGH);lcd.setCursor(0,1); lcd.print("ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"fan off",7)))digitalWrite(Fan, LOW);lcd.setCursor(0,1); lcd.print("OFF ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"light on",8)))digitalWrite(Light, HIGH);lcd.setCursor(7,1); lcd.print("ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"light off",9)))digitalWrite(Light, LOW);lcd.setCursor(7,1); lcd.print("OFF ");delay(200); ------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"all on",6)))digitalWrite(Light, HIGH);digitalWrite(Fan, HIGH);digitalWrite(TV, HIGH);lcd.setCursor(0,1); lcd.print("ON ON ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"all off",7)))

31

Page 32: Design and implementation of home                         automation system using gsm to    control electrical appliances

digitalWrite(Light, LOW);digitalWrite(Fan, LOW);digitalWrite(TV, LOW);lcd.setCursor(0,1); lcd.print("OFF OFF OFF ");delay(200);

REFERENCES

32

Page 33: Design and implementation of home                         automation system using gsm to    control electrical appliances

[1] Ahmed M, Farooqui H, J K Pathan,“3G based automation using GSM communication”, International Journal of Research in Environment Science and Technology.

[2] AdamuMurtalaZungeru, Ufarna Victoria Edu,“Design and implementation of a short message service based remote Controller”,Computer Engineering and Intelligent systems, published in 2012

[3] Rayat and Bahra Institute of Engineering and Bio-technology, Mohali, India Email: [email protected]

[4] Mazidi, Muhammad ali, “The 8051 Microcontroller And Embedded Systems Using Assembly And C”, Pearson Education, September 2007, Second edition.

[5] Sheikh IzzalAzid, SushilKumar,“Analysis and Performance of a low cost SMS Based Home Security System “International Journal of Smart Home. Published on July 2011.

33

Page 34: Design and implementation of home                         automation system using gsm to    control electrical appliances

[1] Mazidi, Muhammad ali, “The 8051 Microcontroller And Embedded Systems Using Assembly And C”, Pearson Education, September 2007, Second edition.

[2] C. K. Das, M. Sanaullah, H. M. G. Sarower and M. M. Hassan, “Development of a Cell Phone based Remote Control System: an Effective Switching System for Controlling Home and Office Appliances”, International Journal of Electrical & Computer Sciences IJECS-IJENS Vol.: 09 No: 10.

[3] Rayat and Bahra Institute of Engineering and Bio-technology, Mohali, India Email: [email protected]

[4] Sheikh IzzalAzid, SushilKumar,“Analysis and Performance of a low cost SMS Based Home Security System “International Journal of Smart Home. Published on July 2011.

[5] AdamuMurtalaZungeru, Ufarna Victoria Edu,“Design and implementation of a short message service based remote Controller”,Computer Engineering and Intelligent systems, published in 2012

34