You are on page 1of 68

SMART ZONE SENSING SYSTEM WITH AUTOMATIC CONTROL

Contents

1. 2. 3. 4.

Introduction` Block Diagram & its Description Circuit Diagram & its Description Construction Guidelines

5. Applications & Future Developments


NOTE: Due to continuous improvement and development in the project design, project reports provided are accurate by 90%. The difference of 10% [if any] will be informed during project theory classes.

Smart Zone Sensing System With Automatic Control


1. INTRODUCTION
The project presented here is a novel approach towards vehicle navigation & safety implementation. As the title suggests, the project is aimed at automatically sensing the areas / zones like School Zone, Hospital zone or Accident Zone. In convention, these special zones or areas are indicated at the roadside on a pillar or road sign poles. As an example, near school zone, the sign board displays School Zone Ahead, Drive Slowly, or near a hospital, Hospital Area-Do not Blow Horn, but in reality rarely this is practices. Drivers go at very high speed as usual near school zone, or operate the harsh horns loudly causing inconvenience to the patients in the hospital. Even though these are meant for the safety of the vehicles traveling and also for the general public, it is hardly practices by the vehicle drivers. As a result, making the whole concept of displaying warning sign and messages on the roadside boards meaningless. To provide a better alternative, one can develop a system which will automatically sense such traffic signs automatically and accordingly inform the drives and also assist him in controlling the vehicle voluntarily or forcibly. All in all resulting in a very effective and fail proof system to provide traffic regulation, safety and convenience of the people. As the whole project not just limited for these few functions, this project can be made mandatory. That way one can provide a more reliable security device and streamline traffic flow. Few additional features which can be integrated with this system are, Down Hill Detection, Auto-Breaking with Obstacle detection auto Speed limit Sensor etc. As the design of this system goes, the project proposed here consists of a set of units 1) 2) Zone / Area Unit Vehicle Unit

The following block diagram shows the simplified arrangement of the system,

MAIN FEATURES OF THE PROJECT: 1. Effective in implementation. 2. Low power consumption, and compact size, 3. High reliability, due to the usage of power semiconductor devices, 6. Greater control range due the usage of Frequency Modulation with a PC. 7. Vehicles monitored from a remote area (no need of 'line-of-sight arrangement).

2. BLOCK DIAGRAM & ITS DESCRIPTION In BRIEF: This Smart Zone Sensing System with Automatic Control system works like this. Each monitoring zones are fitted with RF Transmitter units with unique Identity Code. All the vehicles must be fitted with RF Receiver and respective circuitry on their vehicles number plate. Display will be fitted on the dash board for visual representation of the alert messages sent by respective zone Transmitters. When vehicle with 70 Kmph speed enters the school zone, it receives the alert messageSchool Zone, Please go slowly. Speed limit it 30 KiloMeterPerHour. Also receiver checks the speed limit of the vehicle and found above 30 kmph then reduces it until crosses the School Zone area. When the same vehicle enters the Hospital Zone, it receives the alert message Hospital Zone, Please do not blow Horn, and reduces the supply voltage to minimum level such that horn should blow in low pitch.

HOSPITAL ZONE TRANSMITTER #2

SCHOOL ZONE TRANSMITTER #1

FIG 2.1 DIAGRAM DEPICITING TRANSMITTER POSITIONS

The complete block diagram is shown in fig 2.2 and a transmitter position is shown in fig 2.1. The explanation of each block goes like this: RF TRANSMITTER: The Radio Frequency Transmitter transmits the zone code to the receiving units. There are two zones in the present system: School Zone and Hospital Zone. Each Transmitter has carrying frequency of 144 MHz and data frequency range between 17, 19, 22 and 25. Transmitter #1 is set to data frequency of 17 and Transmitter #2 is for 19.

RF RECEIVER: The Radio Frequency Receiver receives the Zone Code transmitted by the Transmitter. According to the number of transmitter, here for Transmitter #1 & #2 respective output pins go high. The output is fed to directed opto-coupler for further processing. OPTO-COUPLER: The Opto-coupler, as name implies, couples the two stages i.e., RF receiver and Buffer & Driver Unit optically. This stage provides the isolation between the receiving stage to driving stage. BUFFER & DRIVER UNIT: This unit provides unit gain amplification to the received Zone Code signal and drives the relay for further feeding. The output of Zone Code signal is fed to Microcontroller chip as input and gets Speed Limit & Low Horn commands from it and drives the two more blocks.

RF TRANSMITTER #1

RF TRANSMITTER #2

D1 D2 D3 D4

D1 D2 D3 D4

LCD DISPLAY OPTO-COUPLER OPTO-COUPLER OPTO-COUPLER OPTO-COUPLER BUFFER & DRIVER UNIT

RF RECEIVER

MICROCONTROLLER CHIP

POWER SUPPLY UNIT

M TO VEHICLES MOTOR

VARIABLE POWER SOURCE

REDUCED POWER SOURCE TO HORN

FIG 2.2 BLOCK DIAGRAM OF SMART ZONE SENSING SYSTEM

MICROCONTROLLER CHIP: This is heart of this system. This takes Zone Code signal as input and generates four command signals for output purpose. The inherited software manipulates the inputted data and generates four command signals. Depends upon the Zone Code, it generates set of two

command signals. If Zone Code is from School Zone Transmitter then the display message is generated and Speed Limit Command is outputted. Suppose Zone Code is from Hospital Zone Transmitter then respective display message is generated and Low Horn Command is outputted. LCD DISPLAY: The Liquid Crystal Display shows the display messages generated by the Microcontroller chip, which is depending upon the Zone Code received. VARIABLE POWER SOURCE: When Speed Limit Command is generated after certain delay by the Microcontroller chip, it is sent to this stage for reducing the speed. This stage actually lowers the supply voltage to the vehicles motor. REDUCED POWER SOURCE: When Low Horn Command is generated after certain delay by the Microcontroller chip, it is sent to this stage for lowered horn sound. This stage actually lowers the supply voltage to the speaker, such that horn sound will be minimized. POWER SUPPLY UNIT: As this stage has driver & relay stages, requires dual regulated power supply for working purpose. Specially designed +12 & +5 Volts regulated power supply is used to give proper working voltage to the whole section.

3.

Circuit Diagram & its Description

Based on the circuit diagrams this Smart Zone Sensing System With Automatic Control system has following circuits: RF Transmitter, RF Receiver, Opto-coupler, Buffer & Driver Unit, Mother Board 89C51, LCD Interfacing, Variable Power Source, Reduced Power Source and finally Power Supply Unit. Before explaining the circuit description, let us see the basics of the Radio Frequency Techniques and its communication details.

RADIO FREQUENCY CIRCUIT TECHNIQUES


Fig ( A) The Radio Frequency Spectrum Radio must surely be one of the most fascinating aspects of Frequency 3 GHz Ultra high frequency, UHF 30 MHz Wavelength 10 cm TV bands 1V/V 1m FM broadcasting 10 m SW broadcasting 100 m MW broadcasting 1 Km LW broadcasting 10 Km electronics. This part of explanation provides a brief introduction to radio communication before describing the circuitry of RF / IR receivers and transmitters. The aim has been to provide the user with information to what

sufficient Very high frequency, his or her VHF 30 MHz High frequency, HF 3 M Hz Medium frequency, MF 300 KHz Low frequency, LF 30 KHz

appetite for a subject which has a broad appeal to a large number of dedicated enthusiasts all over the world. Radio Frequency Signals: Radio frequency signals are generally understood to occupy a frequency range, which extends from a few tens of kilohertz to several

hundred giga-hertz. The lowest part of radio frequency range, which is of practical use (below 30 kHz), is only suitable for narrow-band communications. At this frequency, signals propagate as ground waves (following the curvature of the earth) over very long distance. At the other extreme, the highest frequency range, which is of practical importance, extends above 30GHz. At these

microwave frequencies, considerable bandwidths are available (sufficient to transmit many television channel using point-to-point links or to permit very high definition radar systems) and signals tend to propagate strictly along line-of-sight paths. At other frequencies, signals may propagate by various means, including reflection from ionized layers in the ionosphere. At frequencies between 3MHz and 30MHz, for example, ionospheric propagation regularly permits intercontinental broadcasting and communications using simple equipment within the scope of the enthusiastic radio amateur and short-wave listener. For convenience, the radio frequency spectrum is divided into a number of bands, each spanning a decade of frequency. The use to which each frequency range is put depends upon a number of factors, paramount amongst which is the propagation characteristic within the band concerned. Other factors, which need to be taken into account, include the efficiency of practical aerial system in the range concerned and the bandwidth available. It is also worth noting that, although it may appear from Figure A that a great deal of the radio frequency spectrum is not used, it should be stressed that competition for frequency space is fierce. Frequency allocations are, therefore, ratified by international agreement and the various user services carefully safeguard their own areas of the spectrum. Frequency and wavelength Radio waves propagate in air (or space) at the speed of light (300 million meters per second). The velocity of propagation[v], wavelength[] and frequency [f] of a radio wave are related by the equation: V = f = 3 X 108 m/s This equation can be arranged to make f or the subject, as follows: F = 3 X 108/ Hz and = 3 X 108 / fm As an example, a signal at a frequency of 1 MHz will have a wavelength of 300 m whereas a signal at a frequency of 10 MHz will have a wavelength of 30m. Modulation In order to convey information using a radio frequency carrier, the signal information must be superimposed or modulated onto the carrier. Modulation is the name given to the process of

changing a particular property of the carrier wave in sympathy with the instantaneous voltage (or current) signal. The most commonly used methods of modulation are amplitude modulation (AM) and frequency modulation (FM). In the former case, the carrier amplitude (its peak voltage) varies according to the voltage, at any instant, of the modulating signal. In the latter case, the carrier frequency is varied in accordance with the voltage, at any instant, of the modulating signal. Figure B shows the effect of amplitude and frequency modulating a sinusoidal carrier (note that the modulating signal is, in the case, also sinusoidal). In practice, many more cycles of the radio frequency carrier would occur in the time span of the cycle of the modulating signal. The term angle modulation is the generic term encompassing both frequency modulation and phase modulation. Frequency modulation involves operating directly upon the frequency determining elements of an oscillator stage (e.g. by means of a variable capacitance diode placed across the oscillator-tuned circuit or connected in series with a quartz crystal). Phase modulation, on the other hand, acts indirectly by changing the phase of the signal in a subsequent stage (e.g. by means of a variable capacitance diode acting in a phase shifting circuit).

Amplitude & Frequency Modulation If the modulating signal (audio) is correctly tailored prior to its application to the phase modulated stage, the end result is identical to that of frequency modulation. The reason for this is that, in a true FM system, the deviation produced is the same for all modulating signals of equal amplitude (i.e. the amount frequency deviation is independent of the frequency of the modulating signal). In a phasemodulated system, on other hand, the amount of frequency deviation is proportional to both modulating signal amplitude and modulating signal frequency. Thus in a phase modulated system without audio tailoring, a modulation signal of 2 kHz will produce twice as much frequency deviation as an equal amplitude modulating signal of 1 kHz. The desired audio response required to produce FM, therefore, is one, which rolls off the frequency response by half for each doubling of frequency (equivalent to 6-dB per octave roll-off). This can be easily achieved using a simple R-C low-pass filter.

Demodulation Demodulation is the reverse of modulation and is the means by which the signal information is recovered from the modulated carrier. Demodulation is achieved by means of a demodulator consists of a reconstructed version of the original signal information present at the input of the modulator stage within the transmitter. Figure C shows the simplified block schematic of a simple radio communication system comprising on AM transmitter and a tuned radio frequency (TRF) receiver. Within the transmitter, the carrier wave (of constant frequency) is generated by means of a radio frequency oscillator stage. In order to ensure that the carrier is both accurate and within in frequency, this stage would normally employ a quartz crystal within its frequency generating circuitry. The output of the modulator (a modulated carrier) is amplified before outputting to the aerial system. The output is usually carefully filtered to remove any spurious signals (harmonics) which may be present and which may otherwise cause interference to other services. At the receiver, the signal produced by the receiving aerial is a weak copy of the transmitted signal (its level is usually measured in a V). Also present will be countless other signals at different frequencies (and some with appreciably larger amplitude than the desired signal). These unwanted signals must be rejected by the receivers radio frequency tuned circuits if they are no to cause problems in later stages. Mic. AF amplifier
Modulator RF amplifier

RF
oscillator

LS

RF amplifier

Demodulator

AF amplifier

Fig ( C ) Typical Radio Transmitter & Receiver

RF transmitter
This part transmits unique Zone Code signal towards the RF Receiver part. There are two transmitters Transmitter #1 for School Zone and Transmitter #2 for Hospital Zone. Both are identical except the input pin, hence only one circuit is shown for clarity purpose. INTRODUCTION ASIC: Application Specific Intergrated Circuit [ASIC] is another option for embedded hardware developers. The ASIC needs to be custom-built for a specific application, so it is costly. If the embedded system being designed is a consumer item and is likely to be sold in large quantities, then going the ASIC route is the best option, as it considerably reduces the cost of each unit. In addition, size and power consumption will also be reduced. As the chip count (the number of chips on the system) decreases, reliability increases. If the embedded system is for the mass market, such as those used in CD players, toys, and mobile devices, cost is a major consideration. Choosing the right processor, memory devices, and peripherals to meet the functionality and performance requirements while keeping the cost reasonable is of critical importance. In such cases, the designers will develop an Application Specific Integrated Circuit or an Application Specific Microprocessor to reduce the hardware components and hence the cost. Typically, a developer first creates a prototype by writing the software for a generalpurpose processor, and subsequently develops an ASIC to reduce the cost. Oscillator: An electronic device that generates sinusoidal oscillations of desired frequency is known as a sinusoidal oscillator. Although we speak of an oscillator as generating a frequency, it should be noted that it does not create energy, but merely acts as an energy converter. It receives d.c. energy and changes it into a.c energy of desired frequency. The frequency of oscillations depends upon the constants of the device. A circuit which produces electrical oscillations of any desired frequency is known as an oscillatory circuit or tank circuit. A simple oscillatory circuit consists of a capacitor (C) and inductance coil (L) in parallel. This electrical system can produce electrical oscillations of frequency determined by the values of L and C. The sequence of charge and discharge results in alternating motion of electrons or an osciallating current. The energy is alternately stored in the electric field of the capacitor and the magnetic field of the inductance coil. This intercharge of energy between L and C is repeated over and again resulting in the production of oscillations.

In order to obtain continuous undamped a.c. output from the tank circuit, it is necessary to supply the correct amount of power to the circuit. The most practical way to do this is to supply d.c. power to some device which should convert it to necessary a.c. power for supply to the tank circuit. This can be achieved by employing a transistor circuit. Because of its ability to amplify, a transistor is very efficient energy converter i.e. it converts d.c. power to a.c. power. If the damped oscillations in the tank circuit are applied to the base of transistor, it will result in an amplified reproduction of oscillations in the collector circuit. Because of this amplification more energy is available in the collector circuit than in the base circuit. If a part of this collector-circuit energy is feedback by some means to the base circuit in proper phase to aid the oscillations in the tank circuit, then its losses will be overcome and continuous undamped oscillations will occur. Hartley Oscillator is very popular and is commonly used as a local oscillator in radio receivers. It has two main advantages viz., adaptability to a wide range of frequencies and is easy to tune. RF TRANSMITTER The RF transmitter is built around the ASIC and common passive and active components, which are very easy to obtain from the material shelf. The circuit works on Very High Frequency band with wide covering range. The Carrier frequency is 144 MHz and Data frequencies are 17 MHz,19 MHz,22 MHz & 25 MHz. It should be noted that ASIC or Application Specific Integrated Circuit is proprietary product and data sheet or pin details or working principles are not readily available to the user. PARTS LIST

SEMICONDUCTORS: IC ASIC T1 BC 547 NPN Transistor T2 BF 494 NPN Transistor RESISTORS: R1 & R2 2.7 K Ohm Watt R3 & R6 330 K Ohm Watt R4 1 K Ohm Watt R5 47 K Ohm Watt CAPACITORS: C1, C2 0.001 Pico Farad Capacitor C3 & C7 0.022 Pico Farad Capacitor C4 4.7 Pico Farad Capacitor C5 & C6 0.01 Micro Farad Capacitor MISCELLANEOUS: X1 1.44 MHz Crystal S1 to S4 ON/OFF SWITCHES L1 RF Coil 200mH L2 Aerial or Telescopic Antenna

1 1 1 2 2 1 1 2 2 1 2 1 4 1 1

CIRCUIT DESCRIPTION: The ASIC Transmitter IC has four inputs and only one output pin. The four inputs are for the frequency range of 17 KHz, 19 KHz, 22 KHz and 25 KHz and four switches are provided for each range. When any one switch is selected, that frequency is added to the Transmitter circuit as data

frequency and transmitted in the air. The Crystal X1 with two coupling capacitor provides the working oscillator frequency to the circuit. The Capacitors C6 and C7 are to stabilize the crystal oscillator frequency. The ASIC output is added to the transmitter circuits oscillator transistor T1s base. The data frequency is added with carrier frequency 147 MHz and aired for transmitting purpose. The transistor T1 is heart of the Hartely Oscillator and oscillates at carrier frequency of 147 MHz along with tuned circuit formed by coil L1 and capacitor C4. The Data frequency is fed to T1 on base through resistors R4 and R5. Capacitors C1 and C3 and for stabilizing the tuned circuit along with resistor R3. To increase the range of the circuit, transmitting signals must be strong enough to travel the long distance [i.e., upto 100 meters in this prototype]. So the generated signals are made strong by amplifying to certain level with the help of Transistor T2 and associated circuit. The Radio frequency thus generated is fed to pre-amplifier transistor T2 on base terminal. The resistor R6 provides the bias voltage to T2 and capacitors C5 & C7 removes the noise and harmonics present in the circuit. The antenna coil L2 transmits the radio frequency in the air.

CIRCUIT DIAGRAM OF RF TRANSMITTER

L2

+Vcc

L1

C5

C7

17 KHz 19KHz 22 KHz 25 KHz

S1 S2 S3 S4 ASIC IC X1

C6 C7 C3 R3 330K R4 C1 R5 R2 2K7 R1 C4

R6

T1

C2 0.00 1
T2

Gnd

RF RECEIVER
This circuit is built around the ASIC i.e., Application Specific Integrated Circuit, hence less circuitry is observed. The Radio Frequency tuned circuit has 144 M Hz carrier frequency with four options viz., 17Khz,19Khz,22KHz and 25KHz. The transmitted signals are received on coil L1 which acts as receiver antenna. The oscillator transistor removes the received signals from 147MHz carrier frequency and fed to ASIC IC. The tank circuit formed by C1 and L1 gives the carrier frequency range. The current limiting resistor R1 and bypass capacitor C5 stabilizes the oscillator. The resistor R2,R3 and R4 provide the biasing voltage to the oscillator transistor T1. Capacitors C2 and C3 are there to bypass the noise and harmonics present in the received signals. Through coupling capacitor C7 output of the RF Receiver is fed to ASIC IC. The ASIC IC manipulates the received signal and gives out four channels as output viz., 17KHz,19KHz,22KHz and 25KHz. Each channel is amplified by pre-amplifier transistor T2 along with bias resistor R9. The output of the pre-amplifier transistor is fed to relay driver stage to activate the respective relay ON. The Darlington pair T3 and T4 are arranged in driver stage to drive the low impedance relay. PARTS LIST SEMICONDUCTORS: IC ASIC T1 BC 547 NPN Transistor T2 BF 494 NPN Transistor T3&T4 BC 548 NPN Transistor RESISTORS: R1 & R2 270 K Ohm Watt R3 & R6 220 Ohm Watt R4 2.2 K Ohm Watt R5 2.2 M Ohm Watt R7 10 K Ohm Watt R8 100 Ohm Watt R9 560 Ohm Watt CAPACITORS: C1, C2 0.001 Pico Farad Capacitor C3 & C7 0.022 Pico Farad Capacitor C4 4.7 Pico Farad Capacitor C5 & C6 0.01 Micro Farad Capacitor L1 RF Coil 200mH 1 1 4 8 2 2 1 1 1 4 4 2 2 1 2 1

17

Source: Magnum Technologies.

18

Source: Magnum Technologies.

CIRCUIT DIAGRAM OF RF RECEIVER


+Vcc

R6 RL1 R2 R7 C1 C2 R3 C3 R1
T1

R9 7 6 5 4 3 2 1
T2

L1

T3 R8 T4 2

C7 8 9

ASIC IC
10 11 12 13 14 +Vcc

C6 R9 C5 R4 C4 R5 R8
T2

RL2

T3

T4 2

19

Source: Magnum Technologies.

OPTO-COUPLER
Introduction:
OPTO-COUPLER IC MCT 2E: Buffers does not affect the logical state of a digital signal (i.e. logic 1 input results into logic 1 output where as logic 0 input results into logic 0 output). Buffers are normally used to provide extra current drive at the output are used in interfacing applications. This 6-pin DIL packaged IC MCT 2E acts as Buffer as-well-as Isolator. The input signals may be of 2.5 to 5V digital TTL compatible or DC analogue the IC gives 5V constant signal output. The IC acts as isolator and provides isolation to the main circuit from varying input signals. The working voltage of IC is fed at pin-5 and input to pin-1. The pin-2 is ground and pin4 is output. Note that pin-3 and pin-4 are not available pins, which must be left free. And the isolated circuit must have its own ground connection. The Opto-coupler IC has a photo diode which illuminates whenever input signal appears at pin-1. A photo transistor, whose Base-lead open, receives the signal from the blinking photo diode and passes it intact to the output pin-4. As this switching action is very fast, in term of micro seconds, the signal transfer is successfully done without any delay and signal loss. As there is any physical contact between photo diode and photo transistor is observed, it is used for isolating two sections of the circuit. Especially the delicate digital circuits or signal sensitive stages whose output is supposed to drive a fluctuating stage or mains operated load. Since the digital outputs of the some circuits cannot sink much current, they are not capable of driving relays directly. So, high-voltage high-current Darlington arrays are added to this opto-coupler IC for interfacing low-level logic circuitry and peripheral power loads. Typical loads include relays, solenoids, stepping motors, magnetic print hammers, multiplexed LED and incandescent displays, and heaters.

20

Source: Magnum Technologies.

Vcc

CIRCUIT DIAGRAM OF OPTO-COUPLER


D 1 L E D R3 4 5 1 R 0

Input Signal

IC1

RL 1

R2

TR 1

Gnd

R1

TR2

Parts List:
SEMICONDUCTORS IC1 RESISTORS R0 & R1 R2 R3 MISCELLANEOUS D1 TR1 & TR2 RL1 33 K Ohm, Watt Carbon Type 100 Ohm, Watt Carbon Type 1 K Ohm, Watt Carbon Type 1 1 1 MCT 2E OPTO-ISOLATOR IC 1

Red Indicator LED BC547 NPN Silicon Transistors 12 V, 700 Ohm DPDT Relay

1 2 1

Circuit Description: This module is used where the main circuit is supposed to isolate itself from the mains operated loads. The control signal is applied at input pin-1 and at pin-4 output is observed. Thus the signal supplying circuit is isolated from this load driver circuit. But this signal level is not strong enough to drive the low impedance relay. So, Darlington driver is created using two NPN transistors and boost the signal level. The output signal from the Darlington driver stage is strong enough to actuate relay RL1. This relay can be used to switch ON/OFF any mains operated load. The red LED D1 indicates the relay position, whether load is ON or OFF. The resistors R1, R2, R3 and R4 are current limiting resistors.

21

Source: Magnum Technologies.

NOTE: If the load is inductive add a diode across the relay to prevent the back e.m.f produced by quick switching action.

22

Source: Magnum Technologies.

BUFFER & DRIVER STAGE


Let us see the general components of this Buffer & Driver stage. HEX BUFFER / CONVERTER [NON-INVERTER] IC 4050: Buffers does not affect the logical state of a digital signal (i.e. logic 1 input results into logic 1 output where as logic 0 input results into logic 0 output). Buffers are normally used to provide extra current drive at the output, but can also be used to regularise the logic present at an interface. And Inverters are used to complement the logical state (i.e. logic 1 input results into logic 0 output and vice versa). Also Inverters are used to provide extra current drive and, like buffers, are used in interfacing applications. This 16-pin DIL packaged IC 4050 acts as Buffer as-well-as a Converter. The input signals may be of 2.5 to 5V digital TTL compatible or DC analogue the IC gives 5V constant signal output. The IC acts as buffer and provides isolation to the main circuit from varying input signals. The working voltage of IC is 4 to 16 Volts and propagation delay is 30 nanoseconds. It consumes 0.01 mill Watt power with noise immunity of 3.7 V and toggle speed of 3 Megahertz. IC ULN 2004
1
8 Vs s 9 7 1 0 5 1 2 4 1 3 3 1 4 1 Vc c

I 45 C 00

1 6

1 5

1 1

RELAY: The traditional method of switching current through a load, which requires isolation from the controlling circuit, involves the use of an electromechanical relay. Such devices offer a simple, low15 cost solution to the problem of maintaining adequate isolation between the controlling circuit and the potentially lethal voltages associated with an a.c. main supply. The coils, which provide the 14 3 necessary magnetic flux to operate a relay, are available for operation on a variety of voltages between 5V and 115V d.c. and 12V to 250V a.c. at currents of between 5 mA and 100 mA. 4
5 13 2

16

ULN 2004: Since the digital outputs of the some circuits cannot sink much current, they are not capable of driving relays directly. So, high-voltage high-current Darlington arrays are designed for interfacing low-level logic circuitry and multiple peripheral power loads. The series ULN2000A/L ICs drive seven relays with continuous load current ratings to 600mA for each input. At an appropriate duty cycle depending on ambient temperature and number of drivers turned ON simultaneously, 10
7 6 11 12

typical power loads totalling over 260W [400mA x 7, 95V] can be controlled. Typical loads include relays, solenoids, stepping motors, magnetic print hammers, multiplexed LED and incandescentVcc 9 8 displays, and heaters. These Darlington arrays are furnished in 16-pin dual in-line plastic packages 23
Source: Magnum Technologies.

(suffix A) and 16-lead surface-mountable SOICs (suffix L). All devices are pinned with outputs opposite inputs to facilitate ease of circuit board layout. The input of ULN 2004 is TTL-compatible open-collector outputs. As each of these outputs can sink a maximum collector current of 500 mA, miniature PCB relays can be easily driven using ULN 2004. No additional free-wheeling clamp diode is required to be connected across the relay since each of the outputs has inbuilt free-wheeling diodes. The Series ULN20x4A/L features series input resistors for operation directly from 6 to 15V CMOS or PMOS logic outputs. 1N4148 signal diode: Signal diodes are used to process information (electrical signals) in circuits, so they are only required to pass small currents of up to 100mA. General purpose signal diodes such as the 1N4148 are made from silicon and have a forward voltage drop of 0.7V.

24

Source: Magnum Technologies.

CIRCUIT DIAGRAM OF BUFFER AND DRIVER

+12 v V
+VCC
1 3 2 IC1 4050 D1 1N4148 1 VCC 9 16 N/C 2 15 N/C N/C N/C IC2 2004 N/O N/O N/O N/O

7 9

6 10

3 4

14 13 12 12 11 11 8

FROM RF / IR ID RECEIVER STAGE

11

12 5

15

GND

25

Source: Magnum Technologies.

Parts List:
SEMICONDUCTORS D1& D2 1N4148 SIGNAL DIODE IC1 4050 HEX BUFFER / CONVERTER (NON-INVERTER) IC2 MISCELLANEOUS M1 RL1-RL4 2004 DARLINGTON ARRY

2 1 1

12 V, D.C MOTOR 12 V, 700 Ohm DPDT Reed Relays

1 4

Circuit Description: The Hex Buffer/Inverter IC1 has six input/outputs but only four are used in the present circuit. The working voltage of +5V is applied at pin-1 and four control signals are applied at input pins 5, 7, 9 & 11. Thus the signal supplying circuit is isolated from this Buffer & Driver circuit. And the varying input is further stabilized and fed to signal diodes. As the load may be anything [especially inductive], there is a chance of producing back e.m.f. So to cope with this back e.m.f, signal diodes are used. But this signal level is not strong enough to drive the low impedance relay. So, Darlington driver IC2 is used. Its working voltage is +12 V and only four input/output pins are used. The output signal from the Darlington driver IC is strong enough to actuate four relays. These relays with +12V working voltage are used to supply 4-bit RF / IR ID decoded signal to Computer for further processing. That is, each relays N/O [Normally Open] pins are used state that the particular bit is High.

26

Source: Magnum Technologies.

MOTHER BOARD 89C51


The 89C51 Micro-controller is heart of this project. It is the chip that processes the User Data and executes the same. The software inherited in this chip manipulates the data and sends the result for visual display. INTRODUCTION OF Micro-controller What is a microcontroller? The general definition of a microcontroller is a single chip computer, which refers to the fact that they contain all of the functional sections (CPU, RAM, ROM, I/O, ports and timers) of a traditionally defined computer on a single integrated circuit. Some experts even describe them as special purpose computers with several qualifying distinctions that separate them from other computers. Microcontrollers are "embedded" inside some other device (often a consumer product) so that they can control the features or actions of the product. Another name for a microcontroller, therefore, is "embedded controller." Microcontrollers are dedicated to one task and run one specific program. The program is stored in ROM (read-only memory) and generally does not change. Microcontrollers are often low-power devices. A desktop computer is almost always plugged into a wall socket and might consume 50 watts of electricity. A battery-operated microcontroller might consume 50 mill watts. A microcontroller has a dedicated input device and often (but not always) has a small LED or LCD display for output. A microcontroller also takes input from the device it is controlling and controls the device by sending signals to different components in the device. A microcontroller is often small and low cost. The components are chosen to minimize size and to be as inexpensive as possible. A microcontroller is often, but not always, ruggedized in some way. The microcontroller controlling a car's engine, for example, has to work in temperature extremes that a normal computer generally cannot handle. A car's microcontroller in Kashmir regions has to work fine in -30 degree F (-34 C) weather, while the same microcontroller in Gujarat region might be operating at 120 degrees F (49 C). When you add the heat naturally generated by the engine, the temperature can go as high as 27
Source: Magnum Technologies.

150 or 180 degrees F (65-80 C) in the engine compartment. On the other hand, a microcontroller embedded inside a VCR hasn't been ruggedized at all. Clearly, the distinction between a computer and a microcontroller is sometimes blurred. Applying these guidelines will, in most cases, clarify the role of a particular device. Why are they so popular? The programmability of modern desktop PCs makes them extraordinarily versatile. The functionality of the entire machine can be altered by merely changing its programming. Microcontrollers share this attribute with their desktop relatives. The chips are manufactured with powerful capabilities and the end user determines exactly how the device will function. Often, this makes a dramatic difference in the cost and complexity of a particular design. The true impact of this statement is best illustrated by example. For every clock pulse, the circuit produces one of the three bit numbers in the sequence 000, 100, 111, 010, 011. This design has been implemented with three flip-flops and seven discrete gates as well as a significant amount of wiring. The design of this system can be quite laborious. One must begin with a state graph followed by a state table. Then, the flip-flop T input equations must be derived from a set of Karnaugh maps. Next, the t input equations must be transformed into the actual T input network. All of this circuitry must then be wired together; a task that's time consuming and sometimes error prone. On the other hand, this can be accomplished with a simpler, less costly microcontroller design. Notice the dramatic difference in the amount of hardware and wiring. This simple circuit, along with about a dozen lines of code, will perform the same task as the first circuit. There are other benefits as well. The microcontroller implementation does not have to contend with the undetermined states that sometimes occur with discrete designs. Also consider for a moment what would be required to change the sequence of numbers in the first circuit. What if the output needs to be changed to eight bits instead of three? These are trivial modifications for the microcontroller while the discrete circuit would require a complete redesign. The example above is not an obscure case. The effects of this device are being felt in almost every facet of digital design. A sure method of determining the popularity of an electronic device is to note when they attain widespread use by hobbyists. It therefore becomes essential that the electronics engineer or hobbyist learn to program these microcontrollers to maintain a level of competence and to gain the advantages microcontrollers provide in his or her own circuit designs.

28

Source: Magnum Technologies.

Introducing the Intels Microcontroller 89C51

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

Description
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89C52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator, and clock circuitry.

29

Source: Magnum Technologies.

In addition, the AT89C52 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 hardware reset.

Pin Description VCC


Supply voltage. 30
Source: Magnum Technologies.

GND
Ground.

Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull ups. Port 0 also receives the code bytes during Flash programming and outputs the code by test during program verification. External pull ups are required during program verification.

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 (IIL) because of the internal pull ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively. Port 1 also receives the low-order address bytes during Flash programming and verification. Port Pin Alternate Functions P1.0 T2 (external count input to Timer/Counter 2), clock-out (Timer/Counter 2 capture/reload trigger and direction control) AT89C52 P1.1 T2 EX

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. 31
Source: Magnum Technologies.

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 (IIL) because of the pull ups. Port 3 also receives some control signals for Flash programming and verification. Port Pin Alternate Functions P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe)

RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

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. Note, however, that one ALE pulse is skipped during each access to external data memory. 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. 32
Source: Magnum Technologies.

PSEN
Program Store Enable is the read strobe to external program memory. When the AT89C52 is executing code from external program memory, PSEN is activated 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 12-volt programming enable voltage (VPP) during Flash programming when 12-volt programming is selected.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke AT89C52 new features. In that case, the reset or inactive values of the new bits will always be 0. Timer 2 Registers Control and status bits are contained in registers T2CON and T2MOD for Timer2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.

Interrupt Register
The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register.r 33
Source: Magnum Technologies.

Symbol TF2

Function be set when either RCLK = 1 or TCLK = 1.

Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. TF2 will not

EXF2 Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and EXEN2 = 1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine. EXF2 must be cleared by software. EXF2 does not cause an interrupt in up/down counter mode (DCEN = 1). RCLK Receive clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its receive clock in serial port Modes 1 and 3. RCLK = 0 causes Timer 1 overflow to be used for the receive clock. TCLK Transmit clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its transmit clock in serial port Modes 1 and 3. TCLK = 0 causes Timer 1 overflows to be used for the transmit clock. EXEN2 Timer 2 external enable. When set, allows a capture or reload to occur as a result of a negative transition on T2EX if Timer 2 is not being used to clock the serial port. EXEN2 = 0 causes Timer 2 to ignore events at T2EX. TR2 Start/Stop control for Timer 2. TR2 = 1 starts the timer. counter (falling edge triggered). CP/RL2 Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX if EXEN2 = 1. CP/RL2 = 0 causes automatic reloads to occur when Timer 2 overflows or negative transitions occur at T2EX when EXEN2 = 1. When either RCLK or TCLK = 1, this bit is ignored and the timer is forced to auto-reload on Timer 2 overflow.

C/T2 Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 = 1 for external event

Data Memory
The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. That means the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.

34

Source: Magnum Technologies.

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 Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.

Timer 0 and 1
Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and Timer 1 in the AT89C51.

Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON. Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle.

Capture Mode
35
Source: Magnum Technologies.

In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but a 1-to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can generate an interrupt.

Auto-reload (Up or Down Counter)


Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD. Upon reset, the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN is set, Timer 2 can count up or down, depending on the value of the T2EX pin.

Baud Rate Generator


Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON (Table 2). Note that the baud rates for transmit and receive can be different if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other function. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode. The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and 3 are determined by Timer 2s overflow rate according to the following equation. The Timer can be configured for either timer or counter operation. In most applications, it is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode, TH2 or TL2 should not be read from or written to. Under these conditions, the Timer is incremented every state time, and the results of a read or write may not be accurate. The RCAP2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers.

Programmable Clock Out


36
Source: Magnum Technologies.

A 50% duty cycle clock can be programmed to come out on P1.0. This pin, besides being a regular I/O 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 at a 16 MHz operating frequency. To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE (T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer.

UART
The UART in the AT89C52 operates the same way as the UART in the AT89C51.

Interrupts
The AT89C52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table shows that bit position IE.6 is unimplemented. In the A T89 C5 1, bit position IE.5 is also unimplemented. User software should not write 1s to these bit positions, since they may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 7. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed. 37
Source: Magnum Technologies.

Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated By a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory.

Power-down Mode
In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.

Programming the Flash


The AT89C52 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a highvoltage (12-volt) or a low-voltage (VCC) program enable signal. The Low-voltage programming mode provides a convenient way to program the AT89C52 inside the users system, while the high-voltage programming mode is compatible with conventional third party Flash or EPROM programmers. The AT89C52 is shipped with either the high-voltage or low-voltage programming mode enabled. The AT89C52 code memory array is programmed byte-by-byte in either programming mode. To program any nonblank byte in the on-chip Flash Memory, the entire memory must be erased using the

38

Source: Magnum Technologies.

Chip Erase Mode.


Programming Algorithm Before programming the AT89C52, the address, data and control signals should be set up according to the Flash programming mode table and Figure 9 and Figure 10. To program the AT89C52, take the following steps. 1. Input the desired memory location on the address lines. 2. Input the appropriate data byte on the data lines. 3. Activate the correct combination of control signals. 4. Raise EA/VPP to 12V for the high-voltage programming mode. 5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and typically takes no more than 1.5 ms. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached.

Data Polling
The AT89C52 features Data Polling to indicate the end of a write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written data on PO.7. Once the write cycle has been completed, true data is 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 can also be monitored by the RDY/BSY output signal. 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 data can be read back via the address and data lines for verification. The lock bits cannot be verified directly. Verification of the lock bits is achieved by observing that their features are enabled.

Chip Erase
The entire Flash array is erased electrically by using the proper combination of control signals and by holding ALE/PROG low for 10 ms. The code array is written with all 1s. The chip erase operation must be executed before the code memory can be reprogrammed.

Reading the Signature Bytes

39

Source: Magnum Technologies.

The signature bytes are read by the same procedure as a normal verification of locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows. (030H) = 1EH indicates manufactured by Atmel (031H) = 52H indicates 89C52 (032H) = FFH indicates 12V programming (032H) = 05H indicates 5V programming

40

Source: Magnum Technologies.

Flash Programming Modes


Programming Interface Every code byte in the Flash array can be written, and the entire array can be erased, by using the appropriate combination of control signals. The write operation cycle is self timed and once initiated, will automatically time itself to completion.

DC Characteristics
Absolute Maximum Ratings* Operating Temperature.................................. -55C to +125C Storage Temperature ..................................... -65C to +150C Voltage on Any Pin with Respect to Ground .....................................-1.0V to +7.0V Maximum Operating Voltage............................................ 6.6V DC Output Current...................................................... 15.0 mA

41
P0.7

Source: Magnum Technologies.

P0.6 33 XTAL1 COMPLETE CIRCUIT DIAGRAM [mother board]34 89c51 of 30 pF 40 vcc 12 MHz 18 29 XTAL2 P0.4 35 P0.3 36 P1.7 P0.2 8 37 P1.6 P0.1 7 38 P1.5 P0.0 6 39 P1.4 5 P1.3 P2.7 4 28 P1.2 P2.6 3 27 P1.1 P2.5 2 26 P1.0 P2.4 11 25 P2.3 24 P2.2 23 P2.1 22 vss 20 P2.0 21 1 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 D3 19 P0.5

+Vcc
230 AC

X1

D1 & D2

IC1 +VCC R1 C1 C2 C3

PSEN 30 pF 30 31 +VCC 9 17 ALE EA RST

port 0

8 x 2.2 K

10 MFD/63V P3.7 16 20K RESET SWITCH P3.5 14 rd wr t1 t0 int1 int0 txd rxd P3.4 13 P3.3 12 P3.2 11 P3.1 10 P3.0 P3.6 15

89c51

Parts List of Power Supply X1 12-0-12V Transformer 1 IC1 7805 Regulator IC 1 D1 & D2 1N4007 Rectifier Diode 2 D3 Red Indicator LED 1 R1 100 K Carbon Resistor 1 C1 1000MFD/25V Electrolytic Capacitor 1 C2 & C3 0.1F Ceramic Capacitor 2

port 1
a15 a14 a13 a12 a11 a10 a9 a8

port 3

port 2

42

Source: Magnum Technologies.

CIRCUIT DESCRIPTION
The mother board of 89C51 has following sections: Power Supply, 89C51 IC, Oscillator, Reset Switch & I/O ports. Let us see these sections in detail. POWER SUPPLY: This section provides the clean and harmonic free power to IC to function properly. The output of the full wave rectifier section, which is built using two rectifier diodes, is given to filter capacitor. The electrolytic capacitor C1 filters the pulsating dc into pure dc and given to Vin pin-1 of regulator IC 7805.This three terminal IC regulates the rectified pulsating dc to constant +5 volts. C2 & C3 provides ground path to harmonic signals present in the inputted voltage. The Vout pin-3 gives constant, regulated and spikes free +5 volts to the mother board. The allocation of the pins of the 89C51 follows a U-shape distribution. The top left hand corner is Pin 1 and down to bottom left hand corner is Pin 20. And the bottom right hand corner is Pin 21 and up to the top right hand corner is Pin 40. The Supply Voltage pin Vcc is 40 and ground pin Vss is 20. OSCILLATOR: If the CPU is the brain of the system then the oscillator, or clock, is the heartbeat. It provides the critical timing functions for the rest of the chip. The greatest timing accuracy is achieved with a crystal or ceramic resonator. For crystals of 2.0 to 12.0 MHz, the recommended capacitor values should be in the range of 15 to 33pf2. Across the oscillator input pins 18 & 19 a crystal x1 of 4.7 MHz to 20 MHz value can be connected. The two ceramic disc type capacitors of value 30pF are connected across crystal and ground, stabilizes the oscillation frequency generated by crystal. I/O PORTS: There are a total of 32 i/o pins available on this chip. The amazing part about these ports is that they can be programmed to be either input or output ports, even "on the fly" during operation! Each pin can source 20 mA (max) so it can directly drive an LED. They can also sink a maximum of 25 Ma current. Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin. The alternate function of each pin is not discussed here, as port accessing circuit takes care of that. This 89C51 IC has four I/O ports and is discussed in detail: 43
Source: Magnum Technologies.

P0.0 TO P0.7 PORT0 is an 8-bit [pins 32 to 39] open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs and configured to be multiplexed low order address/data bus then has internal pull ups. External pull ups are required during program verification. P1.0 TO P1.7 PORT1 is an 8-bit wide [pins 1 to 8], bi-directional port with internal pull ups. P1.0 and P1.1 can be configured to be the timer/counter 2 external count input and the timer/counter 2 trigger input respectively. P2.0 TO P2.7 PORT2 is an 8-bit wide [pins 21 to 28], bi-directional port with internal pull ups. The PORT2 output buffers can sink/source four TTL inputs. It receives the high-order address bits and some control signals during Flash programming and verification. P3.0 TO P3.7 PORT3 is an 8-bit wide [pins 10 to 17], bi-directional port with internal pull ups. The Port3 output buffers can sink/source four TTL inputs. It also receives some control signals for Flash programming and verification. PSEN Program Store Enable [Pin 29] is the read strobe to external program memory. ALE Address Latch Enable [Pin 30] is an output pulse for latching the low byte of the address during accesses to external memory. EA External Access Enable [Pin 31] must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H upto FFFFH. RST Reset input [Pin 9] must be made high for two machine cycles to resets the devices oscillator. The potential difference is created using 10MFD/63V electrolytic capacitor and 20KOhm resistor with a reset switch. 44
Source: Magnum Technologies.

LCD INTERFACING
LCDs can add a lot to any application in terms of providing an useful interface for the user, debugging an application or just giving it a "professional" look. The most common type of LCD controller is the Hitatchi 44780 which provides a relatively simple interface between a processor and an LCD. Using this interface is often not attempted by inexperienced designers and programmers because it is difficult to find good documentation on the interface, initializing the interface can be a problem and the displays themselves are expensive. The most common connector used for the 44780 based LCDs is 14 pins in a row, with pin centers 0.100" apart. The pins are wired as: Pins 1 2 3 4 5 6 7 - 14 Description Ground Vcc Contrast Voltage "R/S" _Instruction/Register Select "R/W" _Read/Write LCD Registers "E" Clock Data I/O Pins DATA R/_S lcd data write waveform

R/_W E 450 nSec

The interface is a parallel bus, allowing simple and fast reading/writing of data to and from the LCD.

The LCD Data Write Waveform will write an ASCII Byte out to the LCD's screen. The ASCII code to be displayed is eight bits long and is sent to the LCD either four or eight bits at a time. If four bit mode is used, two "nibbles" of data (Sent high four bits and then low four bits with an "E" Clock pulse with each nibble) are sent to make up a full eight bit transfer. The "E" Clock is used to initiate the data transfer within the LCD. Sending parallel data as either four or eight bits are the two primary modes of operation. While there are secondary considerations and modes, deciding how to send the data to the LCD is most critical decision to be made for an LCD interface application. Eight bit mode is best used when speed is required in an application and at least ten I/O pins are available. Four bit mode requires a minimum of six bits. To wire a microcontroller to an LCD in four bit mode, just the top four bits (DB4-7) are written to. 45
Source: Magnum Technologies.

The "R/S" bit is used to select whether data or an instruction is being transferred between the microcontroller and the LCD. If the Bit is set, then the byte at the current LCD "Cursor" Position can be read or written. When the Bit is reset, either an instruction is being sent to the LCD or the execution status of the last instruction is read back (whether or not it has completed). The different instructions available for use with the 44780 are shown in the table below: R/S 4 0 0 0 0 0 0 0 0 0 1 1 R/W 5 0 0 0 0 0 0 0 0 1 0 1 D7 14 0 0 0 0 0 0 0 1 BF D D D6 13 0 0 0 0 0 0 1 A * D D D5 12 0 0 0 0 0 1 A A * D D D4 11 0 0 0 0 1 DL A A * D D D3 10 0 0 0 1 SC N A A * D D D2 9 0 0 1 D RL F A A * D D D1 8 0 1 ID C * * A A * D D D0 7 1 * S B * * A A * D D Instruction/Description Pins Clear Display Return Cursor and LCD to Home Position Set Cursor Move Direction Enable Display/Cursor Move Cursor/Shift Display Set Interface Length Move Cursor into CGRAM Move Cursor to Display Poll the "Busy Flag" Write a Character to the Display at the Current Cursor Position Read the Character on the Display at the Current Cursor Position

The bit descriptions for the different commands are: "*" - Not Used/Ignored. This bit can be either "1" or "0" Set Cursor Move Direction: ID - Increment the Cursor After Each Byte Written to Display if Set S - Shift Display when Byte Written to Display Enable Display/Cursor D - Turn Display On(1)/Off(0) C - Turn Cursor On(1)/Off(0) B - Cursor Blink On(1)/Off(0) Move Cursor/Shift Display SC - Display Shift On(1)/Off(0) RL - Direction of Shift Right(1)/Left(0) Set Interface Length DL - Set Data Interface Length 8(1)/4(0) N - Number of Display Lines 1(0)/2(1) F - Character Font 5x10(1)/5x7(0) Poll the "Busy Flag" 46
Source: Magnum Technologies.

BF - This bit is set while the LCD is processing Move Cursor to CGRAM/Display A - Address Read/Write ASCII to the Display D - Data Before you can send commands or data to the LCD module, the Module must be initialized. For eight bit mode, this is done using the following series of operations: Wait more than 15 mSecs after power is applied. Write 0x030 to LCD and wait 5 mSecs for the instruction to complete Write 0x030 to LCD and wait 160 secs for instruction to complete Write 0x030 AGAIN to LCD and wait 160 secs or Poll the Busy Flag Set the Operating Characteristics of the LCD Write "Set Interface Length" Write 0x010 to turn off the Display Write 0x001 to Clear the Display Write "Set Cursor Move Direction" Setting Cursor Behaviour Bits Write "Enable Display/Cursor" & enable Display and Optional Cursor In describing how the LCD should be initialized in four bit mode, experts will specify writing to the LCD in terms of nibbles. This is because initially, just single nibbles are sent (and not two, which make up a byte and a full instruction). As mentioned above, when a byte is sent, the high nibble is sent before the low nibble and the "E" pin is toggled each time four bits is sent to the LCD. To initialize in four bit mode: Wait more than 15 mSecs after power is applied. Write 0x03 to LCD and wait 5 mSecs for the instruction to complete Write 0x03 to LCD and wait 160 secs for instruction to complete Write 0x03 AGAIN to LCD and wait 160 secs (or poll the Busy Flag) Set the Operating Characteristics of the LCD Write 0x02 to the LCD to Enable Four Bit Mode All following instruction/Data Writes require two nibble writes. Write "Set Interface Length" Write 0x01/0x00 to turn off the Display Write 0x00/0x01 to Clear the Display Write "Set Cursor Move Direction" Setting Cursor Behaviour Bits 47
Source: Magnum Technologies.

Write "Enable Display/Cursor" & enable Display and Optional Cursor Once the initialization is complete, the LCD can be written to with data or instructions as required. Each character to display is written like the control bytes, except that the "R/S" line is set. During initializiation, by setting the "S/C" bit during the "Move Cursor/Shift Display" command, after each character is sent to the LCD, the cursor built into the LCD will increment to the next position (either right or left). Normally, the "S/C" bit is set (equal to "1") along with the "R/L" bit in the "Move Cursor/Shift Display" command for characters to be written from left to right (as with a "Teletype" video display). Most LCD displays have a 44780 and support chip to control the operation of the LCD. The 44780 is responsible for the external interface and provides sufficient control lines for sixteen characters on the LCD. The support chip enhances the I/O of the 44780 to support up to 128 characters on an LCD. From the table above, it should be noted that the first two entries ("8x1", "16x1") only have the 44780 and not the support chip. This is why the ninth character in the 16x1 does not "appear" at address 8 and shows up at the address that is common for a two line LCD. Here it is included the 40 character by 4 line ("40x4") LCD because it is quite common. Normally, the LCD is wired as two 40x2 displays. The actual connector is normally sixteen bits wide with all the fourteen connections of the 44780 in common, except for the "E" (Strobe) pins. The "E" strobes are used to address between the areas of the display used by the two devices. The actual pinouts and character addresses for this type of display can vary between manufacturers and display part numbers. Note that when using any kind of multiple 44780 LCD display, programmer should probably only display one 44780's Cursor at a time. Cursors for the 44780 can be turned on as a simple underscore at any time using the "Enable Display/Cursor" LCD instruction and setting the "C" bit. Expert don't recommend using the "B" ("Block Mode") bit as this causes a flashing full character square to be displayed and it really isn't that attractive. The LCD can be thought of as a "Teletype" display because in normal operation, after a character has been sent to the LCD, the internal "Cursor" is moved one character to the right. The "Clear Display" and "Return Cursor and LCD to Home Position" instructions are used to reset the Cursor's position to the top right character on the display.

48

Source: Magnum Technologies.

To move the Cursor, the "Move Cursor to Display" instruction is used. For this instruction, bit 7 of the instruction byte is set with the remaining seven bits used as the address of the character on the LCD the cursor is to move to. These seven bits provide 128 addresses, which matches the maximum number of LCD character addresses available. The table above should be used to determine the address of a character offset on a particular line of an LCD display. The Character Set available in the 44780 is basically ASCII. It is "basically" because some characters do not follow the ASCII convention fully (probably the most significant difference is 0x05B or "\" is not available). The ASCII Control Characters (0x008 to 0x01F) do not respond as control characters and may display funny (Japanese) characters. The last aspect of the LCD to discuss is how to specify a contrast voltage to the Display. Experts

Shift Register LCD Data Write


Data Data Clock R6 D0 D1 Dn E

+Vcc

S/R

0 0

10K pot

Pin-3 Contrast

Process E Clock or

LCD LCD
LCD Contrast Circuit

typically use a potentiometer wired as a voltage divider. This will provide an easily variable voltage between Ground and Vcc, which will be used to specify the contrast (or "darkness") of the characters on the LCD screen. You may find that different LCDs work differently with lower voltages providing darker characters in some and higher voltages do the same thing in others. There are a variety of different ways of wiring up an LCD. Above, it is noted that the 44780 can interface with four or eight bits. To simplify the demands in microcontrollers, a shift register is often used (as is shown in the diagram below) to reduce the number of I/O pins to three. It is evident that using this circuit with the PICMicro, 8051 and AVR and it really makes the wiring of an LCD to a microcontroller very simple. A significant advantage of using a shift register, like the two circuits shown here, data to the LCD is the lack of timing sensitivity that will be encountered. The biggest issue to watch for is to make sure the "E" Strobe's timing is within specification (i.e., greater 49
Source: Magnum Technologies.

than 450 nSecs), the shift register loads can be interrupted without affecting the actual write. This circuit will not work with Open-Drain only outputs. One note about the LCD's "E" Strobe is that in some documentation it is specified as "high" level active while in others, it is specified as falling edge active. It seems to be falling edge active, which is why the 2-wire LCD interface presented below works even if the line ends up being high at the end of data being shifted in. If the falling edge is used (like in the 2-wire interface) then make sure that before the "E" line is output on "0", there is at least a 450 nSecs delay with no lines changing state. Next the program is given in 8051 assembly language with necessary comments that can display a message or single character on screen. com equ 0fch dat equ 0fdh eof equ 0feh org 00h mov dptr,#2000h acall msg mov a,#c0h acall cmmd mov a,#'L' acall dis mov a,#'C' acall dis mov a,#'D' acall dis mov dptr,#3000h acall msg here: sjmp here msg: acall ready clr a movc a,@a+dptr inc dptr ; display word 'program' in next line ; after character 'D'. ; continue loop ; wait until display is busy ; get the character ; point to next character 50 ; and display character 'D' ; and display character 'C' ; and display character 'L' ; Initilize LCD and display message ; "Wel - Come To ; Go to the next line ; command follows this header ; Data follows this header ; End of message

Source: Magnum Technologies.

cjne a,#eof,cmd ret cmd:cjne a,#com,data clr p0.1 sjmp msg data:cjne a,#dat,send setb p0.1 sjmp msg send: mov p1,a clr p0.2 setb p0.0 clr p0.0 sjmp msg cmmd: acall ready mov p1,a clr p0.1 clr p0.2 setb p0.0 clr p0.0 ret dis: acall ready mov p1,a setb p0.1 clr p0.2 setb p3.7 clr p3.7 ret ready: mov r7,p0 clr p0.0 clr p0.1 setb p0.2 wait:clr p0.0 setb p0.0 jb p1.7,wait clr p3.7 mov p0,r7 ret org 2000h db com db 3ch db 0fh db 01h db dat db 'Wel-Come To' db eof

; if end of message then ; return from sub routine ; if command then DI (RS) = 0 ; go until done ; if data then DI (RS) = 1 ; go until done ; send data/command to display ; write enable ; strobe character to display ; go until done

; wait until display is busy ; command chara. in p1 ; select com. register ; write enable ; strobe the chara.

; wait until display is busy ; data chara. in p1 ; select data register ; write enable ; strobe the chara.

; save content of P0 ; disable display ; select command register ; read enable ; strobe display ; read busy status of display ; wait for busy ; restore content of P0 ; messages are stored at ; locations 2000h and 3000h

51

Source: Magnum Technologies.

org 3000h db com db 0c5h db dat db 'Program' db eof end

PRODUCT SPECIFICATIONS
General The LCD of the unit is STN (Super Twisted Nematic) Gray , Transflective type. Low power consumption with the dot-matrix LCD panel and CMOS LSI. Built-in backlight LED with high luminance and stable radiation. Thin, lightweight design permits easy installation in a variety of equipment. Allowing for being connected at general-purpose CMOS signal level, the unit can be easily interfaced to a microprocessor with common 4-bit and 8-bit parallel inputs and outputs. Multiplexing driving : 1/16duty, 1/4bias, 6 oclock Built-in character generator ROM and RAM, and display data RAM: Character generator ROM 225 different 5 x 7 dot-matrix character patterns (Alphanumeric and symbols) Character generator RAM 8 different user programmed 5 x 7 dot-matrix patterns Display data RAM 80 x 8 bits Numerous instructions Display clear, Cursor home, Display ON/OFF, Cursor ON/OFF, Blink character, Cursor shift, Display shift The unit operates from a single 5V power supply Liquid crystal panel service life 100,000 hours minimum at 25 oC -10 oC 3.3 definition of panel service life Contrast becomes 30% of initial value Current consumption becomes three times higher than initial value Remarkable alignment deterioration occurs in LCK cell layer Unusual operation occurs in display functions

Safety
If the LCD panel breaks, be careful not to get the liquid crystal in your mouth. If the liquid crystal touches your skin or clothes, wash it off immediately using soap and plenty of water.

Handling
52
Source: Magnum Technologies.

Avoid static electricity as this can damage the CMOS LSI. The LCD panel is plate glass; do not hit or crush it. Do not remove the panel or frame from the module. The polarizing plate of the display is very fragile; handle it very carefully

Mounting and Design


Mount the module by using the specified mounting part and holes. To protect the module from external pressure, leave a small gap by placing transparent plates (e.g. acrylic or glass) on the display surface, frame, and polarizing plate Design the system so that no input signal is given unless the power-supply voltage is applied. Keep the module dry. Avoid condensation; otherwise the transparent electrodes may break.

Storage
Store the module in a dark place, where the temperature is 25 oC - 10 oC and the humidity below 65% RH. Do not store the module near organic solvents or corrosive gases. Do not crush, shake, or jolt the module (including accessories).

53

Source: Magnum Technologies.

VARIABLE POWER SOURCE Introduction: The power supply, unsung hero of every electronic circuit, plays very important role
in smooth running of the connected circuit. The main object of this variable power supply is, as the name itself implies, to deliver the required amount of stabilized and pure power to the circuit. Every typical power supply contains the following sections: 1. Step-down Transformer: The conventional supply, which is generally available to the user, is 230V AC. It is necessary to step down the mains supply to the desired level. This is achieved by using suitably rated step-down transformer. While designing the power supply it is necessary to go for higher rating transformer than the required one. There are three reasons for this. First reason is, across the secondary winding of the transformer there is no guarantee of getting the equal voltages. Secondly, for proper working of the regulator IC it needs at least 2.5V more than the expected output voltage. Last reason is to compensate the power loss offered by the transformer windings and power supply circuit itself. 2. Rectifier stage: Then the step-downed Alternating Current is converted into Direct Current. This rectification is achieved by using passive components such as diodes. If the power supply is designed for high voltage/current drawing loads/circuits employed. 3. Filter stage: But this rectified output contains some percentage of superimposed a.c. ripples. So to filter these a.c. components filter stage is built around the rectifier stage. The cheap, reliable, simple and effective filtering for low current drawing loads is done by using shunt capacitors. As this electrolytic capacitor has polarity, care should be taken while rig-upping the circuit. 4. Voltage Regulation: The filtered d.c. output is not stable. It varies in accordance with the fluctuations in mains supply or varying load current. This variation of load current is observed due to voltage drop in transformer windings, rectifier and filter circuit. These variations in d.c. output voltage may cause inaccurate or erratic operation or even malfunctioning of many electronic circuits. For example, the circuit boards which are implanted by CMOS or TTL ICs. The stabilization of d.c. output is achieved by using the three terminal voltage regulator IC. In their basic operational mode, these regulators require virtually no external components. They are available in both fixed voltage as well as adjustable voltage types with current ratings of 100mA, bridge rectifier is

54

Source: Magnum Technologies.

500mA, 1.0A and 3.0A. The fixed types are 78XX & 79XX series, while adjustable types are of LM117/LM217/LM317 series.

Voltage Regulator LM317: The LM117/LM217/LM317 series adjustable 3-terminal positive voltage regulators are available in the current ratings of 0.1A, 0.5A and 1.0A. The output voltage is adjustable from 1.2V to 37V. For LM317 operational temperature range is 0C to +125C. Their performance specifications are much better than those of fixed voltage regulators. Since these regulators are floating, and see only the input-to-output differential voltage, supplies of several hundred volts can be regulated as long as the input-output differential is not exceeded. These regulator ICs have in-built short-circuit protection and auto-thermal cut-out provisions. If the load current is very high the IC needs heat sink to dissipate the internally generated power.

0-30V THREE TERMINAL VOLTAGE REGULATOR IC: LM 317T


GENERAL CHARACTERISTICS: 1. Output voltage 2. Operating Temperature 3. Output Current 4. Dropout Voltage : +1.2V - +37 V : 0c - +125c : 1 A Max : 1.7V 3V

Adjust 1 2 A 3

CIRCUIT DIAGRAM OF 0-30V REGULATED VARIABLE POWER SUPPLY D2


D1 1 C D3 1 D4 1 C1 D IN LM317T ADJ C2 C 3 R1 230V AC OUT +1.25 TO 30V 1AMP C4 R2

X1

P1 55
Source: Magnum Technologies.

GND

Parts List:
SEMICONDUCTORS IC1 LM317T Regulator IC D1to D4 1N5401 Rectifier Diodes R1 R2 P1 C1 C2 C3 C4 MISCELLANEOUS X1 100 Ohm Watt 910 Ohm Watt 1 K Ohm Preset 1000 f/25V Electrolytic 0.1F Tantalum type 10 F/25V Electrolytic 22 F/40V Electrolytic 1 4 1 1 1 1 1 1 1

230V AC Pri,0-34V 1Amp Sec Transformer

Circuit Description:

A d.c. power supply which maintains the output voltage constant

irrespective of a.c. mains fluctuations or load variations is known as regulated d.c. power supply. It is also referred as full-wave regulated power supply as it uses four diodes in bridge fashion with the transformer. This laboratory power supply offers excellent line and load regulation and an output voltage continuously variable from 0 to 30 at output currents up to one amp.

1.Step-down Transformer : The transformer rating is 230V AC at Primary and 0-32V, 1Ampers
across secondary winding. This transformer has a capability to deliver a current of 1Ampere, which is more than enough to drive any electronic circuit or varying load. The 32VAC appearing across the secondary is the RMS value of the waveform and the peak value would be 32 x 1.414 = 45.2 volts. This value limits our choice of rectifier diode as 1N5401, which is having PIV rating more than 45Volts.

2. Rectifier Stage : The four diodes D1to D4 are connected across the secondary winding of the
transformer in bridge fashion to form a full-wave rectifier. During the positive half-cycle of secondary voltage, the end A of the secondary winding becomes positive and end B negative. This makes the diode D2 & D3 forward biased and diode D1 & D4 reverse biased. Therefore the series diodes D2 & 56
Source: Magnum Technologies.

D3 provides full wave rectification to produce a positive output. Thus, +30V pulsating d.c. is obtained at point C with respect to Ground. During the negative half-cycle, end A of the secondary winding becomes negative and end B positive. Therefore diode D1 & D4 are forward biased and diode D2 & D3 are reverse biased. Hence the series diodes D1 & D4 provides full wave rectification to produce a negative output. Thus, -30V pulsating d.c. is obtained at point C with respect to Ground.

3.Filter Stage : Here Capacitors C1 is used for filtering purposes and connected across the
rectifier output. It filters the a.c. components present in the rectified d.c. and gives steady d.c. voltage. As the rectifier voltage increases, it charges the capacitor and also supplies current to the load. When capacitor is charged to the peak value of the rectifier voltage, rectifier voltage starts to decrease. As the next voltage peak immediately recharges the capacitor, the discharge period is of very small duration. Due to this continuous charge-discharge-recharge cycle very little ripple is observed in the filtered output. Moreover, output voltage is higher as it remains substantially near the peak value of rectifier output voltage.

4. Voltage Regulation Stage: Across the point D with respect to Ground one can measure
rectified and filtered +30V d.c. As the present circuit supplies 0-30 variable voltages the voltage regulator IC LM317T is used. The rectified & filtered d.c. is connected to pin1 of the regulator IC. The stabilized d.c. output is given to the load through pin 3 of LM317. The circuit also shows one decoupling capacitor C2, which provides ground path to the high frequency noise signals. This C2 must preferably be 0.1F tantalum capacitor. The Vref at pin-2 is typically 1.25V and the current flowing through C3 [Iadj] is 50 A. The electrolytic capacitor C3 provides ripple rejection C3 to 10F provides typically 80dB rejection. measured. At out point 0 to 30V stabilized or regulated d.c output is P1 Is The output voltage may be adjusted using P1. To set the output voltage to zero

first turned anti-clockwise and P2 turned fully clockwise the output voltage should then be approximately 30 V. If, due to component tolerance, the maximum output is less than 30V the value of R1 may require slight reduction. When constructing the circuit particular care should be taken to ensure that the 0 V rail is of low resistance (heavy gauge wire or wide p.c.b.track) as voltage drops along this line can cause poor regulation and ripple at the output. Note: While connecting the diodes and electrolytic capacitors the polarities must be taken into consideration. The transformers primary winding deals with 230V mains, care should be taken with it.

57

Source: Magnum Technologies.

REDUCED POWER SOURCE CIRCUIT DIAGRAM OF +5V FULL WAVE REGULATED POWER SUPPLY
C A D1 11 1 230 AC O C2 C1 D2 221 B Ground 0V C3 D IC 1 E +5V

X 1
Parts List:

SEMICONDUCTORS IC1 7805 Regulator IC D1,D2 1N4007 Rectifier Diodes CAPACITORS C1 C2,C3 MISCELLANEOUS X1

1 2

1000 f/25V Electrolytic 0.1F Ceramic Disc type

1 2

230V AC Pri,12-0-12 1Amp Sec 1 Transformer

Circuit Description: A d.c. power supply which maintains the output voltage constant
irrespective of a.c. mains fluctuations or load variations is known as regulated d.c. power supply. It is also referred as full-wave regulated power supply as it uses two diodes in full wave fashion with centre tap transformer.

1.Step-down Transformer : The transformer rating is 230V AC at Primary and 12-0-12V,


1Ampers across secondary winding. This transformer has a capability to deliver a current of 1Ampere, which is more than enough to drive any electronic circuit or varying load. The 12VAC 58
Source: Magnum Technologies.

appearing across the secondary is the RMS value of the waveform and the peak value would be 12 x 1.414 = 16.8 volts. This value limits our choice of rectifier diode as 1N4007, which is having PIV rating more than 16Volts.

2. Rectifier Stage : The two diodes D1 & D2 are connected across the secondary winding of the
transformer as a full-wave rectifier. During the positive half-cycle of secondary voltage, the end A of the secondary winding becomes positive and end B negative. This makes the diode D1 forward biased and diode D2 reverse biased. Therefore diode D1 conducts while diode D2 does not. During the negative half-cycle, end A of the secondary winding becomes negative and end B positive. Therefore diode D2 conducts while diode D1 does not. Note that current across the centre tap terminal is in the same direction for both half-cycles of input a.c. voltage. Therefore, pulsating d.c. is obtained at point C with respect to Ground.

3.Filter Stage : Here Capacitor C1 is used for filtering purpose and connected across the rectifier
output. It filters the a.c. components present in the rectified d.c. and gives steady d.c. voltage. As the rectifier voltage increases, it charges the capacitor and also supplies current to the load. When capacitor is charged to the peak value of the rectifier voltage, rectifier voltage starts to decrease. As the next voltage peak immediately recharges the capacitor, the discharge period is of very small duration. Due to this continuous charge-discharge-recharge cycle very little ripple is observed in the filtered output. Moreover, output voltage is higher as it remains substantially near the peak value of rectifier output voltage. This phenomenon is also explained in other form as: the shunt capacitor offers a low reactance path to the a.c. components of current and open circuit to d.c. component. During positive half cycle the capacitor stores energy in the form of electrostatic field. During negative half cycle, the filter capacitor releases stored energy to the load.

4.Voltage Regulation Stage : Across the point D and Ground there is rectified and filtered d.c.
In the present circuit KIA 7805 voltage regulator IC is used to get +5V regulated d.c. output. In the three terminals, pin 1 is input i.e., rectified & filtered d.c. is connected to this pin. Pin 2 is common pin and is grounded. The pin 3 gives the stabilized d.c. output to the load. The circuit shows two more decoupling capacitors C2 & C3, which provides ground path to the high frequency noise signals. Across the point E and ground +5V stabilized or regulated d.c output is measured, which can be connected to the required circuit. Note: While connecting the diodes and electrolytic capacitors the polarities must be taken into consideration. The transformers primary winding deals with 230V mains, care should be taken with it. 59
Source: Magnum Technologies.

POWER SUPPLY UNIT


The circuit needs two different voltages, +5V & +12V, to work. These dual voltages are supplied by this specially designed power supply. The power supply, unsung hero of every electronic circuit, plays very important role in smooth running of the connected circuit. The main object of this power supply is, as the name itself implies, to deliver the required amount of stabilized and pure power to the circuit. Every typical power supply contains the following sections: 1. Step-down Transformer: The conventional supply, which is generally available to the user, is 230V AC. It is necessary to step down the mains supply to the desired level. This is achieved by using suitably rated step-down transformer. While designing the power supply, it is necessary to go for little higher rating transformer than the required one. The reason for this is, for proper working of the regulator IC (say KIA 7812) it needs at least 2.5V more than the expected output voltage 2. Rectifier stage: Then the step-downed Alternating Current is converted into Direct Current. This rectification is achieved by using passive components such as diodes. If the power supply is designed for low voltage/current drawing loads/circuits (say +12V), it is sufficient to employ full-wave rectifier with centre-tap transformer as a power source. While choosing the diodes the PIV rating is taken into consideration. 3. Filter stage: But this rectified output contains some percentage of superimposed a.c. ripples. So to filter these a.c. components filter stage is built around the rectifier stage. The cheap, reliable, simple and effective filtering for low current drawing loads (say upto 50 mA) is done by using shunt capacitors. This electrolytic capacitor has polarities, take care while connecting the circuit. 4. Voltage Regulation: The filtered d.c. output is not stable. It varies in accordance with the fluctuations in mains supply or varying load current. This variation of load current is observed due to voltage drop in transformer windings, rectifier and filter circuit. These variations in d.c. output voltage may cause inaccurate or erratic operation or even malfunctioning of many electronic circuits. For example, the circuit boards which are implanted by CMOS or TTL ICs. The stabilization of d.c. output is achieved by using the three terminal voltage regulator IC. This regulator IC comes in two flavors: 78xx for positive voltage output and 79xx for negative voltage output. For example 7812 gives +12V output and 7912 gives -12V stabilized output. These regulator 60
Source: Magnum Technologies.

KIA 78xx Series

1 2

ICs have in-built short-circuit protection and auto-thermal cutout provisions. If the load current is very high the IC needs heat sink to dissipate the internally generated power.

CIRCUIT DIAGRAM OF +5V & +12V FULL WAVE REGULATED POWER SUPPLY
IC1 7812 IC1 7805

D1 1

+12V

9V +5V

C1

C2

C3

C4

D2 1

X1
Parts List:
SEMICONDUCTORS IC1 7812 Regulator IC IC2 D1& D2 CAPACITORS C1 C2 to C4 MISCELLANEOUS X1 7805 Regulator IC 1N4007 Rectifier Diodes 1 1 2

1000 f/25V Electrolytic 0.1F Ceramic Disc type

1 3

230V AC Pri,14-0-14 1Amp Sec Transformer

Circuit Description:
A d.c. power supply which maintains the output voltage constant irrespective of a.c. mains fluctuations or load variations is known as regulated d.c. power supply. It is also referred as full-wave 61
Source: Magnum Technologies.

regulated power supply as it uses four diodes in bridge fashion with the transformer. This laboratory power supply offers excellent line and load regulation and output voltages of +5V & +12 V at output currents up to one amp. 1. Step-down Transformer: The transformer rating is 230V AC at Primary and 12-0-12V, 1Ampers across secondary winding. This transformer has a capability to deliver a current of 1Ampere, which is more than enough to drive any electronic circuit or varying load. The 12VAC appearing across the secondary is the RMS value of the waveform and the peak value would be 12 x 1.414 = 16.8 volts. This value limits our choice of rectifier diode as 1N4007, which is having PIV rating more than 16Volts. 2. Rectifier Stage: The two diodes D1 & D2 are connected across the secondary winding of the transformer as a full-wave rectifier. During the positive half-cycle of secondary voltage, the end A of the secondary winding becomes positive and end B negative. This makes the diode D1 forward biased and diode D2 reverse biased. Therefore diode D1 conducts while diode D2 does not. During the negative half-cycle, end A of the secondary winding becomes negative and end B positive. Therefore diode D2 conducts while diode D1 does not. Note that current across the centre tap terminal is in the same direction for both half-cycles of input a.c. voltage. Therefore, pulsating d.c. is obtained at point C with respect to Ground. 3. Filter Stage: Here Capacitor C1 is used for filtering purpose and connected across the rectifier output. It filters the a.c. components present in the rectified d.c. and gives steady d.c. voltage. As the rectifier voltage increases, it charges the capacitor and also supplies current to the load. When capacitor is charged to the peak value of the rectifier voltage, rectifier voltage starts to decrease. As the next voltage peak immediately recharges the capacitor, the discharge period is of very small duration. Due to this continuous charge-discharge-recharge cycle very little ripple is observed in the filtered output. Moreover, output voltage is higher as it remains substantially near the peak value of rectifier output voltage. This phenomenon is also explained in other form as: the shunt capacitor offers a low reactance path to the a.c. components of current and open circuit to d.c. component. During positive half cycle the capacitor stores energy in the form of electrostatic field. During negative half cycle, the filter capacitor releases stored energy to the load. 4. Voltage Regulation Stage: Across the point D and Ground there is rectified and filtered d.c. In the present circuit KIA 7812 three terminal voltage regulator IC is used to get +12V and KIA 7805 voltage regulator IC is used to get +5V regulated d.c. output. In the three terminals, pin 1 is input i.e., rectified & filtered d.c. is connected to this pin. Pin 2 is common pin and is grounded. The pin 3 gives the stabilized d.c. output to the load. The circuit shows two more decoupling capacitors C2 & C3, which 62
Source: Magnum Technologies.

provides ground path to the high frequency noise signals. Across the point E and F with respect to ground +5V & +12V stabilized or regulated d.c output is measured, which can be connected to the required circuit.

4.Project Construction Guidelines


Read these hints carefully before start building your Project. Allow sufficient time to read & be sure you understand everything perfectly. Start your work where you can be comfortable and can leave the Project spread out between wiring sessions. Be cool & have patient... project construction should be educative and fun! Stopping at the end of the every stage and checking, step-by-step, will help you avoid needless mistakes. This can save you a lot of double checking and time consuming trouble-shooting later on. Before start assembling the Project, read some basic electronic theory about active & passive components, how they work, parameters, lead identifications etc. At one session, work only as long as you enjoys it. Unpacking the Project Kit: Unpack the project carefully and check each component against the Component List. Observe the PCB, Circuit diagram sheet & components for any physical damages. Check that you got the Project Kit you actually intended for!

Assembling the Project Kit: Before starts assembling the project keep all the necessary needed tools on your workbench. Check the PCB for the broken tracks, by testing continuity between each track. By holding the PCB slightly inclined towards the light, one can check the copper layouts physical condition on the PCB. Identify each section of the circuit on the PCB layout & get familiar with the board. Check each component & be assuring that they are in good and working condition. Special care should be taken while dealing with the sensors or sparingly available components. Clean the component leads, tracks (if they are coated with corrosive layer), and pads.

Soldering the Project Kit Before start soldering keep all the necessary tools required for it viz., suitably rated Soldering Iron with clean tip, tweezers, nose-pliers, small & medium size screw drivers, flux, sharp knife etc. 63
Source: Magnum Technologies.

The PCB has two sides. One is the copper foil side and the other, the component side. You have to mount the components on the component side, solder them on the copper layout side. Keep below points in memory while soldering Remember that 90% of all non-functioning of project are due to bad soldering & poor Switch OFF the fan, if it is running! Position the work so that gravity tends to keep the The new soldering irons tip should be filed to remove the steel or copper oxide coating. The soldering iron will reach its operating temperature within 3 to 5 minutes, after it is For good soldered connections, you must keep the soldering iron tip clean- wipe it often Keep hot tip of the soldering iron on a piece of metal so that excess heat is dissipated. Make sure that the connection to be soldered is clean. Wax frayed insulations and connections. solder where you want it. Then apply little solder on the hot tip. switched on, and should be left on during the working period. with a damp sponge or cloth.

other foreign substances cause poor connections. Clean the component leads wires, lugs, etc., with a blade or a knife to remove the rust and dust before soldering.

Bend the lead at a 45 angle to the PCB. Use just enough solder to cover the lead and the copper foil area of the connection to

be soldered. Excess solder can bridge across from one foil path to another foil and cause a short circuit. Apply enough heat to the foil and the lead to allow the solder to spread freely. A good Do not over heat the components or the PCB. Excess heat may spoil the PCB or The PCB or components should not vibrate while soldering otherwise you will have a Remember larger metal surfaces take longer time to heat e.g. clamps of Coils, While using the de-soldering pump to clear the plugged holes/pads special care should soldered joint will look smooth, shining and solder equally spreaded along the pad. damage the components. The general time of soldering is 2 to 3 seconds. dry or a cold joint. transformers, heat sinks etc. be taken, as the excessive heat or pulling action may damage the copper foils. The leads of resistors, capacitors, and similar components are generally much longer than needed to make the required connections. Cut the leads with a diagonal cutter or a nail cutter to the proper length before installing the part; the leads should be just long enough to reach their connecting points. 64
Source: Magnum Technologies.

Apply small amount of flux to the tinned & cleaned leads of the soldering components. Start soldering your Project Kit from the power-supply section viz, step-down transformer, diodes, capacitors & regulators. First check the components, clean them, and then solder one-by-one on the PCB. Next step is to check the voltages at different points, across transformer primary & secondary windings, after rectifier stage, filter stage & regulator stage respectively. Also check that this voltage is available at all points of the PCB, especially ICs +Vcc pins.

Now solder the next section of your circuit and check for its integrity with the whole project. This step-by-step procedure must continue throughout the project building session. While soldering the order (usually from big-in-size towards small-in-size components) must be IC bases, transformers, transistors, electrolytic capacitors, coils, ceramic capacitors, resistors etc. While soldering the sensors, special modules care should be taken that they are not connected in the reverse order or wrong polarity insertion took place. To prepare a length of connecting wire or jumper wire, you will normally remove 4mm of insulation from each end. For stranded wire, apply solder to the ends to hold the strands together. Resistors should be mounted in either vertical or horizontal fashion. Check the color code for the proper value before soldering them. Observe the polarity of the electrolytic capacitors & values of the MKT, Ceramic Disc type capacitors. Push the leads of the capacitors into the holes until you cannot push them further. Bend the leads a little, solder and cut off excess lead lengths.

Check the transistors type, whether NPN or PNP, and identify the pins correctly on the PCB. The band indicates Cathode in Diodes, + mark indicates positive polarity in Capacitors, dot or notch indicates the Collector lead of the Transistor.

Calibration/Fine Tuning/Adjusting/Aligning the Project Kit When the whole circuit is soldered and tested for integrity in step-by-step procedure as explained above, take a break! This must be a fresh, new session for you. Because this session demands your cool and fresh mind-set, as lot of back tracking is supposed to do here. A little time spent carefully performing the stated steps will be rewarded with excellent performance. Before proceeding in this session gather all the necessary testing instruments on the workbench. Carefully handle the testing instruments, as they are costly electronic-gadgets to get. Know how to operate them, before employing them in your project testing session. 65
Source: Magnum Technologies.

Trouble-shooting the Project Kit: First visually check for the physical disorder, improper soldering or poor connections on the PCB. Check the mains cord, transformer output and power-supply Check that all Components are in their proper location and are installed correctly as per the Circuit diagram supplied with the Project Kit.

66

Source: Magnum Technologies.

5. Application & Future Developments


APPLICATIONS: 1. The project is used to secure and avoid the road accidents. 2. It can be used as part for automation of s or Public Transportation. 3. This system is used to trace the culprit vehicles by police persons. 4. This project can also be used by Cargo Companies to intimate their on-road vehicles about the next delivery spot or assignment. 5. This system can be used to time keeping purpose in public transportation, such as departure & arrival timings, number of rotations each vehicle turned etc. Advantages: This application is very useful on any kind of vehicle. This application is easy to install and easy to operate. Manpower can be saved by implementing auto detecting circuits. More reliable than manual Operation.

Future Developments
The following modifications can be made to the present circuit, which leads to still smarter project. Present Project can handle only two vehicles, which want to pass the one after the other, or one-byone. This will not happen in actual case. The two track road allows two vehicles at a time, and this complicates the working of the Vehicle Detection Stage. One can enhance the vehicle detection stage to detect any number of vehicles at a time. The ID of vehicles can be made more sophisticated and secured by implementing Microcontroller/PC technology. This system can also be used as advanced Global Positioning System or as an advanced system for Automation and Vehicle Tracking. This project can be efficiently used in Vehicle Tracking & Automation with further improvements. Such as, the vehicle owner can pay the toll fee through his credit card by mentioning so in his application form. Hence forth, whenever he come across such s, the System detects the vehicle and charge the fee to his credit card, and allows him to pass the gate without even interrupting him. That makes the owner to feel-free and saves his time & energy.

67

Source: Magnum Technologies.

This project is open for developments from all sides. It is the users imagination which limits the working of this project. One can go on adding the extra, rich features to this project.

BIBLIOGRAPHY
Electronic Communication Systems George Kennedy Electronics in Industry - George M.Chute Principles of Electronics - V.K.Mehta www.electronicsforu.com www.howstuffworks.com Telecommunication Switching, Traffic and Networks J.E.Flood

68

Source: Magnum Technologies.

You might also like