Sunteți pe pagina 1din 37

CONTENTS 1.

INTRODUCTION

PAGE NO. 2 3 4 4 5 6 7 8 12 14 15 17 19 20 21 22 23 23 24 25 27 29 30 32 33 34

2. BLOCK DIAGRAM OF PROJECT 3. HARDWARE REQUIREMENTS 4.1 TRANSFORMERS 4.2 VOLTAGE REGULATOR (LM7805) 4.3 RECTIFIER 4.4 FILTER 4.5 MICROCONTROLLER (AT89S52/C51) 4.6 DTMF DECODER 4.7 RELAY 4.8 ULN2003 4.9 INVERTOR 7404 4.10 LED 4.11 1N4007 4.12 RESISTORS 4.13 CAPACITORS 4. SOFTWARE REQUIREMENTS 5.1 KEIL C 5. SCHEMATIC DIAGRAM 5.1 DESCRIPTION 5.2. BRIEF DESCRIPTION OF WORKING RELAY 6. LAYOUT DIAGRAM 7. CODING 8. CONCLUSION 9. BIBLIOGRAPHY 10. PHOTOGRAPHY

1. INTRODUCTION
The project works on the principle of DTMF tone command so received from any phone to remotely switch any electrical load such as agricultural pump, domestic and industrial loads etc. In industries, the loads are spread over a large area and thus, operating these loads is a very tiresome and difficult task. In agricultural fields also, pumps and other loads are connected over a large area and hence it is difficult for the farmer to operate all the loads and similarly for house hold loads. Keeping these problems in mind, the proposed system has been designed which uses DTMF technology to control the loads remotely. A cell phone is interfaced to a DTMF decoder in the system from its audio output socket for receiving tone commands. The receiving cell phone codes are converted into digital commands by using a DTMF Decoder which will identify the frequency of the key and convert that frequency to its equivalent digital code which is then fed to a microcontroller (8051 family). As per the commands sent from the senders mobile, the microcontroller will send signals through a buffer to actuate the respective loads by turning the relays ON/OFF. These relays are actuated by a relay driver IC interfaced to the microcontroller. Further this project can be enhanced by using a GSM modem, where the loads can be controlled by sending an SMS. This will eliminate the need of answering the call for the system to work The main objective of the project is to control the functioning of the industrial/ agricultural load using wireless technology. One cell phone will send digitized commands to another cell phone which is in auto answering mode at the receiving end. The receiving cell phone codes are fed to the microcontroller which is programmed to recognize those codes for operating any kind of load duly interfaced through relays and relay drivers as per the sent commands from the senders mobile The receiving cell phone codes are DTMF (dual tone multi frequency) decoded. DTMF Decoder will identify the key frequency and convert that frequency to digital codes which are then fed to the microcontroller.

2. BLOCK DIAGRAM

3. HARDWARE REQUIREMENTS
3.1 TRANSFORMER Transformers convert AC electricity from one voltage to another with a little loss of power. Step-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high voltage to a safer low voltage.

FIG 3.1: A TYPICAL TRANSFORMER

The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down and current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage. TURNS RATIO = (Vp / Vs) = ( Np / Ns ) Where, Vp = primary (input) voltage. Vs = secondary (output) voltage Np = number of turns on primary coil Ns = number of turns on secondary coil Ip = primary (input) current Is = secondary (output) current.

3.2 VOLTAGE REGULATOR 7805

Features Output Current up to 1A. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V. Thermal Overload Protection. Short Circuit Protection. Output Transistor Safe Operating Area Protection.

Description The LM78XX/LM78XXA series of three-terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

Internal Block Diagram

3.3 RECTIFIER A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), current that flows in only one direction, a process known as rectification. Rectifiers have many uses including as components of power supplies and as detectors of radio signals. Rectifiers may be made of solid state diodes, vacuum tube diodes, mercury arc valves, and other components. The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification. In positive half cycle only two diodes (1 set of parallel diodes) will conduct, in negative half cycle remaining two diodes will conduct and they will conduct only in forward bias only.

3.4 FILTER Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.

The simple capacitor filter is the most basic type of power supply filter. The use of this filter is very limited. It is sometimes used on extremely high-voltage, low-current power supplies for cathode-ray and similar electron tubes that require very little load current from the supply. This filter is also used in circuits where the power-supply ripple frequency is not critical and can be relatively high. Below figure can show how the capacitor charges and discharges.

3.5 MICROCONTROLLER AT89S52 The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non volatile memory technology and is compatible with the industry standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

Features: Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 10,000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 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 Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode) Green (Pb/Halide-free) Packaging Option

