Вы находитесь на странице: 1из 69

A PROJECT REPORT ON WIRELESS SPEED CONTROL OF FAN USING IR

Submitted in partial fulfillment of the requirement for the award of degree of BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION ENGINEERING

COLLEGE NAME & ADDRESS

Index
About the Organization..................................................................................................4 Acknowledgement.........................................................................................................5 Absrtact..........................................................................................................................6 1. Introduction................................................................................................................9 2. Embedded Systems..................................................................................................12 3. Block Diagram.........................................................................................................15 4. Circuit Diagrams......................................................................................................17 5. Hardware Description..............................................................................................21 5.1 Microcontroller Unit..........................................................................................22 5.6 Features of Atmel 89S52 Microcontroller.........................................................53 5.6.1 General Description....................................................................................54 5.6.2 Microcontroller Unit...................................................................................54 5.6.3 Pin description of Atmel 89S52 Microcontroller........................................55 6. Communication Modules.........................................................................................62 7. Major Components...................................................................................................66 7.1 Power Supply.....................................................................................................66 7.2 General Block Diagram of a Power Supply Unit...............................................66 7.3 Description.........................................................................................................69 7.5 Liquid Crystal Display (LCD):..........................................................................73 7.5.1 Features.......................................................................................................74 7.5.2 Overview.....................................................................................................74 7.6 Capacitors..........................................................................................................89 7.8 Diodes................................................................................................................93 7.8.1 Zener diode.................................................................................................94 8. Software Description...............................................................................................97 8.1 Introduction........................................................................................................97 9. Source Code...........................................................................................................102 10. Applications.........................................................................................................113 Conclusion:................................................................................................................114 Bibilography:.............................................................................................................115

ACKNOWLEDGEMENT
The project work entitled WIRELESS SPEED CONTROL OF FAN USING IR is carried out at , Hyderabad. First of all, we express my sincere gratitude to my guide xxxxxxx, Team leader, of Embedded Systems, for the allotment of the project in their section, providing all the required material for the project and also his constant help and guidance throughout our project We express my thanks to xxxxxxxxxxxxxxxxx Principal of xxxxxxxxxx institute of engineering and technology for giving his consent to take up this dissertation. My deepest thanks to Lecturer, xxxxxxxxxxxx, the Guide of the Project for guiding and correcting various documents of mine with attention and care. She has taken pain to go through the project and make necessary correction as and when needed. My special thanks to xxxxxxxxxxx, Head of the department of DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING, xxxxxxxxxx institute of engineering and technology, who has given us an immense support throughout the course of the project. Finally, we would also thank our Institution and our faculty members without whom this project would have been a distant reality. XXXXXXXXXX

Abstract
Nowadays, there are various electronic equipments available for different applications. Our application is to control the speed of FAN or AC Motor using IR. Using this circuit, you can change the speed of the fan from your couch or bed. Infrared receiver module is used to receive the infrared signals transmitted by remote control. In this project, we are using TRIAC driver for our AC Motor because our Microcontroller cannot provide the maximum current to drive an AC Motor. So using Triac we will be driving the AC motor. Driving an AC motor is not only the criteria but also we need to protect the microcontroller from high currents, for that purpose we are using a component called MOC 3021. A 16X2 LCD is used for the displaying the speed of the motor at which it is rotating. This project can be applied in various areas like spinning industries, offices and in manufacturing of home appliances etc. This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/12V step down transformer.

INTRODUCTION
An embedded system is a combination of software and hardware to perform a dedicated task. Some of the main devices used in embedded products are Microprocessors and Microcontrollers. Microprocessors are commonly referred to as general purpose processors as they simply accept the inputs, process it and give the output. In contrast, a microcontroller not only accepts the data as inputs but also manipulates it, interfaces the data with various devices, controls the data and thus finally gives the result.

Wireless Communication:
Wireless communication, as the term implies, allows information to be exchanged between two devices without the use of wire or cable. A wireless keyboard sends information to the computer without the use of a keyboard cable; a cellular telephone sends information to another telephone without the use of a telephone cable. Changing television channels, opening and closing a garage door, and transferring a file from one computer to another can all be accomplished using wireless technology. In all such cases, information is being transmitted and received using electromagnetic energy, also referred to as electromagnetic radiation. One of the most familiar sources of electromagnetic radiation is the sun; other common sources include TV and radio signals, light bulbs and microwaves. To provide background information in understanding wireless technology, the electromagnetic spectrum is first presented and some basic terminology defined.

WIRELESS SPEED CONTROLING REGULATOR OF FAN USING IR


Controlling electrical appliances through IR remote is interesting and very useful application. This system is widely used in industries, offices, Banks, hotels, hospitals, and display boards. In this project, IR is used for controlling any appliance in an industry by controlling the loads and varying the speed of the motor. IR rays are transmitted through remote and these rays are received by a receiver named TSOP 1738. Here, in this project two microcontrollers are used, one for master SECTION and other for slave section. The IR rays received by TSOP are given to the master section. From master section, IR signals are given to slave section for LED indication and are displayed on 7-segment for the respective loads. Now, from MASTER section, the loads are controlled through triac driving circuit, and also the speed of the motor can be varied using PWM technique. In the triac driving circuit, as the controller cannot provide sufficient current, MOCS are used to drive these triacs and these triacs in turn are connected to loads. Next, in the slave section, the door opening and closing is done through a stepper motor rotating in clockwise and anticlockwise direction respectively. In this, for every respective load on activation, a message is shown on LCD and with respect to the motor, speed level is shown as speed1, speed2, speed3, speed4, speed5 and speed6. The uniqueness of this project is, a stepper motor is also can be controlled by IR signal. Using > key on remote, the door can be opened, and using < key, the door can be closed. This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/12V step down transformer.

Block plant using IR Communication Diagram:

IR Rx

Triac Control Circuit

Load

MCU AT89S52

LCD display

Step down T/F

Bridge Rectifier

Filter Circuit

Regulator Power supply to all sections

POWER SUPPLY: The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.

230V AC 50Hz

D.C Output

Step down transformer

Bridge Rectifier Filter Regulator

Fig: Power supply Transformer: Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.

Rectifier:

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. 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. Voltage regulator: As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels.

SCHEMATIC: Power Supply:


U
1

3
V G N D O U 3 T

7 8 0 5 V I N

R
C / 2 5 V 5 1 0 u F

6
3 3 FE 0 E , 1 / 4 W

D J 1
2 1 A C I N 1 N

1
4 0

D
0 17 N

2
4 0

D
0 17 N

3
4 0

D
0 17 N

4
4 0

0 7 1 0

4
0 0

u F

/ 1 6 V 0 . 1 Lu

D
O N

