+ All Categories
Home > Engineering > Design & implemetation using gsm modulator

Design & implemetation using gsm modulator

Date post: 13-Apr-2017
Category:
Upload: khurshid-ahmad
View: 57 times
Download: 5 times
Share this document with a friend
41
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.1 Home automation Home automation is the control of any or all electrical system in our home or office, whether we are there or away. Home 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 [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 main stream 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 1
Transcript
Page 1: Design & implemetation using gsm modulator

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.1 Home automationHome automation is the control of any or all electrical system in our home or office, whether we are there or away. Home 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 [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 main stream 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. Although automated homes future has been staple exhibits for World's Fairs and popular backgrounds in science fiction, complexity, competition between vendors, multiple incompatible standards and the resulting expense have limited the penetration of home automation to homes of the wealthy or ambitious hobbyists [3].

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. 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. 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 [4].

1

Page 2: Design & implemetation using gsm modulator

Figure 1.1: Home Automation SystemHowever 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.

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 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

2

Page 3: Design & implemetation using gsm modulator

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

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.2 Aims 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.

1.3 General Objectives of the Project

3

Page 4: Design & implemetation using gsm modulator

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

1.4 Motivation 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. 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.5 Aim of the projectThe aim of the project is to develop a system, which uses Mobile technology that keeps control of the various units of the automobiles and computer system, which executes with respect to the signal sent by the mobile.

1.6 Significance and applicationsGSM 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.

1.7 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.

1.8 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.

CHAPTER 2

4

Page 5: Design & implemetation using gsm modulator

LITERATURE REVIEW2.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. 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 ABI in 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 TechnologyGSM 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 administration’s 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.3 DTMF (Dual Tone Multi Frequency)

5

Page 6: Design & implemetation using gsm modulator

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 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 697 Hz

4 5 6 B 770 Hz

7 8 9 C 852 Hz

* 0 # D 941 Hz

1206 1336 1477 1633

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 intermediation 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 3

6

Page 7: Design & implemetation using gsm modulator

METHODOLOGY3.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 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 ProcedureThe 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

7

Page 8: Design & implemetation using gsm modulator

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 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 ExplanationIn 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. Relay driver 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

3.5GSM 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

8

AT89c52

Page 9: Design & implemetation using gsm modulator

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

1 *11 Light 1 ON2 *10 Light 1 OF3 *21 Light 2 ON4 *20 Light 2 OF5 *31 Light 3 ON6 *30 Light 3 OF7 *41 Light 4 ON8 *40 Light 4 of

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

9

Page 10: Design & implemetation using gsm modulator

CHAPTER 4

HARDWARE COMPONENTS

4.1 Equipment Required 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 register. Register 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 register. The 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

10

Page 11: Design & implemetation using gsm modulator

Table 3: LCD Pin Configuration

4.2 Electrical Power supplyIt 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.3 TransformerWe 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).

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.

11

Page 12: Design & implemetation using gsm modulator

4.4 Bridge 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.5 Filter 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.6 Voltage 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 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 Diode (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.

12

Page 13: Design & implemetation using gsm modulator

Figure 4.9: Diode symbol

4.8 Optocoupler (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).

Figure 4.10: Opto-couple

4.9 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. 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.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.

4.10 General 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)

13

4N25

Page 14: Design & implemetation using gsm modulator

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

Figure 4.11: GSM module with Labels

4.12 AT89C5

14

Page 15: Design & implemetation using gsm modulator

The 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 is compatible 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 a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the AtmelAT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.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 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.13 Programming The AT89c52 come pre burned with a boot loader 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 boot loader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header.

4.14 Technical 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 by the

15

Page 16: Design & implemetation using gsm modulator

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.PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analog Write () 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 Diecimila AT89c52 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 Decimal AT89c52 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 analog Reference ().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.15 CommunicationThe 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.

4.16 DTMF DecoderToday, most telephone equipment use a DTMF receiver IC. One common DTMF 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.12: DTMF (Dual tone multi frequency) decode4.17 ULN2003

16

Page 17: Design & implemetation using gsm modulator

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.13: Relay driver

4.18 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).

CHAPTER 5

17

Page 18: Design & implemetation using gsm modulator

INTERFACING AND SIMULATION5.1 Circuit Diagram