Block Diagram of AT89S52:

FIG 3.5: BLOCK DIAGRAM OF AT89S52

Pin Configurations of AT89S52

FIG3.5 (b): PIN DIAGRAM OF AT89S52

3.6 DTMF DECODER MT8870D Introduction

Dual Tone Multiple Frequency (DTMF) codec is used to encode and decode the key strokes in a telephone. It can also be used to perform a basic data transfer operation.

Telephone signalling is based on encoding keypad digits using two sinusoidal of different frequencies, hence the name DTMF. Each digit is represented by a low frequency and a high frequency sinusoid. The frequencies used were recommended by AT&T such that no two frequencies are integral multiples of each other. This facilitates correct decoding even in the presence of non linearity of filters which cause higher harmonics to be present.

Features Complete DTMF Receiver Low power consumption Internal gain setting amplifier Inhibit mode Central office quality Power-down mode Adjustable guard time Backward compatible with MT8870C/MT8870C-1

FIG: DTMF DECODER IC Description The MT8870D/MT8870D-1 is a complete DTMF receiver integrating both the band split filter and digital decoder functions. The filter section uses switched capacitor techniques for high and low group filters; the decoder uses digital counting techniques to detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is minimized by on chip provision of a differential input amplifier, clock oscillator and latched three-state bus interface. The photo depicts a DTMF generator/decoder pair you can build in an afternoon or two. Dual-tone-multi-frequency (DTMF, also known as touch-tone) is the audible sounds you hear when you press keys on your phone. The tone generator (top) uses the 5589 chip and a DIP switch. You can actually hear the tones through the speaker. The bottom circuit uses the 8870 to decode a tone and display its associated number on the 7-segment LED. Touch-tone is familiar to many (telephone), it is a mature technology, and readily available with off-the-shelf, single-chip, low-cost components. For these reasons DTMF is often used in remote control applications that typically use telephones (e.g. accessing your messages from an answering machine, retrieving your account balance info from your bank's database).

3.7 RELAYS

A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal.

A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts as shown in the diagram.

Fig 3.8 Relay showing coil and switch contacts

3.8 RELAY DRIVER (ULN2003)

Relay Driver: ULN2003 is a high voltage and high current Darlington transistor array.

Description: The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It consists of seven NPN Darlington pairs that feature high-voltage outputs with commoncathode Clamp diode for switching inductive loads. The collector-current rating of a single Darlington pair is 500mA. The Darlington pairs may be paralleled for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas discharge), line drivers, and logic buffers.

The ULN2003 has a 2.7kW series base resistor for each Darlington pair for operation directly with TTL or 5V CMOS devices.

Fig: 3.9 ULN 2003 FEATURES: Pin no.:16 Temperature, Operating Range:-20C to +85C Transistor Polarity: NPN Transistors, No. of:7 Current, Output Max:500mA

Input Type: TTL, CMOS 5V Voltage, Input Max:5V Voltage, Output Max:50V

PIN Diagram:

Fig: 3.10 Schematics of Darlingtons pair

3.9 INVERTER IC 7404 Outputs of one gate can be connected to inputs of another within the same chip or to another chip as long as they share the same ground. The figure to the left illustrates a basic circuit showing how to wire inputs and using LEDs to display outputs.

The 7404 is an inverting buffer, especially useful when the output of one circuit cannot sink much current. A computer's parallel port is a notorious example and can easily be damaged by excessive current draw. Each of the parallel ports outputs can be connected to one of the six inputs on the 7404 hex inverter chip. However, more than one 7404 will be needed to interface all of the parallel port pins.

NOT GATE Logic-Rules: The output is the inverse of the input, in other words if the input is HIGH then the output is LOW and if the input is LOW the output is HIGH.

Fig: 3.11 Inverter IC 7404 Features: Output Drive Capability - 10 LSTTL Loads. Outputs Directly Interface to CMOS, NMOS and TTL. Large Operating Voltage Range Low Input Current. High Noise Immunity.

Absolute Maximum Ratings

Supply Voltage Input Voltage Operating Free Air Temperature Storage Temperature Range

7V 5.5V 0oC to +70oC -65oC to +150oC

3.10 LED

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices, and are increasingly used for lighting. When a light-emitting diode is forward biased (switched on), electrons are able to recombine with holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. An LED is often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern. LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater durability and reliability.

Electronic Symbol:

Fig 3.13: symbol of LED

3.11 1N4007 Diodes are used to convert AC into DC these are used as half wave rectifier or full wave rectifier. Three points must he kept in mind while using any type of diode. 1. Maximum forward current capacity 2. Maximum reverse voltage capacity 3. Maximum forward voltage capacity