1
R E D

Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/09V step down transformer. This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Mains Transformer: It is a Step-Down power transformer that operates at power line Frequency of 50Hz. It converts 230v AC into 0 to 12v DC. Rectifier Circuit: It is a Full-Wave Bridge Rectifier consisting of four IN4007 diodes. Filter Section: It consists of a capacitor C1, which has a capacitance of 1000micro Farads. It is large enough to supply a constant current to the load during the non conduction period of the diode Regulators : 5v voltage regulator-7805 .

Operation The transformer provides voltage transformation and produces AC voltage required for producing the desired DC voltages across its secondary windings. It also provides electrical isolation between the power supply input i.e., AC mains and DC

output. The rectifier circuit changes the AC voltages appearing at transformer secondary to DC. Commonly used rectifier circuits include half-wave rectifier, conventional fullwave rectifier requiring a tapped secondary or a bridge rectifier. The rectified voltage will always have some AC content known as power supply ripple. The filter circuit smoothens the ripple of the rectified voltage. The filtering action of the capacitor connected across the output of the rectifier comes from the fact that it offers a low reactance to AC components. The ripple in nature is inversely proportional to capacitance. Thus, the capacitor connected across the output of the rectifier, which provides the filtering action, must be large enough to avoid the ripple. The regulated circuit is a type of feedback circuit that ensures the output DC voltage does not change from its normal value due to changes in line voltage or load current. It is the nature of regulator circuit that distinguishes the linear power supply from a switching supply. In a linear power supply, the active device (linear regulator) that provides regulation, usually bipolar transistor is operated anywhere between cut-off and saturation i.e., in active region whereas in switching mode power supply, switching regulator is operated either in cut-off or in saturation. 7805 are linear, fixed voltage series regulators, which provide regulated 5v DC respectively. In case of a series regulator a change in the output voltage due to a change in input voltage or load current results in a change in the voltage drop across the regulator transistor so as to maintain a constant output voltage across the load.5v regulated DC is obtained across 10 micro farad capacitor.

Controlling Circuit:
V V C C C C

U
40 31

1
A T 8 9 D 8 D 7 D 6 D 5 D 4 D 3 D 2 D 0 1 2 3 4 5 6 7 9 S 5 2

T 1 0 u F

/ 1

6 V

VC C

EA

1 C

2
1 0 K , 1 / 4 W 1 1 1 1 1 1 1 1

1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8

P P P P P P P P R P P P P P P P P

1 1 1 1 1 1 1 1 S 3 3 3 3 3 3 3 3 X1

. . . . . . . . T . . . . . . . .

0 1 2 3 4 5 6 7

/ T 2 / T 2 E X 3 P 0 . 0 / A3 P 0 . 1 / A3 P 0 . 2 / A3 / M 0O . S / I A3 P 3 / M 0I S. 4 O / A3 P / S C . K5 / A3 P 0 P 0 . 6 / A3 P 0 . 7 / A / / / / / / / / R X D TP X 2 D . 7 IPN 2 T . 6 0 IPN 2 T . 5 1 TP 0 2 . 4 TP 1 2 . 3 WP 2 R . 2 R P D2 . 1 P 2 . 0 A L

1 5

I O

D 0 1 2 3 4 5 6 7 / / / / / / 2 A 2 A 2 A 2 A 2 A 2 A 2 8 71 61 51 41 31 21 5 4 3 2 1 0

1 6

D I O

I O D

D E

9 V

1 4D

R 1 1 K , 1 / 4 W C 4 . 7 u F U 2 1 D 5 . 1 V R T 1 2 D I O D E Z E N E R C , 1 1 6 V

X 2

/2 A 1 9 /3 A 0 8 E

1 3D

I O

G N D PSEN

D 19

1 2D

I O

V IN

O G N D

20 29

L S

/ P

3 3 0 E O P 1 7 3 8

, 1 / 4 W

2
3 3 p F

3
3 3 p F

T S 1

The Controlling module consists of a microcontroller (AT89S52). It is connected with a crystal oscillator (11.0592MHz) to the pins 18 & 19. Additional two capacitors are connected to filter any noise or unwanted particles in it.

A reset circuit is connected to the 9th pin with a capacitor & resistor. At power ON condition, this capacitor sends a high pulse to this pin to make it reset all its i/o pins. Additionally a switch is connected as a reset switch. In system hang-up conditions, this switch can be used to reset the unit Using this circuit, you can change the speed of the fan from your couch or bed. Infrared receiver module TSOP1738 is used to receive the infrared signal transmitted by remote control. The TSOP1738 will sense the signals from the IR remote and it passes these signals to the microcontroller. The microcontroller will receive the input signals and compares and sends out these signals as different pulses to the Regulator Module.

Fan Regulator Circuit:


V C C

VC C

R 2 4 7 K

R 4 1 0 0 K , 1 / 4 W

, 1 / 4 W U 2 4 8 R ST VC C

16

U 6 1 2 Q C 1 5 5 U 3 T R Q

R 3 2 4 7 D D D D 1 1 7 1 N 8 9 1 N 4 1 R 8 52 4 4 4 4 7 K , 1 / 4 W , 1 , 1 K K , 1 / 4 / 4 / 4 W R ST W W W N C E 8 F C 7 0 . 0 1 u F 5 6 7 VC C T D H S T R G R C G N D H R 1 1 K 0 , 1 / 4 W U 3 4 8 4 7 0 E , 1

1 1 / 4 W

7 O S 6

Q Q Q Q

0 1 2 3 4 5 4 0

1 R 4 68 2 2 K 1 R 4 87 1 5 K 1 R 4 88 1 0 . 3

1 N 0 1 N 1 1 N

6 7 P U L S E I / P 2

T H D T R S

R C G N D G H

G N D

EN A

C V

1 1 7

5 5 2

C 1

2 0 u F

5 5

13

0 . 2 2 u

, 1 6 V C 3 1 u F , 1 6 V

C 6 0 . 0 1 u

R 1 0 K

1 3 , 1 / 4 W

1 24 7 M T 1 Q 2 I A C

0 E

, 1

/ 4 W

M T 2

T 1

D D

6 5 4 3 2 1 P D

1 N 1 N 1 N

4 0 4 0

0 7 0 7 7 C 44 7 0 u F

15 6. 6 K

, 1

/ 4 W U 1 2

6 5 4

T R

T 1

3 6 4

C V

1 4 1 1 C Q 9 Q

L K 9 Q 8

1 0 D

9 4 1 R4 8 3

, 1 / 4

3 T

Q B

1 C

5 4

U 3 2 1

6 0 2

6 4 8

D D D D

4 0 0 4 0 4 0

M o t o r

1 N 1 N 1 N O

0 7 0 7

,C 5 50 0 V . 1 u

F 9 V

T 2

T R

T E

4 0 0 7 W N

1 U

G N D

V 5

I N

V M