5.2 CIRCUIT DISCRIPATION The simulation circuit is build such that, the AT89c52 microcontroller receives the signal from the GSM through port P1 and it decodes the signal and then as per the authenticated code, it sends the signal to the relay connected to the pins P3.4, P3.5, .The authenticated code given in this project is 78 and after that to select which device to be turned on, user select 0, 1 are pressed for on and off of the devices individually. The simulated output is and the program code for the microcontroller is given below.

5.3 Interfacing of LCD with AT89c52Display units are the most important output devices in embedded projects and electronics products. 16x2 LCD is one of the most used display unit. 16x2 LCD means that there are two rows in which 16 characters can be displayed per line, and each character takes 5X7 matrix space on LCD. In this tutorial we are going to connect 16X2 LCD modules to the 8051 microcontroller (AT89S52). Interfacing LCD with 8051 microcontroller might look quite complex to newbie’s, but after understanding the concept it would look very simple and easy. Although it may be time taking because you need to understand and connect 16 pins of LCD to the microcontroller. So first let's understand the 16 pins of LCD module.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 contrastA resistor of 150 Ω is used to limit the current. This resistor is connected between VDD and back+/A pins of LCD.

18

Page 19: Design & implemetation using gsm modulator

All the pins are clearly understandable by their name and functions, except the control pins, so they are explained below: RS: RS is the register select pin. We need to set it to 1, if we are sending some data to be displayed on LCD. And we will set it to 0 if we are sending some command instruction like clear the screen (hex code 01).RW: This is Read/write pin, we will set it to 0, if we are going to write some data on LCD. And set it to 1, if we are reading from LCD module. Generally this is set to 0, because we do not have need to read data from LCD. Only one instruction “Get LCD status”, need to be read some times.

EA: This pin is used to enable the module when a high to low pulse is given to it. A pulse of 450 ns should be given. That transition from HIGH to LOW makes the module ENABLE.

There are some preset command instructions in LCD, we have used them in our program below to prepare the LCD (in lcd_init() function). Some important command instructions are given below:

5.4 Power supply componentsA DC power supply is a device that supplies electric energy of fixed polarity, either positive or negative. "DC" in this context means "direct current." Direct current is an alternative to alternating current, frequently shortened to "AC." Step down transformer (220/12,14)V Bridge rectifier Capacitor (220µF,0.1µF,100µF) Resistor (4.7KΩ) LM7805 LED switch

5.5 Relay and Components of relay circuitA relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, such as solid-state relays. Relays are used where it is necessary to control a circuit by a separate low-power signal, or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits as amplifiers: they repeated the signal coming in from one circuit and re-transmitted it on another circuit. Relays were used extensively in telephone exchanges and early computers to perform logical operations.A type of relay that can handle the high power required to directly control an electric motor or other loads is called a contractor. Solid-state relays control power circuits with no moving parts, instead using a semiconductor device to perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils are used to protect electrical circuits from overload or faults; in modern electric power systems these functions are performed by digital instruments still called "protective relays".Relays are switches that open and close circuits electromechanically or electronically. Relays control one electrical circuit by opening and closing contacts in another circuit. As relay diagrams show, when a relay contact is normally open (NO), there is an open contact when the relay is not energized. When a relay contact is Normally Closed (NC), there is a closed contact when the relay is not energized. In either case, applying electrical current to the contacts will change their state. Relays are generally used to switch smaller currents in a control circuit and do not usually control power consuming devices except for small motors and Solenoids that draw low amps. Nonetheless, relays can "control" larger voltages and amperes by having an

19

Page 20: Design & implemetation using gsm modulator

amplifying effect because a small voltage applied to a relays coil can result in a large voltage being switched by the contacts. Protective relays can prevent equipment damage by detecting electrical abnormalities, including over-current, undercurrent, overloads and reverse currents. In addition, relays are also widely used to switch starting coils, heating elements, pilot lights and audible alarms.

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

Electromechanical Relays Basic parts and functions of electromechanical relays include: Frame: Heavy-duty frame that contains and supports the parts of the relay.Coil: Wire is wound around a metal core. The coil of wire causes an electromagnetic field.Armature: A relays moving part. The armature opens and closes the contacts. An attached spring returns the armature to its original position.Contacts: The conducting part of the switch that makes (closes) or breaks (opens) a circuit.