Fig: 1N4007 diodes

Fig:PN Junction diode PN JUNCTION OPERATION Now that you are familiar with P- and N-type materials, how these materials are joined together to form a diode, and the function of the diode, let us continue our discussion with the operation of the PN junction. But before we can understand how the PN junction works, we must first consider current flow in the materials that make up the junction and what happens initially within the junction when these two materials are joined together.

3.12 RESISTORS A resistor is a two-terminal electronic component designed to oppose an electric current by producing a voltage drop between its terminals in proportion to the current, that is, in accordance with Ohm's law: V = IR Resistors are used as part of electrical networks and electronic circuits. They are extremely commonplace in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome). The primary characteristics of resistors are their resistance and the power they can dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less wellknown is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. Critical resistance depends upon the materials constituting the resistor as well as its physical dimensions; it's determined by design..

3.13 CAPACITORS

A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors. An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage. The properties of capacitors in a circuit may determine the resonant frequency and quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy capacity in a high-power system, and many other important aspects.

4. SOFTWARE REQUIREMENTS
4.1 INTRODUCTION TO KEIL MICRO VISION (IDE)

Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families.

Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. When starting a new project, simply select the microcontroller you use from the Device Database and the Vision IDE sets all compiler, assembler, linker, and memory options for you.

Keil is a cross compiler. So first we have to understand the concept of compilers and cross compilers. After then we shall learn how to work with keil.

5. SCHEMATIC DIAGRAM

5.1 DESCRIPTION POWER SUPPLY The circuit uses standard power supply comprising of a step-down transformer from 230Vto 12V and 4 diodes forming a bridge rectifier that delivers pulsating dc which is then filtered by an electrolytic capacitor of about 470F to 1000F. The filtered dc being unregulated, IC LM7805 is used to get 5V DC constant at its pin no 3 irrespective of input DC varying from 7V to 15V. The regulated 5V DC is further filtered by a small electrolytic capacitor of 10F for any noise so generated by the circuit. One LED is connected of this 5V point in series with a current limiting resistor of 330 to the ground i.e., negative voltage to indicate 5V power supply availability. The unregulated 12V point is used for other applications as and when required.

STANDARD CONNECTIONS TO 8051 SERIES MICRO CONTROLLER ATMEL series of 8051 family of micro controllers need certain standard connections. The actual number of the Microcontroller could be 89C51 , 89C52, 89S51, 89S52, and as regards to 20 pin configuration a number of 89C2051. The 4 set of I/O ports are used based on the project requirement. Every microcontroller requires a timing reference for its internal program execution therefore an oscillator needs to be functional with a desired frequency to obtain the timing reference as t =1/f. A crystal ranging from 2 to 20 MHz is required to be used at its pin number 18 and 19 for the internal oscillator. It may be noted here the crystal is not to be understood as crystal oscillator It is just a crystal, while connected to the appropriate pin of the microcontroller it results in oscillator function inside the microcontroller. Typically 11.0592 MHz crystal is used in general for most of the circuits using 8051 series microcontroller. Two small value ceramic capacitors of 33pF each is used as a standard connection for the crystal as shown in the circuit diagram.

RESET Pin no 9 is provided with an re-set arrangement by a combination of an electrolytic capacitor and a register forming RC time constant. At the time of switch on, the capacitor gets

charged, and it behaves as a full short circuit from the positive to the pin number 9. After the capacitor gets fully charged the current stops flowing and pin number 9 goes low which is pulled down by a 10k resistor to the ground. This arrangement of reset at pin 9 going high initially and then to logic 0 i.e., low helps the program execution to start from the beginning. A pushbutton switch is connected across the capacitor so that at any given time as desired it can be pressed such that it discharges the capacitor and while released the capacitor starts charging again and then pin number 9 goes to high and then back to low, to enable the program execution from the beginning. For example: A 10F capacitor and a 10k resistor would render a 100ms time to pin number 9 from logic high to low, there after the pin number 9 remains low.

External Access (EA): Pin no 31 of 40 pin 8051 microcontroller termed as EA is required to be connected to 5V for accessing the program form the on-chip program memory. If it is connected to ground then the controller accesses the program from external memory. However as we are using the internal memory it is always connected to +5V.

5.2 BRIEF DESCRIPTION OF WORKING OF RELAY A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts. Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits; the link is magnetic and mechanical.

ULN 2003 RELAY DRIVER IC