6 R 1 4 4 7 E , 1 / 4 W C 9 R 1 5 , 1 / 4 W 0 4 7 E . 0 1 u F

T 9 / T O

7 8 0

Working procedure:
The circuit is powered by regulated 9V. The AC mains is stepped down by transformer T1 to deliver a secondary output of 12V-0-12V. The transformer output is rectified by full-wave rectifier comprising diodes D1 and D2, filtered by capacitor C4 and regulated by LM7809 regulator to provide 9V regulated output. Any button on the remote can be used for controlling the speed of the fan. Pulses from the microcontroller are applied as a trigger signal to timer NE555 (ICU2) via LED1 and resistor R4. IC-U2 is wired as a monostable multivibrator to delay the clock given to decade counter-cum-driver IC CD4017 (IC-U4). Out of the ten outputs of decade counter IC-U4 (Q0 through Q9), only five (Q0 through Q4) are used to control the fan. Q5 output is not used, while Q6 output is used to reset the counter.

Another NE555(IC-U3) timer (IC-U3) is also wired as a monostable multivibrator. Combination of one of the resistors R5 through R9 and capacitor C8 controls the pulse width. The output from IC CD4017 (IC-U4) is applied to resistors R5 through R9. If Q0 is high capacitor C8 is charged through resistor R5, if Q1 is high capacitor C8 is charged through resistor R6, and so on. Optocoupler MCT2E (IC-U7) is wired as a zero-crossing detector that supplies trigger pulses to monostable multivibrator C8 during zero crossing. Opto-isolator MOC3021 (IC-U6) drives triac Q2-BT136. Resistor R15 (47- ohm) and capacitor C9 (0.01F) combination is used as snubber network for triac1 (Q2-BT136). As the width of the pulse decreases, firing angle of the triac increases and speed of the fan also increases. Thus the speed of the fan increases when we press any button on the remote control. Assemble the circuit on a general purpose PCB and house it in a small case such that the infrared sensor can easily receive the signal from the remote transmitter.

INTRODUCTION TO EMBEDDED SYSTEMS


An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below: Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very market segment- consumer electronics, office automation, industrial automation, biomedical engineering, wireless communication, data communication, telecommunications, transportation, military and so on. Consumer appliances: At home we use a number of embedded systems which include digital camera, digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO player, video game consoles, video recorders etc. Todays high-tech car has about 20 embedded systems for transmission control, engine spark control, air-conditioning, navigation etc. Even wristwatches are now

becoming embedded systems. The palmtops are powerful embedded systems using which we can carry out many general-purpose tasks such as playing games and word processing. Office automation: The office automation products using em embedded systems are copying machine, fax machine, key telephone, modem, printer, scanner etc. Industrial automation: Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station. In hazardous industrial environment, where human presence has to be avoided, robots are used, which are programmed to do specific jobs. The robots are now becoming very powerful and carry out many interesting and complicated tasks such as hardware assembly. Medical electronics: Almost every medical equipment in the hospital is an embedded system. These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc. Developments in medical electronics have paved way for more accurate diagnosis of diseases. Computer networking: Computer networking products such as bridges, routers, Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded systems which implement the necessary data communication protocols. For example, a router interconnects two networks. The two networks may be running different protocol stacks. The routers function is to obtain the data packets from incoming pores, analyze the packets and send them towards the destination after doing necessary protocol conversion. Most networking equipments, other than the end systems (desktop computers) we use to access the networks, are embedded systems .

Telecommunications: In the field of telecommunications, the embedded systems can be categorized as subscriber terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice communication over the Internet. Wireless technologies: Advances in mobile communications are paving way for many interesting applications using embedded systems. The mobile phone is one of the marvels of the last decade of the 20h century. It is a very powerful embedded system that provides voice communication while we are on the move. The Personal Digital Assistants and the palmtops can now be used to access multimedia services over the Internet. Mobile communication infrastructure such as base station controllers, mobile switching centers are also powerful embedded systems. Insemination: Testing and measurement are the fundamental requirements in all scientific and engineering activities. The measuring equipment we use in laboratories to measure parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio communication test set etc. are embedded systems built around powerful processors. Thank to miniaturization, the test and measuring equipment are now becoming portable facilitating easy testing and measurement in the field by field-personnel. Security: Security of persons and information has always been a major issue. We need to protect our homes and offices; and also the information we transmit and store. Developing embedded systems for security applications is one of the most lucrative businesses nowadays. Security devices at homes, offices, airports etc. for authentication and verification are embedded systems. Encryption devices are nearly 99 per cent of the processors that are manufactured end up in~ embedded systems. Embedded systems find applications in . every industrial segment- consumer electronics, transportation, avionics, biomedical engineering, manufacturing, process control and industrial automation, data communication, telecommunication, defense, security etc. Used to encrypt the data/voice being transmitted on communication links such as telephone lines.

Biometric systems using fingerprint and face recognition are now being extensively used for user authentication in banking applications as well as for access control in high security buildings. Finance: Financial dealing through cash and cheques are now slowly paving way for transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines. Smart card, of the size of a credit card, has a small microcontroller and memory; and it interacts with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology has the capability of ushering in a cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the work of an embedded system!

Overview of Embedded System Architecture Every embedded system consists of custom-built hardware built around a Central Processing Unit (CPU). This hardware also contains memory chips onto which the software is loaded. The software residing on the memory chip is also called the firmware. The embedded system architecture can be represented as a layered architecture as shown in Fig. The operating system runs above the hardware, and the application software runs above

the operating system. The same architecture is applicable to any computer including a desktop computer. However, there are significant differences. It is not compulsory to have an operating system in every embedded system. For small appliances such as remote control units, air conditioners, toys etc., there is no need for an operating system and you can write only the software specific to that application. For applications involving

complex processing, it is advisable to have an operating system. In such a case, you need to integrate the application software with the operating system and then transfer the entire software on to the memory chip. Once the software is transferred to the memory chip, the software will continue to run for a long time you dont need to reload new software. Now, let us see the details of the various building blocks of the hardware of an embedded system. As shown in Fig. the building blocks are; Central Processing Unit (CPU) Memory (Read-only Memory and Random Access Memory) Input Devices Output devices Communication interfaces Application-specific circuitry

Central Processing Unit (CPU): The Central Processing Unit (processor, in short) can be any of the following: microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor. Its main attraction is that on the chip itself, there will be many other components such as memory, serial communication interface, analog-to digital converter etc. So, for small applications, a micro-controller is the best choice as the number of external components required will be very less. On the other hand, microprocessors are more powerful, but you need to use many external components with them. D5P is used mainly for applications in which signal processing is involved such as audio and video processing.

