You are on page 1of 97

A PROJECT REPORT ON

Electronic voting machine


Submitted in partial fulfillment of the requirements For the award of the degree BACHELOR OF ENGINEERING IN

____________________________________ENGINEERING

SUBMITTED BY -------------------- (--------------) --------------------- (--------------) --------------------- (---------------)

DEPARTMENT OF _______________________ ENGINEERING __________COLLEGE OF ENGINEERING AFFILIATED TO ___________ UNIVERSITY

CERTIFICATE

This is to certify that the dissertation work entitled Electronic voting machine

is the work done by_______________________________________________ submitted in partial (B.E) fulfillment in for the award of BACHELOR OF ENGINEERING

Electronics

and

Communication

Engineering

from_______ College of Engineering affiliated to _________ University, Hyderabad .

________________ (Head of the department, ECE)

____________ (Assistant Professor)

EXTERNAL EXAMINER

ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any task would be incomplete without the mentioning of the people whose constant guidance and encouragement made it possible. We take pleasure in presenting before you, our project, which is result of studied blend of both research and knowledge.

We express our earnest gratitude to our internal guide, Assistant Professor ______________, Department of ECE, our project guide, for his constant support, encouragement and guidance. We are grateful for his cooperation and his valuable suggestions.

Finally, we express our gratitude to all other members who are involved either directly or indirectly for the completion of this project.

DECLARATION

We, the undersigned, declare that the project entitled Electronic voting machine being submitted in partial fulfillment for the award of Bachelor of Engineering Degree in Electronics and Communication Engineering, affiliated to _________ University, is the work carried out by us.

__________ __________

_________ _________

_________ _________

CONTENTS

PAGE NO.

1. 2. 3. 4.

ABSTRACT INTRODUCTION TO EMBEDDED SYSTEMS BLOCK DIAGRAM OF PROJECT HARDWARE REQUIREMENTS 4.1 TRANSFORMER 4.2 VOLTAGE REGULATOR (LM7805) 4.3 RECTIFIER 4.4 FILTER 4.5 MICROCONTROLLER (AT89S52/C51) & MICROCONTROLLER (AT89C2051) 4.6 KEYPAD 4.7 RELAY 4.8 BC547 4.9 1N4007 4.10 LCD 4.12 LED 4.13 RESISTORS 4.14 CAPACITORS 5. SOFTWARE REQUIREMENTS

10 13

19

22

56 57 57 58 59
5

5.1 IDE 5.2 CONCEPT OF COMPILER 5.3 CONCEPT OF CROSS COMPILER 5.4 KEIL C CROSS COMPILER

5.5 BUILDING AN APPLICATION IN UVISION2

59

5.6 CREATING YOUR OWN APPLICATION IN UVISION2 59 5.7 DEBUGGING AN APPLICATION IN UVISION2 5.8 STARTING UVISION2 & CREATING A PROJECT 5.9 WINDOWS_ FILES 5.10 BUILDING PROJECTS & CREATING HEX FILES 5.11 CPU SIMULATION 5.12 DATABASE SELECTION 5.13 START DEBUGGING 5.14 DISASSEMBLY WINDOW 5.15 EMBEDDED C 6. SCHEMATIC DIAGRAM 6.1 DESCRIPTION 7. LAYOUT DIAGRAM 8. BILL OF MATERIALS 9. CODING 9.1 COMPILER 9.2 SOURCE CODE 10. HARDWARE TESTING 10.1 CONTINUITY TEST 10.2 POWER ON TEST 11. RESULTS 12. CONCLUSION 13. BIBLIOGRAPHY 69 93 94 84 88 88 89 75 76 71 72 60 61 61 61 62 62 63 63 64 66 67

LIST OF FIGURES

PAGE NO.

1(a) EMBEDDED DESIGN CALLS 2 BLOCK DIAGRAM OF THE PROJECT 4.1(a) BLOCK DIAGRAM OF VOLTAGE REGULATOR 4.1(c) RATING OF VOLTAGE REGULATOR 4.1(c) PERFORMANCE CHARACTERISTICS OF VOLTAGE REGULATOR 4.2(a) BLOCK DIAGRAM OF AT89S52 4.2(b) PIN DIAGRAM OF AT89S52 4.2(c) OSCILLATOR CONNECTIONS 4.2(d) EXTERNAL CLOCK DRIVE CONFIG. 4.4 TABLE FOR TYPES OF PUSH BUTTONS 4.5(a) L293D PIN DIAGRAM 4.5(b) BLOCK DIAGRAM OF L293D

19

21 24 25 29 30

Abstract:

According to Election Data Services the percentage of electronic voting machines per county doubled between 1998 and 2002 to 16 percent-, yet a full replacement of the traditional voting procedure is very unlikely. In its essence, an electronic voting machine is a computer assisted self-interviewing device (CASI) giving the voter the opportunity to review and change his/her vote before submitting it. The different types of voting machines allow for different kinds of interaction, such as using a touch screen technology, using a dial wheel, touching a paper
7

panel, or pressing a button on an LCD screen. Each machine provides feedback for blank ballots and under-voting and prevents selecting more choices than the maximum allowed. Some machines even have advanced functions such as increasing the font for visually impaired voters and/or allowing for listening of the voting options rather than reading. The common features electronic voting machines share with CASI and ACASI devices allow for theoretical and empirical predictions of the advantages and disadvantages this technology can provide. The paper presents an overview of the different types of voting machines and based on established theories and results from CASI and ACASI studies, examines and compares characteristics of the machines currently used and computer-human interaction mechanisms, their potential effects, and unexplored applications. Furthermore, possibilities such as prediction of candidates name order effect, already existing in the literature, and computer literacy effect on voting are discussed.

10

Block Diagram

11

12

Circuit Diagram

13

14

15