ULN2003 is an IC which is used to interface relay with the microcontroller since the output of the micro controller is maximum 5V with too little current delivery and is not practicable to operate a relay with that voltage. ULN2003 is a relay driver IC consisting of a set of Darlington transistors. If logic high is given to the IC as input then its output will be logic low but not the vice versa. Here in ULN2003 pin 1 to 7 are IC inputs and 10 to 16 are IC outputs. If logic 1 is given to its pin no 1 the corresponding pin 16 goes low. If a relay coil is connected from +ve to the output pin of the uln2003,(the relay driver) then the relay contacts change their position from normally open to close the circuit as shown below for the load on (say a lamp to start glowing). If logic 0 is given at the input the relay switches off. Similarly upto seven relays

can be used for seven different loads to be switched on by the normally open(NO) contact or switched off by the normally closed contact(NC)

Load off OPERATION EXPLANATION Connections:

Load on

The output of the power supply which is 5v is connected to 40th pin of MC and GND is connected to its 20th pin. Port 2.0 to 2.4 of MC are given to pin 1 to 5 of Relay driver IC ULN2003A. Pin no 9, 12 to 16 are given to relays pins 10 to 13 of MC are connected to pins 14 to 11 of MT8870 i.e., DTMF IC Working: The project uses a DTMF decoder MT8870/HT9170 that uses a crystal of 3.57 MHz for generating appropriate frequency for comparing the input audio tones at its pin no 2 to generate 4 bit BCD code at its output from pin 11 to 14. This BCD data is passed through HEX CMOS inverters (74LSO4) the output of which are duly pulled up and connected to port-3 pin no 10 to 14 as buffer between the DTMF IC and the MC. While tone commands arrive from a telephone line after a call is established, it first reaches the DTMF decoder IC. MT8870. For example if button 1 is pressed the output develops 0001 at pin 11-14 which are inverted and fed to the microcontroller input ports. For digit 2 the output developed accordingly provides 0010 and so on for rest of the digits. As per the DTMF table seen in the data sheet, the MC program

while executed develops specific output for each number which are then fed to ULN2003 that drives the relays which in turn switches ON or OFF the corresponding load.

6 LAYOUT DIAGRAM

7. CODING
#include <AT89X52.H> sbitD0=P3^3; // input from dtmf decoder sbitD1=P3^2; sbitD2=P3^1; sbitD3=P3^0; sbit_out1=P2^0; sbit_out2=P2^1; sbit_out3=P2^2; sbit_out4=P2^3; sbit_out5=P2^4;

void main( ) { P3=0XFF; // make port3 as input and output P2=0X00; // make port2 as output while(1) { if(D0==1&&D1==0&&D2==1&&D3==1) //for key 1 { Out1=1; } else if (D0==1&&D1==1&&D2==0&&D3==1) //for key 2 { Out1=0; } Else if (D0==1&&D1==0&&D2==0&&D3==1) //for key 3 { Out2=1; } Else if (D0==1&&D1==1&&D2==1&&D3==0) //for key 4 //relay2 ON //relay1 OFF //relay1 ON

{ Out2=0; } Else if (D0==1&&D1==0&&D2==1&&D3==0) //key 5 { Out3=1; } else if (D0==1&&D1==1&&D2==0&&D3==0) { Out3=0; } Else if (D0==1&&D1==0&&D2==0&&D3==0) //for key 7 { Out4=1; } Else if (D0==0&&D1==1&&D2==1&&D3==1) { Out4=0; } Else if (D0==0&&D1==0&&D2==1&&D3==1) //for key 9 { Out5=1; } Else if (D0==1&&D1==1&&D2==1&&D3==1) //for key 0 { Out5=0; } } } //relay5 OFF //relay5 ON //relay4 OFF //for key 8 //relay4 ON //relay3 OFF //for key 6 //relay3 ON //relay2 OFF

8. CONCLUSION
Thus by using DTMF technology and microcontroller the loads can be operated from any

place. Using DTMF technology the loads can be operated from any where.

Quick response is achieved.

Construction is easy.

Easy to maintain and repair. This system can be used in industrial applications.

This system can be employed in houses , where people often forget to switch off

electrical appliances

9. BIBLIOGRAPHY
TEXT BOOKS REFERED: 1. The 8051 Microcontroller and Embedded systems by Muhammad Ali Mazidi and Janice Gillispie Mazidi , Pearson Education. 2. ATMEL 89S52 Data Sheets. WEBSITES www.atmel.com www.beyondlogic.org www.wikipedia.org www.howstuffworks.com www.alldatasheets.com

10. PHOTOGRAPH

S-ar putea să vă placă și