Memory: The memory is categorized as Random Access 11emory (RAM) and Read Only Memory (ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas ROM retains the contents even if the power is switched off. So, the firmware is stored in the ROM. When power is switched on, the processor reads the ROM; the program is program is executed. Input devices: Unlike the desktops, the input devices to an embedded system have very limited capability. There will be no keyboard or a mouse, and hence interacting with the embedded system is no easy task. Many embedded systems will have a small keypad-you press one key to give a specific command. A keypad may be used to input only the digits. Many embedded systems used in process control do not have any input device for user interaction; they take inputs from sensors or transducers 1fnd produce electrical signals that are in turn fed to other systems. Output devices: The output devices of the embedded systems also have very limited capability. Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be used to display some important parameters. Communication interfaces: The embedded systems may need to, interact with other embedded systems at they may have to transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc. Application-specific circuitry: Sensors, transducers, special processing and control circuitry may be required fat an embedded system, depending on its application. This circuitry interacts with the processor to carry out the necessary work. The entire hardware has to be given power supply either through the 230 volts main supply or through a battery. The hardware has to design in such a way that the power consumption is minimized.

MICROCONTROLLERS: Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The Intel 8051 is a Harvard architecture, single chip microcontroller (C) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8051-compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NVRAM. The microcontroller used in this project is AT89S8252. Atmel Corporation introduced this 89S52 microcontroller. The present project is implemented on Keil Uvision. In order to program the device, Proload tool has been used to burn the program onto the microcontroller. The features, pin description of the microcontroller and the software tools used are discussed in the following sections.

FEATURES OF AT89S52: 8K Bytes of In-System Reprogrammable Downloadable Flash Memory 2K Bytes EEPROM Endurance: 100,000 Write/Erase Cycles 4V to 6V Operating Range 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 Nine Interrupt Sources SPI Serial Interface Programmable UART Serial Channel Interrupt Recovery from Power-down Dual Data Pointer Power-off Flag

DESCRIPTION:

The

AT89S8252

is

low-power,

high-performance

CMOS

8-bit

microcontroller with 8K bytes of downloadable Flash programmable and erasable read-only memory and 2K bytes of EEPROM. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout.

The on-chip downloadable Flash allows the program memory to be reprogrammed through an SPI serial interface or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with downloadable Flash on a monolithic chip, the Atmel AT89S8252 is a powerful microcontroller, which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89S8252 provides the following standard features: 8K bytes of downloadable Flash, 2K bytes of EEPROM, 256 bytes of RAM, 32 I/O lines, 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 AT89S8252 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 external interrupt or hardware reset. The downloadable Flash can be changed a single byte at a time and is accessible through the SPI serial interface. Holding RESET active forces the SPI bus into a serial programming interface and allows the program memory to be written to or read from unless lock bits have been activated.

Fig: Pin diagram

Pin Description
VCC

Pin 40 provides the supply voltage to the chip. The voltage is +5V. GND Ground. XTAL1 and XTAL2

The 8051 has an on-chip oscillator but requires an external clock to run it. Usually, a quartz crystal oscillator is connected to inputs XTAL1 (pin19) and XTAL2 (pin18). There are various speeds of 8051 family. Speed refers to the maximum oscillator frequency connected to XTAL. When the 8051 is connected to a crystal oscillator and is powered up, the frequency can be observed on the XTAL2 pin using the oscilloscope. XTAL1 is the input to the inverting oscillator amplifier and input to the internal clock operating circuit and XTAL2 is the output from the inverting oscillator amplifier.

ALE/PROG Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN (Program Store Enable) It is the read strobe to external program memory. When the AT89S8252 is executing code from external program memory, PSEN is acti-vated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP (External Access Enable)

EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12volt programming enable voltage (VPP) during Flash programming when 12-volt programming is selected.

Ports 0, 1, 2 and 3 The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as input, since P0-P3 have value FFH on them. Port 0(P0) Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. ALE indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1, it has address A0-A7. Therefore, ALE is used for demultiplexing address and data with the help of an internal latch. When there is no external memory connection, the pins of P0 must be connected to a 10K-ohm pull-up resistor. This is due to the fact that P0 is an open drain. With external pull-up resistors connected to P0, it can be used as a simple I/O, just like P1 and P2. But the ports P1, P2 and P3 do not need any pull-up resistors since they already have pull-up resistors internally. Upon reset, ports P1, P2 and P3 are configured as input ports. Port 1 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 internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current because of the internal pull-ups.

Some Port 1 pins provide additional functions. 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. Furthermore, P1.4, P1.5, P1.6, and P1.7 can be configured as the SPI slave port select, data input/output and shift clock input/output pins. Port 1 also receives the low-order address bytes during Flash programming and verification.

Table: Port1 Alternate functions

Programmable Clock Out: A 50% duty cycle clock can be programmed to come out on P1.0. This pin, besides being a regular I/0 pin, has two alternate functions. It can be programmed to input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz (for a 16-MHz operating frequency).

Port 2

With no external memory connection, P2 are used as simple I/O. With external memory connections, port 2 must be used along with P0 to provide the 16-bit address for the external memory. Port 2 is designated as A8-A15 indicating its dual function. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S8252, as shown in the following table.

Table: Port 3 Alternate functions

Data Memory EEPROM and RAM

The AT89S8252 implements 2K bytes of on-chip EEPROM for data storage and 256 bytes of RAM. The upper 128 bytes of RAM occupy a parallel space to the Special Function Registers i.e., the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.

When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions that use direct addressing access SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data It should be noted that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.

The on-chip EEPROM data memory is selected by setting the EEMEN bit in the WMCON register at SFR address location 96H. The EEPROM address range is from 000H to 7FFH. The MOVX instructions are used to access the EEPROM. To access off-chip data memory with the MOVX instructions, the EEMEN bit needs to be set to 0.

MCON REGISTER PS2 7 PS1 6 PS0 5 EEMWE EEMEN 4 3 DPS 2 RDY/BSY WDTEN 1 0

The EEMEN and EEMWE bits are used to select the 2K bytes on-chip EEPROM, and to enable byte-write. The DPS bit selects one of two DPTR registers available. Symbol PS2 PS1 PS0 EEMWE Function Prescaler Bits. When all three bits are set to 0, the timer has a nominal period of 16 ms. When all three bits are set to 1, the nominal period is 2048 ms. These bits are used for watchdog timer. EEPROM Data Memory Write Enable Bit. Set this bit to 1 before initiating byte write to on-chip EEPROM with the MOVX instruction. User EEMEN software should set this bit to 0 after EEPROM write is completed. Internal EEPROM Access Enable. When EEMEN = 1, the MOVX instruction with DPTR will access on-chip EEPROM instead of external data memory. When EEMEN = 0, MOVX with DPTR accesses external

DPS RDY/BSY

data memory. Data Pointer Register Select. DPS = 0 selects the first bank of Data Pointer Register, DP0, and DPS = 1 selects the second bank, DP1 RDY/BSY = 1 means that the EEPROM is ready to be programmed. While programming operations are being executed, the RDY/BSY bit equals 0 and is automatically reset to 1 when programming is completed. Used for Watchdog timer

WDTEN

PROGRAMMING THE FLASH AND EEPROM Atmels AT89S8252 Flash Microcontroller offers 8K bytes of in-system reprogrammable Flash Code memory and 2K bytes of EEPROM Data memory. The AT89S8252 is normally equipped with the on-chip Flash Code and EEPROM Data memory arrays in the erased state (i.e. contents = FFH) and ready to be programmed. This device supports a high-voltage (12-V VPP) Parallel programming mode and a low-voltage (5-V VCC) Serial programming mode. Serial Programming mode: This mode provides a convenient way to reprogram the AT89S8252 inside the users system. The Code and Data memory arrays are mapped via separate address spaces in this mode. An auto-erase cycle is provided with the self-timed programming operation. There is no need to perform the Chip Erase operation to reprogram any memory location in this programming mode unless any of the lock bits have been programmed. Parallel Programming mode: The parallel programming mode is compatible with conventional third party Flash or EPROM programmers. In this mode, the two arrays occupy one contiguous address space: 0000H to 1FFFH for the Code array and 2000H to 27FFH for the Data array. In this mode, there is no auto-erase cycle. To reprogram any non-blank byte, the user needs to use the Chip Erase operation first to erase both arrays.

The Code and Data memory arrays on the AT89S8252 are programmed byte-bybyte in either programming mode. Parallel Programming Algorithm: To program and verify the AT89S8252 in the parallel programming mode, the following sequence is recommended: 1. Power-up sequence: Apply power between VCC and GND pins. Set RST pin to H. Apply a 3 MHz to 24 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Set PSEN pin to L ALE pin to H EA pin to H and all other pins to H. 3. Apply the appropriate combination of H or L logic levels to pins P2.6, P2.7, P3.6, and P3.7 to select one of the programming operations shown in the Flash Programming Modes table. 4. Apply the desired byte address to pins P1.0 to P1.7 and P2.0 to P2.5. Apply data to pins P0.0 to P0.7 for Write Code operation. 5. Raise EA/VPP to 12V to enable Flash programming, erase or verification. 6. Pulse ALE/PROG once to program a byte in the Code memory array, the Data memory array or the lock bits. The byte-write cycle is self-timed and typically takes 1.5 ms. 7. To verify the byte just programmed, bring pin P2.7 to L and read the programmed data at pins P0.0 to P0.7. 8. Repeat steps 3 through 7 changing the address and data for the entire 2K or 8K bytes array or until the end of the object file is reached. 9. Power-off sequence: Set XTAL1 to L. Set RST and EA pins to L. Turn VCC power off. Data Polling: The AT89S8252 features DATA Polling to indicate the end of a byte write cycle. During a byte write cycle in the parallel or serial programming mode, an attempted read of the last byte written will result in the complement of the written datum on P0.7 (parallel mode), and on the MSB of the serial output byte on MISO (serial mode). Once

the write cycle has been completed, true data are valid on all outputs, and the next cycle may begin. DATA Polling may begin any time after a write cycle has been initiated. Ready/Busy: The progress of byte programming in the parallel programming mode can also be monitored by the RDY/BSY output signal. Pin P3.4 is pulled Low after ALE goes high during programming to indicate BUSY. P3.4 is pulled High again when programming is done to indicate READY. Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed Code or Data byte can be read back via the address and data lines for verification. The state of the lock bits can also be verified directly in the parallel programming mode. In the serial programming mode, the state of the lock bits can only be verified indirectly by observing that the lock bit features are enabled. Chip Erase: Both Flash and EEPROM arrays are erased electrically at the same time. In the parallel programming mode, chip erase is initiated by using the proper combination of control signals and by holding ALE/PROG low for 10 ms. The Code and Data arrays are written with all 1s in the Chip Erase operation. In the serial programming mode, a chip erase operation is initiated by issuing the Chip Erase instruction. In this mode, chip erase is self-timed and takes about 16 ms. During chip erase, a serial read from any address location will return 00H at the data outputs.

SERIAL DOWNLOADING: Both the Code and Data memory arrays can be programmed using the serial SPI bus while RST is pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RST is set high, the Programming Enable instruction needs to be executed first before program/erase operations can be executed. An auto-erase cycle is built into the self-timed programming operation (in the serial mode ONLY) and there is no need to first execute the chip erase instruction unless any of the lock bits have been programmed. The Chip Erase operation turns the content of every memory location in both the Code and Data arrays into FFH. The Code and Data memory arrays have separate address spaces: 0000H to 1FFFH for Code memory and 000H to 7FFH for Data memory. Either an external system clock is supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should be less than 1/40 of the crystal frequency. With a 24 MHz oscillator clock, the maximum SCK frequency is 600 kHz.

Serial Programming Algorithm: To program and verify the AT89S8252 in the serial programming mode, the following sequence is recommended: 1. Power-up sequence: Apply power between VCC and GND pins. Set RST pin to H. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 24 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 40. 3. The Code or Data array is programmed one byte at a time by supplying the address and data together with the appropriate Write instruction. The selected memory loca-tion is first automatically erased before new data is written. The write cycle is self-timed and typically takes less than 2.5 ms at 5V.

4. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO/P1.6. 5. At the end of a programming session, RST can be set low to commence normal operation. 6. Power-off sequence (if needed): Set XTAL1 to L (if a crystal is not used). Set RST to L. Turn VCC power off. The algorithm used in this project to enable EEPROM is serial programming mode. Machine cycle for the 8051 The CPU takes a certain number of clock cycles to execute an instruction. In the 8051 family, these clock cycles are referred to as machine cycles. The length of the machine cycle depends on the frequency of the crystal oscillator. The crystal oscillator, along with on-chip circuitry, provides the clock source for the 8051 CPU. The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make the 8051 based system compatible with the serial port of the IBM PC. In the original version of 8051, one machine cycle lasts 12 oscillator periods. Therefore, to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the crystal frequency and its inverse is taken.

IR SECTION: WHAT IS INFRARED?

Infrared is a energy radiation with a frequency below our eyes sensitivity, so we cannot see Even that we can not "see" sound frequencies, we know that it exist, we can listen them. it

Even that we can not see or hear infrared, we can feel it at our skin temperature sensors. When you approach your hand to fire or warm element, you will "feel" the heat, but you can't see it. You can see the fire because it emits other types of radiation, visible to your eyes, but it also emits lots of infrared that you can only feel in your skin. INFRARED IN ELECTRONICS Infra-Red is interesting, because it is easily generated and doesn't suffer electromagnetic interference, so it is nicely used to communication and control, but it is not perfect, some other light emissions could contains infrared as well, and that can interfere in this communication. The sun is an example, since it emits a wide spectrum or radiation. The adventure of using lots of infra-red in TV/VCR remote controls and other applications, brought infra-red diodes (emitter and receivers) at very low cost at the market. From now on you should think as infrared as just a "red" light. This light can means something to the receiver, the "on or off" radiation can transmit different meanings.Lots of things can generate infrared, anything that radiate heat do it, including out body, lamps, stove, oven, friction your hands together, even the hot water at the faucet. To allow a good communication using infra-red, and avoid those "fake" signals, it is imperative to use a "key" that can tell the receiver what is the real data transmitted and what is fake. As an analogy, looking eye naked to the night sky you can see hundreds of stars, but you can spot easily a far away airplane just by its flashing strobe light. That strobe light is the "key", the "coding" element that alerts us.

Similar to the airplane at the night sky, our TV room may have hundreds of tinny IR sources, our body and the lamps around, even the hot cup of tea. A way to avoid all those other sources, is generating a key, like the flashing airplane. So, remote controls use to pulsate its infrared in a certain frequency. The IR receiver module at the TV, VCR or stereo "tunes" to this certain frequency and ignores all other IR received. The best frequency for the job is between 30 and 60 KHz, the most used is around 36 KHz

IR GENERATION To generate a 36 KHz pulsating infrared is quite easy, more difficult is to receive and identify this frequency. This is why some companies produce infrared receives, that contains the filters, decoding circuits and the output shaper, that delivers a square wave, meaning the existence or not of the 36kHz incoming pulsating infrared. It means that those 3 dollars small units, have an output pin that goes high (+5V) when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not this radiation.

A square wave of approximately 27uS (microseconds) injected at the base of a transistor, can drive an infrared LED to transmit this pulsating light wave. Upon its presence, the commercial receiver will switch its output to high level (+5V).If you can turn on and off this frequency at the transmitter, your receiver's output will indicate when the transmitter is on or off.

Those IR demodulators have inverted logic at its output, when a burst of IR is sensed it drives its output to low level, meaning logic level = 1. The TV, VCR, and Audio equipment manufacturers for long use infra-red at their remote controls. To avoid a Philips remote control to change channels in a Panasonic TV, they use different codification at the infrared, even that all of them use basically the same transmitted frequency, from 36 to 50 KHz. So, all of them use a different combination of bits or how to code the transmitted data to avoid interference. RC-5 Various remote control systems are used in electronic equipment today. The RC5 control protocol is one of the most popular and is widely used to control numerous home appliances, entertainment systems and some industrial applications including utility consumption remote meter reading, contact-less apparatus control, telemetry data transmission, and car security systems. Philips originally invented this protocol and virtually all Philips remotes use this protocol. Following is a description of the RC5. When the user pushes a button on the hand-held remote, the device is activated and sends modulated infrared light to transmit the command. The remote separates command data

into packets. Each data packet consists of a 14-bit data word, which is repeated if the user continues to push the remote button. The data packet structure is as follows: 2 start bits, 1 control bit, 5 address bits, 6 command bits.

The start bits are always logic 1 and intended to calibrate the optical receiver automatic gain control loop. Next, is the control bit. This bit is inverted each time the user releases the remote button and is intended to differentiate situations when the user continues to hold the same button or presses it again. The next 5 bits are the address bits and select the destination device. A number of devices can use RC5 at the same time. To exclude possible interference, each must use a different address. The 6 command bits describe the actual command. As a result, a RC5 transmitter can send the 2048 unique commands. The transmitter shifts the data word, applies Manchester encoding and passes the created one-bit sequence to a control carrier frequency signal amplitude modulator. The amplitude modulated carrier signal is sent to the optical transmitter, which radiates the infrared light. In RC5 systems the carrier frequency has been set to 36 kHz. Figure below displays the RC5 protocol. The receiver performs the reverse function. The photo detector converts optical transmission into electric signals, filters it and executes amplitude demodulation. The receiver output bit stream can be used to decode the RC5 data word. This operation is done by the microprocessor typically, but complete hardware implementations are present on the market as well. Single-die optical receivers are being mass produced by a number of companies such as Siemens, Temic, Sharp, Xiamen Hualian, Japanese Electric and others. Please note that the receiver output is inverted (log. 1 corresponds to illumination absence).

IR RECEIVER Description The TSOP17 Series are miniaturized receivers for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP17 is the standard IR remote control receiver series, supporting all major transmission codes. Features Photo detector and preamplifier in one package Internal filter for PCM frequency Improved shielding against electrical field disturbance TTL and CMOS compatibility Output active low Low power consumption High immunity against ambient light Continuous data transmission possible (up to 2400 bps) Suitable burst length .10 cycles/burst

Suitable Data Format The circuit of the TSOP17 is designed in that way that unexpected output pulses due to noise or disturbance signals are avoided. A bandpass filter, an integrator stage and an automatic gain control are used to suppress such disturbances. The distinguishing mark between data signal and disturbance signal are carrier frequency, burst length and duty cycle. The data signal should fulfil the following condition: Carrier frequency should be close to center frequency of the bandpass (e.g. 38 KHz). Burst length should be 10 cycles/burst or longer. After each burst which is between 10 cycles and 70 cycles a gap time of at least 14 cycles is necessary. For each burst which is longer than 1.8ms a corresponding gap time is necessary at some time in the data stream. This gap time should have at least same length as the burst. Up to 1400 short bursts per second can be received continuously. Some examples for suitable data format are: NEC Code, Toshiba Micom Format, Sharp Code, RC5 Code, RC6 Code, R2000 Code and Sony Format (SIRCS). When a disturbance signal is applied to the TSOP17. It can still receive the data signal. However the sensitivity is reduced to that level that no unexpected pulses will occur. Some examples for such disturbance signals which are suppressed by the TSOP17 are: DC light (e.g. from tungsten bulb or sunlight) Continuous signal at 38 kHz or at any other frequency Signals from fluorescent lamps with electronic ballast (an example of the signal modulation is in the figure below).

LED INTERFACING: LED stands for Light Emitting Diode. Microcontroller port pins cannot drive these LEDs as these require high currents to switch on. Thus the positive terminal of LED is directly connected to Vcc, power supply and the negative terminal is connected to port pin through a current limiting resistor. Light-emitting diodes are elements for light signalization in electronics. They are manufactured in different shapes, colors and sizes. For their low price, low consumption and simple use, they have almost completely pushed aside other light sources- bulbs at first place. They perform similar to common diodes with the difference that they emit light when current flows through them.

It is important to know that each diode will be immediately destroyed unless its current is limited. This means that a conductor must be connected in parallel to a diode. In order to correctly determine value of this conductor, it is necessary to know diodes voltage drop in forward direction, which depends on what material a diode is made of and what colour it is. Values typical for the most frequently used diodes are shown

in table below: As seen, there are three main types of LEDs. Standard ones get ful brightness at current of 20mA. Low Current diodes get ful brightness at ten times lower current while Super Bright diodes produce more intensive light than Standard ones. Since the 8051 microcontrollers can provide only low input current and since their pins are configured as outputs when voltage level on them is equal to 0, direct connectining to LEDs is carried out as it is shown on figure (Low current LED, cathode is connected to output pin). This current limiting resistor is connected to protect the port pins from sudden flow of high currents from the power supply. Thus in order to glow the LED, first there should be a current flow through the LED. In order to have a current flow, a voltage difference should exist between the LED terminals. To ensure the voltage difference between the terminals and as the positive terminal of LED is connected to power supply Vcc, the negative terminal has to be connected to ground. Thus this ground value is provided by the microcontroller port pin. This can be achieved by writing an instruction CLR P1.0. With this, the port pin P1.0 is initialized to zero and thus now a voltage difference is established between the LED terminals and accordingly, current flows and therefore the LED glows. LED and switches can be connected to any one of the four port pins.

Vcc

P1.0

Fig: LED Interfacing with the microcontroller In this project, four LEDS are used, two for each IR section. Red LED is to indicate that the gate is closed and Green LED to indicate the gate is opened.

4.1.PHOTO MODULE FOR REMOTE CONTROL SYSTEM


TSOP1738 38 kHz

Figure4.1.1

4.1.1.Description
The TSOP17. series are miniaturized receivers for infrared remote control systems. PIN diode andpreamplifier are assembled on lead frame, the epoxypackage is designed as IR filter.The demodulated output signal can directly bedecoded by a microprocessor. TSOP17.. is the standard IR remote control receiver series, supportingall major transmission codes.

4.1.2.Features
_ Photo detector and preamplifier in one package. _ Internal filter for PCM frequency. _ Improved shielding against electrical field Disturbance. _ TTL and CMOS compatibility. _ Output active low _ Low power consumption

Figure 4.1

figure 4.1

Figure 4.2

4.2.LM555/NE555/SA555
4.2.1.Description
The LM555/NE555/SA555 is a highly stable controller capable of producing accurate timing pulses. With a monostable operation, the time delay is controlled by one external resistor and one capacitor. With an astable operation, the frequency and duty cycle are accurately controlled by two external resistors and one capacitor

4.2.2.Features
High Current Drive Capability (200mA) Adjustable Duty Cycle Temperature Stability of 0.005%/ C

Timing From Sec to Hours Turn off Time Less Than 2Sec

4.2.3Applications
Precision Timing Pulse Generation Time Delay Generation Sequential Timing

Figure 4.2.1

Figure 4.2.2

figure 4.2.3

Figure 4.2.4

4.3.HEF4017B MSI
5-stage Johnson counter

4.3.1.Description
The HEF4017B is a 5-stage Johnson decade counter with ten spike-free decoded active HIGH outputs (Oo to O9), an active LOW output from the most significant flip-flop (O59), active HIGH and active LOW clock inputs (CP0, CP1) and an overriding asynchronous master reset input (MR). The counter is advanced by either a LOW to HIGH transition at CP0 while CP1 is LOW or a HIGH to LOW transition at CP1 while CP0 is HIGH (see also function table). When cascading counters, the O5-9 output, which is LOW while the counter is in states 5, 6, 7, 8 and 9, can be used to drive the CP0 input of the next counter. A HIGH on MR resets the counter to zero (Oo = O5-9 = HIGH; O1 to O9 = LOW) independent of the clock inputs (CP0, CP1). Automatic code correction of the counter is provided by an internal circuit: following any illegal code the counter returns to a proper counting mode within 11 clock pulses. Schmitt-trigger action in the clock input makes the circuit highly tolerant to slower clock rise and fall times.

Figure 4.3.1

Figure 4.3.2

Figure 4.3.3

4.4. 6-Pin DIP Random-phase Optoisolators Triac driver output


4.4.1.Description

Figure 4.4.1

4.5. TRAICS
4.5.1.General Description Quick Reference Data
Glass passivated triacs in a plastic envelope, intended for use in applications requiring high bidirectional transient and blocking voltage capability and high thermal cycling performance. Applications include motor control, voltages industrial and domestic lighting, heating and static switching.

Figure 4.5.1

4.6

OPTOCOUPLER,

PHOTOTRANSISTOR

OUTPUT

WITH BASE CONNECTION


4.6.1.Features
Interfaces with common logic families Input-output coupling capacitance < 0.5 pF Industry Standard Dual-in line 6-pin package 5300 VRMS isolation test voltage

4.6.2.Applications
AC mains detection Reed relay driving Switch mode power supply feedback Telephone ring detection Logic ground isolation Logic coupling with high frequency noise rejection

4.6.3Description
Standard Single Channel Phototransistor Couplers. The MCT2/ MCTE family is an Industry Standard Single Channel Phototransistor. Each optocoupler consists of gallium arsenide infrared LED and a silicon NPN phototransistor. These couplers are Underwriters Laboratories (UL) listed to comply with a 5300 VRMS isolation test voltage.This isolation performance is accomplished through Vishay double molding isolation manufacturing process. Compliance to DIN EN 60747-5-2(VDE0884)/ DIN EN 60747-5-5 pending partial discharge isolation specification is available for these families by ordering option 1.These isolation processes and the Vishay ISO9001quality program results in the highest isolation performance available for a commercial plastic phototransistor optocoupler. The devices are available in lead formed configuration suitable for surface mounting and are available either on tape and reel, or in standard tube shipping containers.

Figure 4.6.1

Description:
Recent developments in drive electronics have allowed efficient and convenient speed control of these motors, where this has not traditionally been the case. The newest advancements allow for torque generation down to zero speed. This allows the polyphase AC induction motor to compete in areas where DC motors have long dominated, and presents an advantage in robustness of design, cost, and reduced maintenance. Variable frequency drives Phase vector drives Phase vector drives (or simply vector drives) are an improvement over variable frequency drives (VFDs) in that they separate the calculations of magnetizing current and torque generating current. These quantities are represented by phase vectors, and are combined to produce the driving phase vector which in turn is decomposed into the driving components of the output stage. These calculations need a fast microprocessor, typically a DSP device. Unlike a VFD, a vector drive is a closed loop system. It takes feedback on rotor position and phase currents. Rotor position can be obtained through an encoder, but is often sensed by the reverse EMF generated on the motor leads. In some configurations, a vector drive may be able to generate full rated motor torque at zero speed.

2.1.DIRECT TORQUE CONTROL DRIVES


Direct torque control has better torque control dynamics than the PI-current controller based vector control. Thus it suits better to servo control applications. However, it has some advantage over other control methods in other applications as well because due to the faster control it has better capabilities to damp mechanical resonances and thus extend the life of the mechanical system.

2.2. SCR OR THYRISTOR DRIVE


SCR controls for DC motors convert AC power to direct current, with adjustable voltage. Small DC drives are common in industry, running from line voltages, with motors rated at 90V for 120V line, and 180V for a 240V line. Larger drives, up to thousands of horsepower, are powered by three phase supplies and are used in such applications as rolling mills, paper machines, excavators, and ship propulsion. DC drivers are available in reversing and non-reversing models. The waveform of the current through the motor by a single-phase drive will have strong ripple components due to the switching at line frequency. This can be reduced by use of a polyphase supply or smoothing inductors in the motor circuit; otherwise the ripple currents produce motor heating, excess noise, and loss of motor torque.

2.3. PWM OR CHOPPER DRIVES


2.3.1. Pulse-width modulation
PWM controls use pulse width modulation to regulate the current sent to the motor. Unlike SCR controls which switch at line frequency, PWM controls produce smoother current at higher switching frequencies, typically between 1 and 20 kHz. At 20 kHz, the switching frequency is inaudible to humans, thereby eliminating the hum which switching at lower frequency produces. However, some motor controllers for radio controlled models make use of the motor to produce audible sound, most commonly simple beeps.

A PWM controller typically contains a large reservoir capacitor and an H-bridge arrangement of switching elements (thyristors, Mosfets, solid state relays, or transistors).

2.4.TRIAC
TRIAC, or Triode for Alternating Current is an electronic component approximately equivalent to two silicon-controlled rectifiers joined in inverse parallel (paralleled but with the polarity reversed) and with their gates connected together. The formal name for a TRIAC is bidirectional triode thyristor. This results in a bidirectional electronic switch which can conduct current in either direction when it is triggered (turned on) and thus doesn't have any polarity. It can be triggered by either a positive or a negative voltage being applied to its gate electrode (with respect to A1, otherwise known as MT1). Once triggered, the device continues to conduct until the current through it drops below a certain threshold value, the holding current, such as at the end of a half-cycle of alternating current (AC) mains power. This makes the TRIAC a very convenient switch for AC circuits, allowing the control of very large power flows with milliampere-scale control currents. In addition, applying a trigger pulse at a controllable point in an AC cycle allows one to control the percentage of current that flows through the TRIAC to the load (phase control).

2.4.1.Application
Low power TRIACs are used in many applications such as light dimmers, speed controls for electric fans and other electric motors, and in the modern computerized control circuits of many household small and major appliances. However, when used with inductive loads such as electric fans, care must be taken to assure that the TRIAC will turn off correctly at the end of each half-cycle of the AC power. A snubber circuit (usually of the RC type) is often used between A1 and A2 to assist this turn-off. Snubber circuits are also used to prevent premature triggering, caused for

example by voltage spikes in the mains supply. Also, a gate resistor or capacitor (or both in parallel) may be connected between gate and A1 to further prevent false triggering. That, however, increases the required trigger current and / or adds latency (capacitor charging). For higher-powered, more-demanding loads, two SCRs in inverse parallel may be used instead of one TRIAC. Because each SCR will have an entire half-cycle of reverse polarity voltage applied to it, turn-off of the SCRs is assured, no matter what the character of the load. However, due to the separate gates, proper triggering of the SCRs is more complex than triggering a TRIAC. In addition to commutation, a TRIAC may also not turn on reliably with non-resistive loads if the phase shift of the current prevents achieving holding current at trigger time. To overcome that, pulse trains may be used to repeatedly try to trigger the TRIAC until it finally turns on. The advantage is that the gate current does not need to be maintained throughout the entire conduction angle, which can be beneficial when there is only limited drive capability available.

Example data
Variable name Parameter Typical value Unit Vgt Gate threshold Voltage 1.5 V Igt Gate threshold Current 10 - 35 mA tgt Gate controlled turn-on time 2 s Vdrm Repetitive peak off-state Voltages 600-800 V It RMS on-state current Non-repetitive peak 4-16 A

Advantages:

Stage-wise speed control. System can be monitored and controlled wirelessly Easy to operate

Applications:
Process Industries Bottle filling industries Conveyers Home Applications

8. SOFTWARE DESCRIPTION
8.1 INTRODUCTION
PCB Designing Tools: ORCAD: ORCAD is a software tool suite used primarily for electronic design automation. The software is used mainly to create electronic prints for manufacturing of printed circuit boards, by electronic design engineers and electronic technicians to manufacture electronic schematics and diagrams, and for their simulation. CADSTAR: Cadstar is a Windows based EDA software for designing and creating Schematic Diagrams and Printed Circuit Boards. Coding Tools: C Language: The C programming language is a general purpose programming language that provides code efficiency, elements of structured programming , and a rich set of operators . C is not a big language and is not designed for any one particular area of application . Its generality combined with its absence of restrictions , makes C a convenient and effective programming solution for a wide variety of software tasks . Many applications can be solved more easily and efficiently with C than with other more specialized languages .

KEIL: Keil implemented the first C compiler designed from the ground-up specifically for the 8051 microcontroller. Keil provides a broad range of development tools like ANSI C compiler, macro assemblers, debuggers and simulators, linkers, IDE, library managers, real-time operating systems and evaluation boards for 8051.

MAIN CODE:
#include<reg52.h> sbit Data=P3^2; sbit FAN=P2^0; void delay(unsigned int); void main() { P2=0x01; while(1) { if(Data==0)

{ FAN=0; delay(10); } else { FAN=1; delay(10); } FAN=1; } } { P2=0x01; while(1) { if(Data==0) { FAN=0;

delay(10); } else { FAN=1; delay(10); } FAN=1; } } void delay(unsigned int time) { unsigned int i,j; for(i=0;i<time;i++) for(j=0;j<1275;j++); }

CONCLUSION: In this project work, we have studied and implemented a complete working model using a Microcontroller. The programming and interfacing of microcontroller has been mastered during the implementation. This work includes the study of induction motor. In this project, we have used IR transmitter and receiver for controlling the direction and angle of stepper motor. The stepper motor is used for position control in applications such as disk drives, dot matrix printers, industries, manufacturing companies and robotics.

Scopes for Advancements:

This system is developed for Infrared application only. It also can be interfaced to GSM or computer system to record and process data base.

REFERENCES: 1. WWW. howstuffworks.com 2. EMBEDDED SYSTEM BY RAJ KAMAL 3. 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS BY MAZZIDI 4. Magazines 5. Electronics for you 6. Electrikindia 7. www.google.com 8. www.electronic projects.com

Вам также может понравиться