EMBEDDED SYSTEMS Introduction: An embedded system is a system which is going to do a predefined specified task is the embedded system and is even defined as combination of both software and hardware. A generalpurpose definition of embedded systems is that they are devices used to control, monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the fact that they are an integral part of the system. At the other extreme a general-purpose computer may be used to control the operation of a large complex processing plant, and its presence will be obvious. All embedded systems are including computers or microprocessors. Some of these computers are however very simple systems as compared with a personal computer. The very simplest embedded systems are capable of performing only a single function or set of functions to meet a single predetermined purpose. In more complex systems an application program that enables the embedded system to be used for a particular purpose in a specific application determines the functioning of the embedded system. The ability to have programs means that the same embedded system can be used for a variety of different purposes. In some cases a microprocessor may be designed in such a way that application software for a particular purpose can be added to the basic software in a second process, after which it is not possible to make further changes. The applications software on such processors is sometimes referred to as firmware. The simplest devices consist of a single microprocessor (often called a "chip), which may itself be packaged with other chips in a hybrid system or Application Specific Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a switch or activator which (for example) may start or stop the operation of a machine or, by operating a valve, may control the flow of fuel to an engine. As the embedded system is the combination of both software and hardware

16

Embedded System

Software

Hardware

o o o

ALP C VB Etc.,

o o o

Processor Peripherals memory

Figure: Block diagram of Embedded System Software deals with the languages like ALP, C, and VB etc., and Hardware deals with Processors, Peripherals, and Memory. Memory: It is used to store data or address. Peripherals: These are the external devices connected Processor: It is an IC which is used to perform some task Applications of embedded systems Manufacturing and process control Construction industry Transport Buildings and premises Domestic service Communications Office systems and mobile equipment Banking, finance and commercial Medical diagnostics, monitoring and life support Testing, monitoring and diagnostic systems
17

Processors are classified into four types like: Micro Processor (p) Micro controller (c) Digital Signal Processor (DSP) Application Specific Integrated Circuits (ASIC) Micro Processor (p): A siliconchip that contains a CPU. In the world of personal computers, the terms microprocessor and CPU are used interchangeably. At the heart of all personal computers and most workstations sits a microprocessor. Microprocessors also control the logic of almost all digitaldevices, from clock radios to fuel-injection systems for automobiles. Three basic characteristics differentiate microprocessors: Instruction set: The set of instructions that the microprocessor can execute. Bandwidth: The number of bits processed in a single instruction. Clock speed: Given in megahertz (MHz), the clock speed determines how many instructions per second the processor can execute. In both cases, the higher the value, the more powerful the CPU. For example, a 32-bit microprocessor that runs at 50MHz is more powerful than a 16-bit microprocessor that runs at 25MHz. In addition to bandwidth and clock speed, microprocessors are classified as being either RISC (reduced instruction set computer) or CISC (complex instruction set computer). A microprocessor has three basic elements, as shown above. The ALU performs all arithmetic computations, such as addition, subtraction and logic operations (AND, OR, etc). It is controlled by the Control Unit and receives its data from the Register Array. The Register Array is a set of registers used for storing data. These registers can be accessed by the ALU very quickly. Some registers have specific functions - we will deal with these later. The Control Unit controls the entire process. It provides the timing and a control signal for getting data into and out of the registers and the ALU and it synchronizes the execution of instructions (we will deal with instruction execution at a later date).

18

Three Basic Elements of a Microprocessor Micro Controller (c): A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications.

ALU CU Memory

Timer, Counter,serial communication ROM, ADC, DAC, Timers, USART, Oscillators

Figure: Block Diagram of Micro Controller (c)

Etc., 19

Digital Signal Processors (DSPs): Digital Signal Processors is one which performs scientific and mathematical operation. Digital Signal Processor chips - specialized microprocessors with architectures designed specifically for the types of operations required in digital signal processing. Like a generalpurpose microprocessor, a DSP is a programmable device, with its own native instruction code. DSP chips are capable of carrying out millions of floating point operations per second, and like their better-known general-purpose cousins, faster and more powerful versions are continually being introduced. DSPs can also be embedded within complex "system-on-chip" devices, often containing both analog and digital circuitry. Application Specific Integrated Circuit (ASIC) ASIC is a combination of digital and analog circuits packed into an IC to achieve the desired control/computation function ASIC typically contains CPU cores for computation and control Peripherals to control timing critical functions Memories to store data and program Analog circuits to provide clocks and interface to the real world which is analog in nature I/Os to connect to external components like LEDs, memories, monitors etc. Computer Instruction Set There are two different types of computer instruction set there are: 1. RISC (Reduced Instruction Set Computer) and 2. CISC (Complex Instruction Set computer) Reduced Instruction Set Computer (RISC) A RISC (reduced instruction set computer) is a microprocessor that is designed to perform a smaller number of types of computer instruction so that it can operate at a higher speed (perform more million instructions per second, or millions of instructions per second). Since each instruction type that a computer must perform requires additional transistors and circuitry, a
20

larger list or set of computer instructions tends to make the microprocessor more complicated and slower in operation. Besides performance improvement, some advantages of RISC and related design improvements are: A new microprocessor can be developed and tested more quickly if one of its aims is to be less complicated. Operating system and application programmers who use the microprocessor's instructions will find it easier to develop code with a smaller instruction set. The simplicity of RISC allows more freedom to choose how to use the space on a microprocessor. Higher-level language compilers produce more efficient code than formerly because they have always tended to use the smaller set of instructions to be found in a RISC computer. RISC characteristics Simple instruction set: In a RISC machine, the instruction set contains simple, basic instructions, from which more complex instructions can be composed. Same length instructions. Each instruction is the same length, so that it may be fetched in a single operation. 1 machine-cycle instructions. Most instructions complete in one machine cycle, which allows the processor to handle several instructions at the same time. This pipelining is a key technique used to speed up RISC machines. Complex Instruction Set Computer (CISC) CISC, which stands for Complex Instruction Set Computer, is a philosophy for designing chips that are easy to program and which make efficient use of memory. Each instruction in a CISC instruction set might perform a series of operations inside the processor. This reduces the number of instructions required to implement a given program, and allows the programmer to learn a small but flexible set of instructions.
21

The advantages of CISC At the time of their initial development, CISC machines used available technologies to optimize computer performance. Microprogramming is as easy as assembly language to implement, and much less expensive than hardwiring a control unit. The ease of micro-coding new instructions allowed designers to make CISC machines upwardly compatible: a new computer could run the same programs as earlier computers because the new computer would contain a superset of the instructions of the earlier computers. As each instruction became more capable, fewer instructions could be used to implement a given task. This made more efficient use of the relatively slow main memory. Because micro program instruction sets can be written to match the constructs of high-level languages, the compiler does not have to be as complicated. The disadvantages of CISC Still, designers soon realized that the CISC philosophy had its own problems, including: Earlier generations of a processor family generally were contained as a subset in every new version --- so instruction set & chip hardware become more complex with each generation of computers. So that as many instructions as possible could be stored in memory with the least possible wasted space, individual instructions could be of almost any length---this means that different instructions will take different amounts of clock time to execute, slowing down the overall performance of the machine. Many specialized instructions aren't used frequently enough to justify their existence --approximately 20% of the available instructions are used in a typical program. CISC instructions typically set the condition codes as a side effect of the instruction. Not only does setting the condition codes take time, but programmers have to remember to examine the condition code bits before a subsequent instruction changes them.

Memory Architecture

22

There two different types memory architectures there are: Harvard Architecture Von-Neumann Architecture Harvard Architecture Computers have separate memory areas for program instructions and data. There are two or more internal data buses, which allow simultaneous access to both instructions and data. The CPU fetches program instructions on the program memory bus. The Harvard architecture is a computer architecture with physically separate storage and signal pathways for instructions and data. The term originated from the Harvard Mark I relay-based computer, which stored instructions on punched tape (24 bits wide) and data in electromechanical counters. These early machines had limited data storage, entirely contained within the central processing unit, and provided no access to the instruction storage as data. Programs needed to be loaded by an operator, the processor could not bootitself.

Figure: Harvard Architecture

Modern uses of the Harvard architecture


The principal advantage of the pure Harvard architecture - simultaneous access to more than one memory system - has been reduced by modified Harvard processors using modern CPU cache systems. Relatively pure Harvard architecture machines are used mostly in applications where tradeoffs, such as the cost and power savings from omitting caches, outweigh the programming penalties from having distinct code and data address spaces.
23

Digital signal processors (DSPs) generally execute small, highly-optimized audio or video processing algorithms. They avoid caches because their behavior must be extremely reproducible. The difficulties of coping with multiple address spaces are of secondary concern to speed of execution. As a result, some DSPs have multiple data memories in distinct address spaces to facilitate SIMD and VLIW processing. Texas Instruments TMS320 C55x processors, as one example, have multiple parallel data busses (two write, three read) and one instruction bus. Microcontrollers are characterized by having small amounts of program (flash memory) and data (SRAM) memory, with no cache, and take advantage of the Harvard architecture to speed processing by concurrent instruction and data access. The separate storage means the program and data memories can have different bit depths, for example using 16-bit wide instructions and 8-bit wide data. They also mean that instruction pre-fetch can be performed in parallel with other activities. Examples include, the AVR by Atmel Corp, the PIC by Microchip Technology, Inc. and the ARM Cortex-M3 processor (not all ARM chips have Harvard architecture). Even in these cases, it is common to have special instructions to access program memory as data for read-only tables, or for reprogramming.

Von-Neumann Architecture A computer has a single, common memory space in which both program instructions and data are stored. There is a single internal data bus that fetches both instructions and data. They cannot be performed at the same time The Von Neumann architecture is a design model for a stored-program digital computer that uses a central processing unit (CPU) and a single separate storage structure ("memory") to hold both instructions and data. It is named after the mathematician and early computer scientistJohn von Neumann. Such computers implement a universal Turing machine and have a sequential architecture. A stored-programdigital computer is one that keeps its programmed instructions, as well as its data, in read-write, random-access memory (RAM). Stored-program computers were
24

advancement over the program-controlled computers of the 1940s, such as the Colossus and the ENIAC, which were programmed by setting switches and inserting patch leads to route data and to control signals between various functional units. In the vast majority of modern computers, the same memory is used for both data and program instructions. The mechanisms for transferring the data and instructions between the CPU and memory are, however, considerably more complex than the original von Neumann architecture. The terms "von Neumann architecture" and "stored-program computer" are generally used interchangeably, and that usage is followed in this article.

Figure: Schematic of the Von-Neumann Architecture. Basic Difference between Harvard and Von-Neumann Architecture The primary difference between Harvard architecture and the Von Neumann architecture is in the Von Neumann architecture data and programs are stored in the same memory and managed by the same information handling system. Whereas the Harvard architecture stores data and programs in separate memory devices and they are handled by different subsystems.

25

In a computer using the Von-Neumann architecture without cache; the central processing unit (CPU) can either be reading and instruction or writing/reading data to/from the memory. Both of these operations cannot occur simultaneously as the data and instructions use the same system bus. In a computer using the Harvard architecture the CPU can both read an instruction and access data memory at the same time without cache. This means that a computer with Harvard architecture can potentially be faster for a given circuit complexity because data access and instruction fetches do not contend for use of a single memory pathway. Today, the vast majority of computers are designed and built using the Von Neumann architecture template primarily because of the dynamic capabilities and efficiencies gained in designing, implementing, operating one memory system as opposed to two. Von Neumann architecture may be somewhat slower than the contrasting Harvard Architecture for certain specific tasks, but it is much more flexible and allows for many concepts unavailable to Harvard architecture such as self programming, word processing and so on. Harvard architectures are typically only used in either specialized systems or for very specific uses. It is used in specialized digital signal processing (DSP), typically for video and audio processing products. It is also used in many small microcontrollers used in electronics applications such as Advanced RISK Machine (ARM) based products for many vendors.

26

27

Introduction of the Project

28

A remote control is a component of an electronics device, most commonly a television set, DVD player and home theater systems originally used for operating the television

device wirelessly from a short line-of-sight distance. Remote control has continually evolved and advanced over recent years to include Bluetooth connectivity, motion sensor enabled capabilities and voice control.[1][2] The main remote control technology used in the home is infrared. The signal between a remote control handset and the device it is controlling are infrared pulses, which are invisible to the human eye. The transmitter in the remote control handset sends out a pulse of infrared light when a button is pressed on the handset. A transmitter is often a light emitting diode (LED) which is built into the pointing end of the remote control handset. The infrared light pulse represents a binary code that corresponds to a certain command, such as (power on). The receiver passes the code to a microprocessor, which decodes it and carries out the command. The remote control is usually contracted to remote. It is known by many other names as well, such as converter, clicker, the box, flipper, hoofer-doffer, the tuner, 'the zapper', the changer, orthe button. Commonly, remote controls are Consumer IR devices used to issue commands from a distance to televisions or other consumer electronics such

as stereo systems, DVD players anddimmers. Remote controls for these devices are usually small wireless handheld objects with an array of buttons for adjusting various settings such as television channel, track number, andvolume. In fact, for the majority of modern devices with this kind of control, the remote contains all the function controls while the controlled device itself only has a handful of essential primary controls. Most of these remotes communicate to their respective devices via infrared (IR) signals and a few via radio signals. Earlier remote controls in the 1970s used ultrasonic tones. Television IR signals can be mimicked by a universal remote, which is able to emulate the functionality of most major brand television remote controls.

29

Block Diagram Explanation:


30

When we give the signal from remote the IR Sensor receives the singal and it passes to switching transistor CD4017 is a CMOS Decade counter. It can detect a clock pulse and the BCD out put will be incremented by one for each CLK pulse. If we observe the BCD numbers, the LSB (Least Significant Bit) of BCD complemented every time. This project uses this LSB to switch ON / OFF an electrical appliance. TSOP1738 is a high sensitive IR receiver which can sense 38 KHz IR light. The electrolytic capacitor (100F) connected across pin nos 3 and 1 of TSOP1738 for medium sensitivity. The NPN transistor BC557 is connected as a switch. Whenever an IR signal is detected, the transition is sensed by the PNP transistor and it supplies a CLK pulse to the BCD counter (CD4017). For every clock pulse the LSB (Least Significant Bit) of the BCD output is complemented. This toggling output is given to an NPN transistor through a base resistor. If logic 0 is applied to the transistor, it will be driven into cut-off region. As the collector current is zero in cut-off region, the relay will not be energized and the electrical appliance will be in OFF mode. If logic 1 is applied to the transistor, it will be driven into saturation region. As the collector current is high in saturation region, the relay will be energized and the electrical appliance will be in ON mode. A diode is connected across the relay to protect the transistor by neutralizing the reverse EMF generated by the electromagnetic relay. An LED connected at pin no.2 of CD4017 to indicate the ON condition of the LOAD. An LED connected at pin no.3 of CD4017 to indicate the OFF condition of the LOAD.

31

32

Hardware Explanation : Block Diagram For Regulated Power Supply(RPS):

Figure: Power Supply Description Transformer A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual induction.

Figure: Transformer Symbol (or) Transformer is a device that converts the one form energy to another form of energy like a transducer.
33

Figure: Transformer Basic Principle A transformer makes use of Faraday's law and the ferromagnetic properties of an iron core to efficiently raise or lower AC voltages. It of course cannot increase power so that if the voltage is raised, the current is proportionally lowered and vice versa.

34

Figure: Basic Principle Transformer Working A transformer consists of two coils (often called 'windings') linked by an iron core, as shown in figure below. There is no electrical connection between the coils; instead they are linked by a magnetic field created in the core.

Figure: Basic Transformer


35

Transformers are used to convert electricity from one voltage to another with minimal loss of power. They only work with AC (alternating current) because they require a changing magnetic field to be created in their core. Transformers can increase voltage (step-up) as well as reduce voltage (step-down). Alternating current flowing in the primary (input) coil creates a continually changing magnetic field in the iron core. This field also passes through the secondary (output) coil and the changing strength of the magnetic field induces an alternating voltage in the secondary coil. If the secondary coil is connected to a load the induced voltage will make an induced current flow. The correct term for the induced voltage is 'induced electromotive force' which is usually abbreviated to induced e.m.f. The iron core is laminated to prevent 'eddy currents' flowing in the core. These are currents produced by the alternating magnetic field inducing a small voltage in the core, just like that induced in the secondary coil. Eddy currents waste power by needlessly heating up the core but they are reduced to a negligible amount by laminating the iron because this increases the electrical resistance of the core without affecting its magnetic properties. Transformers have two great advantages over other methods of changing voltage: 1. They provide total electrical isolation between the input and output, so they can be safely used to reduce the high voltage of the mains supply. 2. Almost no power is wasted in a transformer. They have a high efficiency (power out / power in) of 95% or more. Classification of Transformer Step-Up Transformer Step-Down Transformer Step-Down Transformer Step down transformers are designed to reduce electrical voltage. Their primary voltage is greater than their secondary voltage. This kind of transformer "steps down" the voltage applied
36

to it. For instance, a step down transformer is needed to use a 110v product in a country with a 220v supply. Step down transformers convert electrical voltage from one level or phase configuration usually down to a lower level. They can include features for electrical isolation, power distribution, and control and instrumentation applications. Step down transformers typically rely on the principle of magnetic induction between coils to convert voltage and/or current levels. Step down transformers are made from two or more coils of insulated wire wound around a core made of iron. When voltage is applied to one coil (frequently called the primary or input) it magnetizes the iron core, which induces a voltage in the other coil, (frequently called the secondary or output). The turns ratio of the two sets of windings determines the amount of voltage transformation.

Figure: Step-Down Transformer An example of this would be: 100 turns on the primary and 50 turns on the secondary, a ratio of 2 to 1. Step down transformers can be considered nothing more than a voltage ratio device. With step down transformers the voltage ratio between primary and secondary will mirror the "turns ratio" (except for single phase smaller than 1 kva which have compensated secondary). A practical application of this 2 to 1 turns ratio would be a 480 to 240 voltage step down. Note that if the input were 440 volts then the output would be 220 volts. The ratio between input and output voltage will stay constant. Transformers should not be operated at voltages higher than
37

the nameplate rating, but may be operated at lower voltages than rated. Because of this it is possible to do some non-standard applications using standard transformers. Single phase step down transformers 1 kva and larger may also be reverse connected to stepdown or step-up voltages. (Note: single phase step up or step down transformers sized less than 1 KVA should not be reverse connected because the secondary windings have additional turns to overcome a voltage drop when the load is applied. If reverse connected, the output voltage will be less than desired.) Step-Up Transformer A step up transformer has more turns of wire on the secondary coil,which makes a larger induced voltage in the secondary coil.It is called a step up transformer because the voltage output is larger than the voltage input. Step-up transformer 110v 220v design is one whose secondary voltage is greater than its primary voltage. This kind of transformer "steps up" the voltage applied to it. For instance, a step up transformer is needed to use a 220v product in a country with a 110v supply. A step up transformer 110v 220v converts alternating current (AC) from one voltage to another voltage. It has no moving parts and works on a magnetic induction principle; it can be designed to "step-up" or "step-down" voltage. So a step up transformer increases the voltage and a step down transformer decreases the voltage. The primary components for voltage transformation are the step up transformer core and coil. The insulation is placed between the turns of wire to prevent shorting to one another or to ground. This is typically comprised of Mylar, nomex, Kraft paper, varnish, or other materials. As a transformer has no moving parts, it will typically have a life expectancy between 20 and 25 years.

38

Figure: Step-Up Transformer Applications Generally these Step-Up Transformers are used in industries applications only. Types of Transformer Mains Transformers Mains transformers are the most common type. They are designed to reduce the AC mains supply voltage (230-240V in the UK or 115-120V in some countries) to a safer low voltage. The standard mains supply voltages are officially 115V and 230V, but 120V and 240V are the values usually quoted and the difference is of no significance in most cases.

Figure: Main Transformer To allow for the two supply voltages mains transformers usually have two separate primary coils (windings) labeled 0-120V and 0-120V. The two coils are connected in series for 240V (figure 2a) and in parallel for 120V (figure 2b). They must be wired the correct way round as shown in the diagrams because the coils must be connected in the correct sense (direction):

39

Most mains transformers have two separate secondary coils (e.g. labeled 0-9V, 0-9V) which may be used separately to give two independent supplies, or connected in series to create a centretapped coil (see below) or one coil with double the voltage. Some mains transformers have a centre-tap halfway through the secondary coil and they are labeled 9-0-9V for example. They can be used to produce full-wave rectified DC with just two diodes, unlike a standard secondary coil which requires four diodes to produce full-wave rectified DC.

A mains transformer is specified by: 1. Its secondary (output) voltages Vs. 2. Its maximum power, Pmax, which the transformer can pass, quoted in VA (volt-amp). This determines the maximum output (secondary) current, Imax...

...where Vs is the secondary voltage. If there are two secondary coils the maximum power should be halved to give the maximum for each coil.
40

3. Its construction - it may be PCB-mounting, chassis mounting (with solder tag connections) or toroidal (a high quality design). Audio Transformers Audio transformers are used to convert the moderate voltage, low current output of an audio amplifier to the low voltage, high current required by a loudspeaker. This use is called 'impedance matching' because it is matching the high impedance output of the amplifier to the low impedance of the loudspeaker.

Figure: Audio transformer Radio Transformers Radio transformers are used in tuning circuits. They are smaller than mains and audio transformers and they have adjustable ferrite cores made of iron dust. The ferrite cores can be adjusted with a non-magnetic plastic tool like a small screwdriver. The whole transformer is enclosed in an aluminum can which acts as a shield, preventing the transformer radiating too much electrical noise to other parts of the circuit.

Figure: Radio Transformer

41

Turns Ratio and Voltage The ratio of the number of turns on the primary and secondary coils determines the ratio of the voltages...

...where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the number of turns on the primary coil, and Ns is the number of turns on the secondary coil. Diodes Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol shows the direction in which the current can flow. Diodes are the electrical version of a valve and early diodes were actually called valves.

Figure: Diode Symbol A diode is a device which only allows current to flow through it in one direction. In this direction, the diode is said to be 'forward-biased' and the only effect on the signal is that there will be a voltage loss of around 0.7V. In the opposite direction, the diode is said to be 'reversebiased' and no current will flow through it.

42

Rectifier The purpose of a rectifier is to convert an AC waveform into a DC waveform (OR) Rectifier converts AC current or voltages into DC current or voltage. There are two different rectification circuits, known as 'half-wave' and 'full-wave' rectifiers. Both use components called diodes to convert AC into DC. The Half-wave Rectifier The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as shown in figure.

Figure: Half Wave Rectifier Figure 2 shows the AC input waveform to this circuit and the resulting output. As you can see, when the AC input is positive, the diode is forward-biased and lets the current through. When the AC input is negative, the diode is reverse-biased and the diode does not let any current through, meaning the output is 0V. Because there is a 0.7V voltage loss across the diode, the peak output voltage will be 0.7V less than Vs.

43

Figure: Half-Wave Rectification While the output of the half-wave rectifier is DC (it is all positive), it would not be suitable as a power supply for a circuit. Firstly, the output voltage continually varies between 0V and Vs0.7V, and secondly, for half the time there is no output at all. The Full-wave Rectifier The circuit in figure 3 addresses the second of these problems since at no time is the output voltage 0V. This time four diodes are arranged so that both the positive and negative parts of the AC waveform are converted to DC. The resulting waveform is shown in figure 4.

44

Figure: Full-Wave Rectifier

Figure: Full-Wave Rectification When the AC input is positive, diodes A and B are forward-biased, while diodes C and D are reverse-biased. When the AC input is negative, the opposite is true - diodes C and D are forward-biased, while diodes A and B are reverse-biased. While the full-wave rectifier is an improvement on the half-wave rectifier, its output still isn't suitable as a power supply for most circuits since the output voltage still varies between 0V and Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out. Capacitor Filter The capacitor-input filter, also called "Pi" filter due to its shape that looks like the Greek letterpi, is a type of electronic filter. Filter circuits are used to remove unwanted or undesired frequencies from a signal.

45

Figure: Capacitor Filter A typical capacitor input filter consists of a filter capacitor C1, connected across the rectifier output, an inductor L, in series and another filter capacitor connected across the load. 1. The capacitor C1 offers low reactance to the AC component of the rectifier output while it offers infinite reactance to the DC component. As a result the capacitor shunts an appreciable amount of the AC component while the DC component continues its journey to the inductor L 2. The inductor L offers high reactance to the AC component but it offers almost zero reactance to the DC component. As a result the DC component flows through the inductor while the AC component is blocked. 3. The capacitor C2 bypasses the AC component which the inductor had failed to block. As a result only the DC component appears across the load RL.

Figure: Centered Tapped Full-Wave Rectifier with a Capacitor Filter

46

Voltage Regulator A voltage regulator is an electricalregulator designed to automatically maintain a constant voltage level. It may use an electromechanical mechanism, or passive or active electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. There are two types of regulator are they. Positive Voltage Series (78xx) and Negative Voltage Series (79xx) 78xx: 78 indicate the positive series and xxindicates the voltage rating. Suppose 7805 produces the maximum 5V.05indicates the regulator output is 5V. 79xx: 78 indicate the negative series and xxindicates the voltage rating. Suppose 7905 produces the maximum -5V.05indicates the regulator output is -5V. These regulators consists the three pins there are Pin1: It is used for input pin. Pin2: This is ground pin for regulator Pin3: It is used for output pin. Through this pin we get the output.

47

Figure: Regulator

Relays
A relay is used to isolate one electrical circuit from another. It allows a low current control circuit to make or break an electrically isolated high current circuit path. The basic relay consists of a coil and a set of contacts. The most common relay coil is a length of magnet wire wrapped around a metal core. When voltage is applied to the coil, current passes through the wire and creates a magnetic field. This magnetic field pulls the contacts together and holds them there until the current flow in the coil has stopped. The diagram below shows the parts of a simple relay.

Figure: Relay Operation: When a current flows through the coil, the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact. When the current is switched off, the armature is usually returned by a spring to its resting position shown in figure 6.6(b). Latching relays exist that require operation of a second coil to reset the contact position. By analogy with the functions of the original electromagnetic device, a solid-state relay operates a thyristor or other solid-state switching device with a transformer or light-emitting diode to trigger it.
48

Pole and throw SPST SPST relay stands for Single Pole Single Throw relay. Current will only flow through the contacts when the relay coil is energized.

Figure: SPST Relay SPDT Relay SPDT Relay stands for Single Pole Double Throw relay.Current will flow between the movable contact and one fixed contact when the coil is De-energized and between the movable contact and the alternate fixed contact when the relay coil is energized. The most commonly used relay in car audio, the Bosch relay, is a SPDT relay.

Figure: SPDT Relay DPST Relay


49

DPST relay stands for Double Pole Single Throw relay. When the relay coil is energized, two separate and electrically isolated sets of contacts are pulled down to make contact with their stationary counterparts. There is no complete circuit path when the relay is De-energized.

Figure: DPST Relay DPDT Relay DPDT relay stands for Double Pole Double Throw relay. It operates like the SPDT relay but has twice as many contacts. There are two completely isolated sets of contacts.

Figure: DPDT Relay This is a 4 Pole Double Throw relay. It operates like the SPDT relay but it has 4 sets of isolated contacts.

50

Figure: 4 Pole Double Throw relay Types of relay: 1. Latching Relay 2. Reed Relay 3. Mercury Wetted Relay 4. Machine Tool Relay 5. Solid State Relay (SSR) Latching relay Latching relay, dust cover removed, showing pawl and ratchet mechanism. The ratchet operates a cam, which raises and lowers the moving contact arm, seen edge-on just below it. The moving and fixed contacts are visible at the left side of the image. A latching relay has two relaxed states (bi-stable). These are also called "impulse", "keep", or "stay" relays. When the current is switched off, the relay remains in its last state. This is achieved with a solenoid operating a ratchet and cam mechanism, or by having two opposing coils with an over-center spring or permanent magnet to hold the armature and contacts in position while the coil is relaxed, or with a remanent core. In the ratchet and cam example, the first pulse to the coil turns the relay on and the second pulse turns it off. In the two coil example, a pulse to one coil turns the relay on and a pulse to the opposite coil turns the relay off. This type of relay has the
51

advantage that it consumes power only for an instant, while it is being switched, and it retains itslast setting across a power outage. A remnant core latching relay requires a current pulse of opposite polarity to make it change state.

Figure: Latching relay Reed relay A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which protects the contacts against atmospheric corrosion. The contacts are closed by a magnetic field generated when current passes through a coil around the glass tube. Reed relays are capable of faster switching speeds than larger types of relays, but have low switch current and voltage ratings.

Mercury-wetted Relay
A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with mercury. Such relays are used to switch low-voltage signals (one volt or less) because of their low contact resistance, or for high-speed counting and timing applications where the mercury eliminates contact bounce. Mercury wetted relays are position-sensitive and must be mounted vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays are rarely specified for new equipment. See also mercury switch.

Machine tool relay


A machine tool relay is a type standardized for industrial control of machine tools, transfer machines, and other sequential control. They are characterized by a large number of contacts
52

(sometimes extendable in the field) which are easily converted from normally-open to normallyclosed status, easily replaceable coils, and a form factor that allows compactly installing many relays in a control panel. Although such relays once were the backbone of automation in such industries as automobile assembly, the programmable logic controller (PLC) mostly displaced the machine tool relay from sequential control applications. Solid-state relay A solid state relay (SSR) is a solid state electronic component that provides a similar function to an electromechanical relay but does not have any moving components, increasing long-term reliability. With early SSR's, the tradeoff came from the fact that every transistor has a small voltage drop across it. This voltage drop limited the amount of current a given SSR could handle. As transistors improved, higher current SSR's, able to handle 100 to 1,200 Amperes, have become commercially available. Compared to electromagnetic relays, they may be falsely triggered by transients.

Figure: Solid relay, which has no moving parts Specification


Number and type of contacts normally open, normally closed, (double-throw) Contact sequence "Make before Break" or "Break before Make". For example, the old style telephone exchanges required Make-before-break so that the connection didn't get dropped while dialing the number.

Rating of contacts small relays switch a few amperes, large contactors are rated for up to 3000 amperes, alternating or direct current
53

Voltage rating of contacts typical control relays rated 300 VAC or 600 VAC, automotive types to 50 VDC, special high-voltage relays to about 15 000 V Coil voltage machine-tool relays usually 24 VAC, 120 or 250 VAC, relays for switchgear may have 125 V or 250 VDC coils, "sensitive" relays operate on a few milliamperes

Applications: Relays are used: To control a high-voltage circuit with a low-voltage signal, as in some types of modems, To control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile, To detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers (protection relays), To isolate the controlling circuit from the controlled circuit when the two are at different potentials, for example when controlling a mains-powered device from a low-voltage switch. The latter is often applied to control office lighting as the low voltage wires are easily installed in partitions, which may be often moved as needs change. They may also be controlled by room occupancy detectors in an effort to conserve energy, To perform logic functions. For example, the boolean AND function is realized by connecting relay contacts in series, the OR function by connecting contacts in parallel. Due to the failure modes of a relay compared with a semiconductor, they are widely used in safety critical logic, such as the control panels of radioactive waste handling machinery. As oscillators, also called vibrators. The coil is wired in series with the normally closed contacts. When a current is passed through the relay coil, the relay operates and opens the contacts that carry the supply current. This stops the current and causes the contacts to close again. The cycle repeats continuously, causing the relay to open and close rapidly. Vibrators are used to generate pulsed current.

54

To generate sound. A vibrator, described above, creates a buzzing sound because of the rapid oscillation of the armature. This is the basis of the electric bell, which consists of a vibrator with a hammer attached to the armature so it can repeatedly strike a bell. To perform time delay functions. Relays can be used to act as an mechanical time delay device by controlling the release time by using the effect of residual magnetism by means of a inserting copper disk between the armature and moving blade assembly.

DECODE COUNTER :
CD4017 is a CMOS Decade counter. It can detect a clock pulse and the BCD out put will be incremented by one for each CLK pulse. If we observe the BCD numbers, the LSB (Least Significant Bit) of BCD complemented every time. This project uses this LSB to switch ON / OFF an electrical appliance. Decode counters have many uses in digital electronics circuits : They are for Example: for dividing pulse counter , multiplexing and in wide variety of involving counting and displaying.

55

What its made of? An integrated circuits (Ic) consisting of silicon chip in a plastic 16 pin package.TheIc has 10 outputs,a clock input and enable and reset pins.The enable and reset facilities are controlled by taking to either logic 1 or logic 0. How it works? When a clock signal (square wave pulse train) is provide at pin 14(clk input) , each of the other 10 output pins goes to logic 1 inturn.At any time only one output pin can be at logic 1: all others remains at logic 0.If LEDs were connected to each output each to light up inturn. If there were placed in a straight row in the correct sequence the effect would be for a ripple of light to run through the row.

56

How you use it? The cmos 4017 must be connected to an external clock such as a 555 timer in astable mode .The output pins are not arranged around the Ic in a linear sequence.

INTRODUCTION TO SENSORS

57

What is sensor?
Sensors are sophisticated devices that are frequently used to detect and respond to electrical or optical signals. A Sensor converts the physical parameter (for example: temperature, blood pressure, humidity, speed, etc.) into a signal which can be measured electrically. Lets explain the example of temperature. The mercury in the glass thermometer expands and contracts the liquid to convert the measured temperature which can be read by a viewer on the calibrated glass tube.
58

Criteria to choose a Sensor


There are certain features which have to be considered when we choose a sensor. They are as given below: 1. Accuracy 2. Environmental condition - usually has limits for temperature/ humidity 3. Range - Measurement limit of sensor 4. Calibration - Essential for most of the measuring devices as the readings changes with time 5. Resolution - Smallest increment detected by the sensor 6. Cost 7. Repeatability - The reading that varies is repeatedly measured under the same environment

DIFFERENT TYPES OF SENSORS:


1. Temperature sensor 2. Vibration sensor 3. Magnetic sensor 4. IR Sensor

Explanation of Each Sensor:


1. Temperature sensor:
59

An analog temperature sensor is pretty easy to explain, its a chip that tells you what the ambient temperature is! These sensors use a solid-state technique to determine the temperature. That is to say, they dont use mercury (like old thermometers), bimetalic strips (like in some home thermometers or stoves), nor do they use thermistors (temperature sensitive resistors). Instead, they use the fact as temperature increases, the votage across a diode increases at a known rate. (Technically, this is actually the voltage drop between the base and emitter - the Vbe - of a transistor. By precisely amplifying the voltage change, it is easy to genereate an analog signal that is directly proportional to temperature. There have been some improvements on the technique but, essentially that is how temperature is measured. Because these sensors have no moving parts, they are precise, never wear out, don't need calibration, work under many environmental conditions, and are consistant between sensors and readings. Moreover they are very inexpensive and quite easy to use Some basic stats These stats are for the temperature sensor in the Adafruit shop, the Analog Devices TMP36 (-40 to 150C). Its very similar to the LM35/TMP35 (celsius output) and LM34/TMP34 (farenheit output). The reason we went with the '36 instead of the '35 or '34 is that this sensor has a very wide range and doensn't require a negative voltage to read sub-zero temperatures. Otherwise, the functionality is basically the same.

Size: TO-92 package (about 0.2" x 0.2" x 0.2") with three leads Price: $2.00 at the Adafruit shop Temperature range: -40C to 150C / -40F to 302F Output range: 0.1V (-40C) to 2.0V (150C) but accuracy decreases after 125C Power supply: 2.7V to 5.5V only, 0.05 mA current draw 2. Vibration sensor:
Piezoelectric sensors have proven to be versatile tools for the measurement of various processes. They are used for quality assurance, process control and for research and development in many different industries. Although the piezoelectric effect was discovered by Pierre Curie in 1880, it was only in the 1950s that the piezoelectric effect started to 60

be used for industrial sensing applications. Since then, this measuring principle has been increasingly used and can be regarded as a mature technology with an outstanding inherent reliability. It has been successfully used in various applications, such as

in medical, aerospace, nuclear instrumentation, and as a pressure sensor in the touch pads of mobile phones. In the automotive industry, piezoelectric elements are used to monitor combustion when developing internal combustion engines. The sensors are either directly mounted into additional holes into the cylinder head or the spark/glow plug is equipped with a built in miniature piezoelectric sensor.[1]

3. Magnetic sensor: The reed switch is an electrical switch operated by an applied magnetic field. The basic reed switch consists of two identical flattened ferromagnetic reeds, sealed in a dry inert-gas atmosphere within a glass capsule, thereby protecting the contact from contamination. The reeds are sealed in the capsule in such a way that their free ends overlap and are separated by a small air gap.The contacts may be normally open, closing when a magnetic field is present, or normally closed and opening when a magnetic field is applied.A magnetic field from an electromagnet or a permanent magnet will cause the contacts to pull together, thus completing an electrical circuit. The stiffness of the reeds causes them to separate, and open the circuit, when the magnetic field ceases. Good electrical contact is assured by plating a thin layer of precious metal over the flat contact portions of the reeds. Since the contacts of the reed switch are sealed away from the atmosphere, they are protected against atmospheric corrosion. The hermetic sealing of a reed switch makes them suitable for use in explosive atmospheres where tiny sparks from conventional switches would constitute a hazard. A reed sensor is a device built using a reed switch with additional functionality like ability to withstand higher shock, easier mounting, additional intelligent circuitry, etc.In production, a metal reed is inserted in each end of a glass tube and the end of the tube heated so that it seals around a shank portion on the reed. Infrared61

absorbing glass is used, so an infrared heat source can concentrate the heat in the small sealing zone of the glass tube. The thermal coefficient of expansion of the glass material and metal parts must be similar to prevent breaking the glass-to-metal seal. The glass used must have a high electrical resistance and must not contain volatile components such as lead oxide and fluorides. The leads of the switch must be handled carefully to prevent breaking the glass envelope. 4. IR Sensor:

INTRODUCTION TO IR One of the advantages of infrared remote is that there is no radio signal for crooks to monitor and record for use against you later on. Instead, there is a beam of invisible infrared light which comes from a standard hand-held remote control unit. So from that point of view, it is pretty secure. There is, though, an enormous variety of tasks to which you could put the unit. Just think of the myriad of things in your home these days which use infrared remote to turn things on and off, change levels, open and close.

WHAT IS INFRARED? InfraRed is a energy radiation with a frequency below our eyes sensitivity, so we can not see it. Even that we can not "see" sound frequencies, we know that it exist, we can listen them.

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.

62

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, 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 60kHz, the most used is around 36kHz So, remote controls use the 36kHz (or around) to transmit information. InfraRed light emitted by IR Diodes is pulsated at 36 thousand times per second, when transmitting logic level "1" and silence for "0".

IR GENERATION

63

To generate a 36kHz 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

64

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 50kHz. 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 gaincontrol 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
65

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.

TSOP1738 is the standard IR remote control receiver series, supporting all major transmission codes.

66

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

67

Introduction Photo detectors are used primarily as an optical receiver to convert light into electricity. The principle that applies to photo detectors is the photoelectric effect, which is the effect on a circuit due to light. Max Planck In 1900 discovered that energy is radiated in small discrete units called quanta; he also discovered a universal constant of nature which is known as the Plancks constant. Plancks discoveries lead to a new form of physics known as quantum mechanics and the photoelectric effect E = hv which is Planck constant multiplied by the frequency of

radiation. The photo electric effect is the effect of light on a surface of metal in a vacuum, the result is electrons being ejected from the surface this explains the principle theory of light energy that allows photo detectors to operate. Photo detectors are commonly used as safety devices in homes in the form of a smoke detector, also in conjunction with other optical devices to form security systems.

Photo detector: A photo detector operates by converting light signals that hit the junction to a voltage or current. The junction uses an illumination window with an anti-reflect coating to absorb the light photons. The result of the absorption of photons is the creation of electron-hole pairs in the depletion region. Examples of photo detectors are photodiodes and phototransistors. Other optical devices similar to photo detectors are solar cells which also absorb light and turn it into energy. A similar but different optical device is the LED which is basically the inverse of a photodiode, instead of converting light to a voltage or current, it converts a voltage or current to light. Photodiodes: A commonly used photo detector is the photodiode. A photodiode is based on a junction of oppositely doped regions (pn junction) in a sample of semiconductor. This creates a region depleted of charge carriers that results in high impedance. The high impedance allows the construction of detectors using silicon and germanium to operatewith high sensitivity at low temperatures. The photodiode functions using an illumination window (Figure 1), which allows
68

the use of light as an external input. Since light is used as an input, the diode is operated under reverse bias conditions. Under the reverse bias condition the current through the junction is zero when no light is present, this allows the diode to be used as a switch or relay when sufficient light is present.

Photodiodes are mainly made from gallium arsenide instead of silicon because silicon creates crystal lattice vibrations called phonons when photons are absorbed in order to create electronhole pairs. Gallium arsenide can produce electron-hole pairs without the slowly moving phonons; this allows faster switching between on and off states and GaAsalso is more sensitive to the light intensity. Once charge carriers are produced in the diode material, the carriers reach the junction by diffusion. Important parameters for the photodiode include quantum efficiency, current and capacitance which will be covered in the equations section. PIN Photodiode Another type of photodiode is the PIN photodiode; this photodiode includes an intrinsic layer in between the P and N type materials. The PIN must be reverse bias due to the high resistivity of the intrinsic layer; the PIN has a larger depletion region which allows more electron-hole pairs to develop at a lower capacitance. The illumination window for a PIN is on the P-side of the diode because the mobility of electrons is greater than holes which results in better frequency response. The larger breakdown voltage in comparison to the PN photodiode allows it to be used with a biased voltage of approximately 100 which results in a fast response time by the equation below.
69

Avalanche Photodiode An Avalanche photodiode is operated at reverse bias close to the breakdown, which causes photo excited charge carriers to accelerate in the depletion region and produce additional carriers by avalanching. The avalanche photodiodes are good for fiber optic systems that require low light levels with quantum efficiency larger than 100%.

Phototransistor Phototransistor is similar to the photodiode except an additional n-type region is added to the photodiode configuration. The phototransistor includes a photodiode with an internal gain. A phototransistor can be represented as a bipolar transistor that is enclosed in a transparent case so that photons can reach the base-collector junction. The electrons that are generated by photons in the base-collector junction are injected into the base, and the current is then amplified. Since phototransistor detection is on the order of the photodiode they can not detect light any better than a photodiode. The draw back of a phototransistor is the slower response time in comparison to a photodiode. The figure below shows the relationship between a photodiode and phototransistor.

70

71

72

Applications of Photo Detectors:


Photo detectors are used in various different applications such as radiation detection, smoke detection, flame detection and to switch on relays for street lighting. The circuits that use photodiodes use either normally closed or normally open contacts depending on the desired operation. In a smoke detector circuit the photo diode is attached to a relay switch, this switch is normally closed and attached to the fire alarm. When the photo diode conducts it picks up the relay switch, this causes the normally closed switch to open preventing the alarm from activating. When the photo diode fails to conduct, the normally closed contact activates the alarm. Photo diodes are also used in modern oil burning furnaces as a safety feature. The photo diode is comprised of lead sulphide and is used to detect the flame from the boiler, in the event that the flame goes out or fails to occur the photo diode opens the circuit, cutting power to the motor and step up transformer. Another commonly used application is street lights. The photo diode in the circuit uses switchon relays to turn on the street lights when the diode fails to conduct and turns the lights off with when sufficient light is present. Another application is the AFM (Atomic Force Microscope), a laser beam is projected from a laser diode onto the back of the cantilever, and the beam is then reflected to a photodiode. The position of the beam of light on the diode gives the (x,y,z) position of the material as the probes of the cantilever scraps across the surface of the material. This gives a three dimensional representation of the surface being scanned. Photodiodes are also used with lasers to form security system. When the light projected by a laser to the photodiode is broken a security alarm is tripped.

5.SOFTWARE REQUIREMENTS
73

5.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.2 CONCEPT OF COMPILER


Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. I.E the programs written in one of the HLL like C will compile the code to run on the system for a particular processor like x86 (underlying microprocessor in the computer). For example compilers for Dos platform is different from the Compilers for Unix platform So if one wants to define a compiler then compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instruction. See there is a bit little difference between compiler and an interpreter. Interpreter just interprets whole program at a time while compiler analyses and execute each line of source code in succession, without looking at the entire program. The advantage of interpreters is that they can execute a program immediately. Secondly programs produced by compilers run much faster than the same programs executed by an interpreter. However compilers require some time before an executable program emerges. Now as compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language.
74

5.3 CONCEPT OF CROSS COMPILER


A cross compiler is similar to the compilers but we write a program for the target processor (like 8051 and its derivatives) on the host processors (like computer of x86). It means being in one environment you are writing a code for another environment is called cross development. And the compiler used for cross development is called cross compiler. So the definition of cross compiler is a compiler that runs on one computer but produces object code for a different type of computer.

5.4 KEIL C CROSS COMPILER


Keil is a German based Software development company. It provides several development tools like IDE (Integrated Development environment) Project Manager Simulator Debugger C Cross Compiler, Cross Assembler, Locator/Linker

The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An assembler is used to assemble the ARM assembly program. A compiler is used to compile the C source code into an object file. A linker is used to create an absolute object module suitable for our in-circuit emulator.

5.5 Building an Application in Vision2


To build (compile, assemble, and link) an application in Vision2, you must: 1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). 2. Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles, and links the files in your project.

5.6 Creating Your Own Application in Vision2


To create a new project in Vision2, you must: 1. Select Project - New Project.
75

2. Select a directory and enter the name of the project file. 3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target.

5.7 Debugging an Application in Vision2


To debug an application created using Vision2, you must: 1. Select Debug - Start/Stop Debug Session. 2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function. 3. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on.

5.8 Starting Vision2 and Creating a Project


Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 menu Project New Project. This opens a standard Windows dialog that asks you for the new project file name. We suggest that you use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project.

76

5.9 Window Files.


Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device data base. Just select the microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool Options for the 80C51RD+ device and simplifies in this way the tool Configuration.

5.10 Building Projects and Creating a HEX Files


Typical, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging. After you have tested your application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. You may start your PROM programming utility after the make process when you specify the program under the option Run User Program #1.

5.11 CPU Simulation


Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses. In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device.

5.12 Database selection


You have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral
77

components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.

5.13 Start Debugging


You start the debug mode of Vision2 with the Debug Start/Stop Debug Session Command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are available. The additional debug windows are discussed in the following. _ The project structure or tool parameters cannot be modified. All build commands are disabled.

5.14 Disassembly Window


The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging. Numerous example programs are included to help you get started with the most popular embedded 8051 devices.
78

The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device. Simulation helps you understand hardware configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target hardware is available.

5.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment, aerospace systems and defense systems is widespread, and even everyday domestic appliances such as dish washers, televisions, washing machines and video recorders now include at least one such device. Because most embedded projects have severe cost constraints, they tend to use low-cost processors like the 8051 family of devices considered in this book. These popular chips have very limited resources available most such devices have around 256 bytes (not megabytes!) of RAM, and the available processor power is around 1000 times less than that of a desktop processor. As a result, developing embedded software presents significant new challenges, even for experienced desktop programmers. If you have some programming experience - in C, C++ or Java - then this book and its accompanying CD will help make your move to the embedded world as quick and painless as possible.

9.1 PROGRAM CODE


1. 2.
Click on the Keil Vision Icon on Desktop The following fig will appear

79

3. 4.

Click on the Project menu from the title bar Then Click on New Project

5.

Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

80

6. 7. 8.

Then Click on Save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel

9.

Select AT89C51 as shown below

81

10. 11.

Then Click on OK The Following fig will appear

12. 13. 14.

Then Click either YES or NOmostly NO. Now your project is ready to USE. Now double click on the Target1, you would get another option Source group 1 as shown in next page.
82

15.

Click on the file option from menu bar and select new.

16.

The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.

83

17. 18.

Now start writing program in either in EMBEDDED C or ASM. For a program written in Assembly, then save it with extension . asm and for EMBEDDED C based program save it with extension .C

19.

Now right click on Source group 1 and click on Add files to Group Source.
84

20.

Now you will get another window, on which by default EMBEDDED C files will appear.

21. 22. 23.

Now select as per your file extension given while saving the file Click only one time on option ADD. Now Press function key F7 to compile. Any error will appear if so happen.

85

24. 25.

If the file contains no error, then press Control+F5 simultaneously. The new window is as follows

26. 27.

Then Click OK. Now click on the Peripherals from menu bar, and check your required port as shown in fig below.

86

28.

Drag the port a side and click in the program file.

29. 30.

Now keep Pressing function key F11 slowly and observe. You are running your program successfully.

87

10. HARDWARE TESTING


10.1 CONTINUITY TEST:
In electronics, a continuity test is the checking of an electric circuit to see if current flows (that it is in fact a complete circuit). A continuity test is performed by placing a small voltage (wired in series with an LED or noise-producing component such as a piezoelectric speaker) across the chosen path. If electron flow is inhibited by broken conductors, damaged components, or excessive resistance, the circuit is "open". Devices that can be used to perform continuity tests include multi meters which measure current and specialized continuity testers which are cheaper, more basic devices, generally with a simple light bulb that lights up when current flows. An important application is the continuity test of a bundle of wires so as to find the two ends belonging to a particular one of these wires; there will be a negligible resistance between the "right" ends, and only between the "right" ends. This test is the performed just after the hardware soldering and configuration has been completed. This test aims at finding any electrical open paths in the circuit after the soldering. Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and rough handling of the PCB, improper usage of the soldering iron, component failures and presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground. We connect both the terminals across the path that needs to be checked. If there is continuation then you will hear the beep sound.

10.2 POWER ON TEST:


This test is performed to check whether the voltage at different terminals is according to the requirement or not. We take a multi meter and put it in voltage mode. First of all check the voltage across the battery terminal whether it is fully charged or not, the battery used in this project is 12V, so touch the red terminal of battery with red probe of multi meter and touch
88

black terminal of battery with black probe of multi meter, if 12V is being displayed on multi meter screen then we can proceed for next steps. Now that the power supply is available, no IC should be inserted in the base, first apply power and check whether proper voltage is reaching at vcc and gnd pins of each IC base or not. If proper voltages appear at the supply pins of IC bases then insert IC and check the required output. Now we have to check whether the LEDs are in working condition or not, Red LED or IR LED or Photo diode has got one longer leg and one shorter leg. Longer leg is positive terminal of LED and shorter leg is negative terminal. Now keep the multi meter in buzzer mode or continuity mode and touch red probe of multi meter to the longer leg of LED and black probe of multi meter to the shorter leg of LED, if LED glows in such case that means its working. Now solder Red LED into PCB, remember longer leg of LED should be inserted into positive marking on PCB and shorter leg should be inserted into other hole of LED marking on PCB. Now after soldering LED with a series resistor apply battery voltage to the board and see whether the LED is glowing or not. The black LED is photodiode and white LED is IR diode even these components have got longer leg and shorter leg, insert longer leg into +ve marking hole on PCB and insert shorter leg into other hole of LED marking on PCB . The black LED is photodiode and white

LED is IR diode even these components have got longer leg and shorter leg, insert longer leg into +ve marking hole on PCB and insert shorter leg into other hole of LED marking on PCB .

89

90

11. RESULTS

91

13. BIBLIOGRAPHY
92

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

Advantages:
93

Highly sensitive Works with any TV/DVD remote Low cost and reliable circuit Coverage distance upto 10m Can handle heavy loads upto 7A System can be switched into manual whenever required

Applications
1. Home appliance control 2. Hotel lights /fans control 3. Shops and showrooms 4. Industrial applications 5. Electronics Toys

Conclusion:
The project Controlling Electrical Appliances Through TV Remote is successfully tested and implemented. By using this project in real time applications we can reduce the wastage of power. No need of human effort to switch ON or OFF the TV.

94

95

96

97

You might also like