5.6 Operation of relay circuitRelays are electromechanical devices that use an electromagnet to operate a pair of movable contacts from an open position to a closed position. The advantage of relays is that it takes a relatively small amount of power to operate the relay coil, but the relay itself can be used to control motors, heaters, lamps or AC circuits which themselves can draw a lot more electrical power. Relay 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. A typical relay switch circuit has the coil driven by a NPN transistor switch, TR1 as shown depending on the input voltage level. When the Base voltage of the transistor is zero (or negative), the transistor is cut-off and acts as an open switch. In this condition no Collector current flows and the relay coil is de-energised because being current devices, if no current flows into the Base, then no current will flow through the relay coil.If a large enough positive current is now driven into the Base to saturate the NPN transistor, the current flowing from Base to Emitter (B to E) controls the larger relay coil current flowing through the transistor from the Collector to Emitter.

For most bipolar switching transistors, the amount of relay coil current flowing into the Collector would be somewhere between 50 to 800 times that of the required Base current to drive the transistor into saturation. The current gain or beta value (β) of the general purpose BC109 shown is typically about 290 at 2mA.

5.7 Interfacing of GSM SIM900A with AT89c52

20

Page 21: Design & implemetation using gsm modulator

The circuit of interfacing GSM to AT89C51 microcontroller mainly consists of GSM modem and 8051 family microcontroller. GSM has RS232 interface for serial communication. In between the GSM module and the microcontroller MAX232 IC is connected. (MAX232 IC is optional; it is used for converting the logic levels and voltage regulation. No need to use in our project).MAX232 IC is used for converting the logic levels.RS232 logic levels of GSM are converted to the TTL logic levels of the microcontroller using this MAX232 IC. MAX232 IC has 16 pins. This is a dual driver IC as it has two transmitters and receivers. Interfacing of GSM to AT89C51 microcontroller uses only one transmitter and receiver.The transmitter pin T1IN of max232 is connected to the transmitter pin of the microcontroller. The receiver pin R1out of the max232 is connected to the receiver pin of the microcontroller. The T1out pin of the IC is connected to the transmitter pin of the GSM modem. The R1IN pin of the IC is connected to the receiver pin of the GSM modem. Two 0.1 micro farad capacitors are connected to the pins of 1, 2 and 4 , 5. Another 1µF capacitor is grounded from pin6 and another capacitor is connected to the supply of 5V from the through the 2nd pin of the IC.

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 flow

CHAPTER 6

21

Page 22: Design & implemetation using gsm modulator

CONCLUSION AND FUTURE 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 appliances. 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 RECOMMENDATION.

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.

APPENDIX

22

Page 23: Design & implemetation using gsm modulator

CODE DESCRIPTION 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> // Header file of LCDLiquidCrystal lcd(6,7,8,9,10,11); //define pins of controller#define Fan 3 //define load#define Light 4 //define load#define TV 5 //define loadint temp=0,i=0; // initialize variables int led=13; //define pin for testing LEDAfter this serial communication is initialized at 9600 bps and gives direction to used pin.void setup() //startup looplcd.begin(x,y); //begin LCD, it is according to lcd used in project e.g 16x2, 20x4Serial.begin(9600); //begin serial communication between controller and IDEpinMode(led, OUTPUT); //select load pin as outputpinMode(Fan, OUTPUT); //select load pin as outputpinMode(Light, OUTPUT); //select load pin as outputpinMode(TV, OUTPUT); //select load pin as outputFor receiving data serially we have used two functions one is Serial.available which checks whether any serial data is coming and other one is Serial.read which reads the data that comes serially. while (Serial.available()) char inChar=Serial.read();After receiving data serially we have stored it in a string and then waiting for Enter.void serialEvent() while(Serial.available()) if(Serial.find("#A.")) //serial read command for GSMdigitalWrite(led, HIGH); // if it read #A, than first it is digitally high delay(1000); //delay of 1SecdigitalWrite(led, LOW); //to lowwhile (Serial.available()) char inChar=Serial.read(); str[i++]=inChar; //increment in serial read loopif(inChar=='*') //end point of serial read command temp=1; //temp variable is 1 from 0. return; //return to original place. 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)))digitalWrite(TV, HIGH);

23

Page 24: Design & implemetation using gsm modulator

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> // Header file of LCD LiquidCrystal lcd(6,7,8,9,10,11); //define pins of controller for interfacing of lcd, Can be changed according to choice. ----------------------------------------------------------------------------------------------------------------#define Fan 3 //define load#define Light 4 //define load#define TV 5 //define load----------------------------------------------------------------------------------------------------------------int temp=0,i=0; // initialize variables int led=13; //define pin for testing LEDchar str[15]; //define strings----------------------------------------------------------------------------------------------------------------After this serial communication is initialized at 9600 bps and gives direction to used pin.void setup() //startup looplcd.begin(x,y); //begin LCD, it is according to lcd used in project e.g 16x2, 20x4Serial.begin(9600); //begin serial communication between controller and IDEpinMode(led, OUTPUT); //select load pin as outputpinMode(Fan, OUTPUT); //select load pin as outputpinMode(Light, OUTPUT); //select load pin as outputpinMode(TV, OUTPUT); //select load pin as output----------------------------------------------------------------------------------------------------------------lcd.setCursor(0,0); //set the Cursor/pointer of LCD to 1st row and 1st column lcd.print("GSM Control Home"); //display the string written inside the inverted comma’slcd.setCursor(0,1); //set the cursor to 1st column and 2nd rowlcd.print(" Automaton "); //display the string written inside the inverted comma’sdelay(2000); //delay of 2-Sec to maintain certain gap between display elementsLcd.clear(); //clear the lcd lcd.setCursor(0,1); //set the Cursor/pointer of LCD to 2nd row and 1st column lcd.print("System Ready"); //display string as it is…Serial.println("AT+CNMI=2,2,0,0,0"); //Set the new message remind, for example AT+CNMI=2,1delay(500);

24

Page 25: Design & implemetation using gsm modulator

Serial.println("AT+CMGF=1"); //Set the module message mode, set either at PDU(0) or text mode(1)delay(1000);lcd.clear();lcd.setCursor(0,0);lcd.print("Fan Light TV ");lcd.setCursor(0,1);lcd.print("OFF OFF OFF "); void loop() //start of void looplcd.setCursor(0,0);lcd.print("Fan Light TV");if(temp==1)check(); //command for check the status of controllertemp=0;i=0;delay(1000);void serialEvent() //relay operation loopwhile(Serial.available()) //if serial comm is available if(Serial.find("#A.")) //find #A in Message receivedigitalWrite(led, HIGH); //1st digital high then low to maintain operationdelay(1000);digitalWrite(led, LOW);while (Serial.available()) char inChar=Serial.read();str[i++]=inChar;if(inChar=='*') //* ending string of received commandtemp=1;return; ----------------------------------------------------------------------------------------------------------------void check()if(!(strncmp(str,"tv on",5))) //if the string is selected code then respective load is digital high digitalWrite(TV, HIGH); //load is digital high lcd.setCursor(13,1);

25

Page 26: Design & implemetation using gsm modulator

lcd.print("ON ");delay(200); ----------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"tv off",6))) //else load is digital low/offdigitalWrite(TV, LOW);lcd.setCursor(13,1); lcd.print("OFF ");delay(200); --------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"fan on",5))) //similar case for other loadsdigitalWrite(Fan, HIGH); lcd.setCursor(0,1); lcd.print("ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"fan off",7))) ////similar case for other loadsdigitalWrite(Fan, LOW); lcd.setCursor(0,1); lcd.print("OFF ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"light on",8))) ////similar case for other loadsdigitalWrite(Light, HIGH);lcd.setCursor(7,1); lcd.print("ON ");delay(200); ---------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"light off",9))) ////similar case for other loadsdigitalWrite(Light, LOW);lcd.setCursor(7,1); lcd.print("OFF ");delay(200); ------------------------------------------------------------------------------------------------------------else if(!(strncmp(str,"all on",6))) ////similar case for other loads, All on or off

26

Page 27: Design & implemetation using gsm modulator

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))) ////similar case for other loads, All on or offdigitalWrite(Light, LOW);digitalWrite(Fan, LOW);digitalWrite(TV, LOW); lcd.setCursor(0,1); lcd.print("OFF OFF OFF "); delay(200); ----------------------------------------------------------------------------------------------------------------

27

Page 28: Design & implemetation using gsm modulator

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

[2] Adamu MurtalaZungeru, 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 Izzal Azid, Sushil Kumar,“Analysis and Performance of a low cost SMS Based Home Security System “International Journal of Smart Home. Published on July 2011.

28

Page 29: Design & implemetation using gsm modulator

29


Recommended