98
TRAFFIC LIGHTS CONTROLLER PROJECT TRAFFIC LIGHTS CONTROLLER MINOR PROJECT REPORT UNIVERSITY INSTITUTE OF ENGINEERING AND TECHNOLOGY PANJAB UNIVERSITY SUBMITTED BY: AAKASH GUPTA (UE5501) AANCHAL MANCHANDA (UE5502) ELECTRONICS AND COMMUNICATION ENGINEERING (7 th SEMESTER)

Minor Report

Embed Size (px)

DESCRIPTION

traffic lights controller,project report,soldering,circuit diagram,program,working.

Citation preview

Page 1: Minor Report

TRAFFIC LIGHTS CONTROLLER PROJECT

TRAFFIC LIGHTS CONTROLLER

MINOR PROJECT REPORT

U N I V E R S I T Y I N S T I T U T E O F E N G I N E E R I N G A N D T E C H N O L O G YP A N J A B U N I V E R S I T Y

SUBMITTED BY:

AAKASH GUPTA (UE5501)

AANCHAL MANCHANDA (UE5502)

SUNIL AGGRAWAL (UE5568)

ELECTRONICS AND COMMUNICATION ENGINEERING (7th SEMESTER)

Page 2: Minor Report
Page 3: Minor Report

ACKNOWLEDGEMENT

We express our sincere thanks and deep sense of gratitude towards Miss Preeti Gupta, under whose able guidance we were able to implement this thought of ours into a reality.

Her timely and incisive review, comments and suggestions throughout the project enabled us to modify the project before things went out of our hand. We thank her for everything, from conception of getting things done practically and a lot of steps along the way, which helped us in overcoming our difficulties and making the project a successful endeavour.

We are also grateful to Miss Renu Vig, Head of Deptt., Electronics and Communication. She helped us immensely by providing us with all the equipment important for our project.

Aakash Gupta (UE5501)

Aanchal Manchanda (UE5502)

Sunil Aggarwal (UE5568)

Page 4: Minor Report

CONTENTS

1. Introduction

2. Circuit diagram

3. Components Used

a) Resistors

b) Capacitors

c) Diodes

d) Power Supply

e) Printing Wiring Boards

f) Wiring Materials

g) Micro-Controller

4. Soldering

a) Soldering Tools

b) Process of Soldering

5. Keil

a) Working With Keil

6. About the Project

7. Program Code

8. Further Scope Of The Project

9. References

Page 5: Minor Report

Introduction

The traffic light, also known as traffic signal, stop light, traffic lamp, stop-and-go lights, robot or semaphore, is a signaling device positioned at a road intersection, pedestrian crossing, or other location. Its purpose is to indicate, using a series of colours (Red - Amber - Green), the correct moment to stop, drive, ride or walk, using a universal colour code (and a precise sequence, for those who are colour blind).

Traffic lights for vehicles usually contain three lamps: red, orange or yellow (officially amber), and green. In some systems, a flashing amber means that a motorist may go ahead with care if the road is clear, giving way to pedestrians and to other road vehicles that may have priority. A flashing red is treated as a regular stop sign. Although the word "yellow" is common parlance in the United States, the color of the actual lamp is usually only slightly more yellowish than the amber used in Europe.

Traffic lights for pedestrians normally have two main lights: a red light that means 'stop' and a green light that means 'go' (or, more correctly, 'proceed with caution'). There is usually a flashing phase (red in the US, green in Europe) that means 'complete your crossing'. In most locales in North America, the colors used are a red-orange ("Portland orange") for "stop/wait" and a bluish-

Page 6: Minor Report

white ("lunar") for "go." While the "walk" signal is generally a walking human figure, North American pedestrian signals usually show an upraised hand for "stop," while most other countries display a standing human figure. Some older American signals display the verbal commands "Walk" (lunar white or green) and "Don't Walk" or "Wait" (red-orange).

The use of these colours is thought to originate from nautical right-of-way. Usually, the red light contains some orange in its hue, and the green light contains some blue, to provide some support for people with red-green colour blindness.

Traffic lights for special vehicles (such as buses or trams) may use other systems, such as vertical vs. horizontal bars of white light. In Portland, Oregon, the tram signals feature a horizontal white bar and an orange vertical bar.

In most countries, the sequence is green (go), amber (prepare to stop), and red (stop). In some systems, however, just before red changes to green, both red and amber are lit. It is customary for drivers to select neutral and/or use the handbrake at red lights; the additional phase is intended to give the driver time to select first gear or release the handbrake before the light turns green, but in practice is treated as an invitation to go before the green light is showing.

Technology

Optics and lighting

A modern British LED traffic light in Portsmouth.

Page 7: Minor Report

LED traffic lights in Örnsköldsvik, Sweden.

In the mid 1990s, cost-effective traffic light lamps using light-emitting diodes (LEDs) were developed; prior to this date traffic lights were designed using incandescent or halogen light bulbs. Unlike the incandescent-based lamps, which use a single large bulb, the LED-based lamps consist of an array of LED elements, arranged in various patterns. When viewed from a distance, the array appears as a continuous light source.

LED-based lamps (or 'lenses') have numerous advantages over incandescent lamps; among them are:

Much greater energy efficiency (can be solar-powered).

Much longer lifetime between replacement, measured in years rather than months. Part of the longer lifetime is due to the fact that the some light is still displayed even if some of the LEDs in the array are dead.

Brighter illumination with better contrast against direct sunlight, also called 'phantom light'.

The ability to display multiple colours and patterns from the same lamp. Individual LED elements can be enabled or disabled, and different colour LEDs can be mixed in the same lamp.

Much faster switching.

Instead of sudden burn-out like incandescent-based lights, LEDs start to gradually dim when they wear out, warning transportation maintenance departments well in advance as to when to change the light. Occasionally, particularly in green LED units, segments prone to failure will flicker rapidly beforehand.

Page 8: Minor Report

The operational expenses of LED-based signals are far lower than equivalent incandescent-based lights. As a result, most new traffic light deployments in the United States, Canada and elsewhere have been implemented using LED-based lamps; in addition many existing deployments of incandescent traffic lights are being replaced. In 2006, Edmonton, Alberta, Canada completed a total refit to LED-based lamps in the city's over 12,000 intersections and all pedestrian crosswalks. Many of the more exotic traffic signals discussed on this page would not be possible to construct without using LED technology. However, colour-changing LEDs are in their infancy and may surpass the multi-colour array technology.

In some areas, LED-based signals have been fitted (or retrofitted) with special Fresnel lenses (Programmed Visibility or 'PV' lenses) and/or diffusers to limit the line of sight to a single lane. These signals typically have a "projector"-like visibility; and maintain an intentionally limited range of view. Because the LED lights don't generate a significant amount of heat, heaters may be necessary in areas which receive snow, where snow can accumulate within the lens area and limit the visibility of the indications.[18]

Another new LED technology is the use of CLS (Central Light Source) optics. These comprise around 7 high-output LEDs (sometimes 1 watt) at the rear of the lens, with a diffuser to even out and enlarge the light. This gives a uniform appearance, more like traditional halogen or incandescent luminaries.

Replacing halogen or incandescent reflector and bulb assemblies behind the lens with an LED array can give the same effect. This also has its benefits: minimal disruption, minimal work, minimal cost and the reduced need to replace the entire signal head (housing).

Control and coordination

Traffic signal phase changes are based on one of three systems: pre-timed, semi-actuated, and fully-actuated. The simplest control system uses a timer (fixed-time): each phase of the signal lasts for a specific duration before the next phase occurs; this pattern repeats itself regardless of traffic. Many older traffic light installations still use these, and timer-based signals are effective in

Page 9: Minor Report

one way grids where it is often possible to coordinate the traffic lights to the posted speed limit. They are however quite disadvantageous when the signal timing of an intersection would profit from being adapted to the dominant flows changing over the time of the day.

REASON

In our project we have studied the control of traffic in accordance to the mass density of the traffic. The population of Chandigarh has increased 3 times since 1971 and reached the amounts of 9,00,914 (according to 2001 census), while the number of vehicles shot up by 42 times during these 30 years. According to the survey done by Tribune news Service on August 19, 2000, the average number of vehicles in Chandigarh is 6000 per lakh of population i.e. 6%.

According to Times of India, the number of vehicular in the city is whizzing ahead at full throttle. From a modest 940 vehicles in different categories in 1967, the figure has today zoomed to over 5.52 lakh, with a total of 29,437 vehicles being added in 2003. According to latest figures put together by the Registering and Licensing Authority (RLA), the count of vehicles registered in the city currently stands at 5,52,260. Fragmenting these figures, the city has 3.95 lakh two-wheelers, 1.46 lakh cars and jeeps, and about 11,000 vehicles in other categories.

A major impact of the same can be seen on the most frequently used roads. As thousands of people ply to the city daily from the satellite towns of Mohali (in Punjab) and Panchkula (in Haryana), the city roads are virtually bursting at the seams during the peak office hours. According to Tribune on January 12, heavy density of traffic is seen on the four main roads of Chandigarh — Madhya Marg, Lok Path, Himalaya Marg and Udyog Path.About 83,000 vehicles cross the Madhya Marg (the road from the PGI to Panchkula) daily. While, at least 54,757 vehicles cross Lok Path daily, Himalaya Marg has a daily rush of 64,521 vehicles. 52,231 vehicles cross Udyog Path every day. These roads see such a high inflow of traffic because they link the different sections of the city to the commercial hubs of the city.

Page 10: Minor Report

CIRCUIT DIAGRAM

Page 11: Minor Report

Components Specification

Power Supply:

Transformer = 230V to 12V

Voltage Regulator = 12V to 5V

C1 = 2200 uF

R1 = 1 Kohm

D3,D4 = 1N4007

Controller:

R2 – R13 = 560 ohm

R1 = 10 Kohm

C1= 10 uF

C2,C3 = 33pF

Crystal Oscillator = 11.0592 Mhz

Micro-Controller = 89S51

Page 12: Minor Report

COMPONENTS USED

Resistor

The resistor's function is to reduce the flow of electric current.This symbol is used to indicate a resistor in a circuit diagram, known as a schematic.

Resistance value is designated in units called the "Ohm." A 1000 Ohm resistor is typically shown as 1K-Ohm ( kilo Ohm ), and 1000 K-Ohms is written as 1M-Ohm(megohm).

There are two classes of resistors; fixed resistors and the variable resistors. They are also classified according to the material from which they are made. The typical resistor is made of either carbon film or metal film. There are other types as well, but these are the most common.The resistance value of the resistor is not the only thing to consider when selecting a resistor for use in a circuit. The "tolerance" and the electric power ratings of the resistor are also important.The tolerance of a resistor denotes how close it is to the actual rated resistence value. For example, a ±5% tolerance would indicate a resistor that is within ±5% of the specified resistance value.The power rating indicates how much power the resistor can safely tolerate.

The maximum rated power of the resistor is specified in Watts.Power is calculated using the square of the current ( I2 ) x the resistance value ( R ) of the resistor. If the maximum rating of the resistor is exceeded, it will become extremely hot, and even burn.Resistors in electronic circuits are typically rated 1/8W, 1/4W, and 1/2W. 1/8W is almost always used in signal circuit applications.When powering a light emitting diode, a comparatively large current flows through the resistor.

Page 13: Minor Report

Resistance value

The resistance value is displayed using the color code( the colored bars/the colored stripes ), because the average resistor is too small to have the value printed on it with numbers.You had better learn the color code, because almost all resistors of 1/2W or less use the color code to display the resistance value.

Fixed Resistors

A fixed resistor is one in which the value of its resistance cannot change.

Carbon film resistors

This is the most general purpose, cheap resistor. Usually the tolerance of the resistance value is ±5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used.Carbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistors are recommended for use in analog circuits. The physical size of the different resistors are as follows.

From the top of the photograph1/8W1/4W1/2W

Rough size

Rating power(W)

Thickness(mm)

Length(mm)

1/8 2 3

1/4 2 6

1/2 3 9

Resistor color code

Page 14: Minor Report

Color Value MultiplierTolerance(%)

Black 0 0 -

Brown 1 1 ±1

Red 2 2 ±2

Orange 3 3 ±0.05

Yellow 4 4 -

Green 5 5 ±0.5

Blue 6 6 ±0.25

Violet 7 7 ±0.1

Gray 8 8 -

White 9 9 -

Gold - -1 ±5

Silver - -2 ±10

None - - ±20

Example 1(Brown=1),(Black=0),(Orange=3)

10 x 103 = 10k ohmTolerance(Gold) = ±5%

Example 2(Yellow=4),(Violet=7),(Black=0),(Red=2)

470 x 102 = 47k ohmTolerance(Brown) = ±1%

Capacitor

Page 15: Minor Report

The capacitor's function is to store electricity, or electrical energy.The capacitor also functions as a filter, passing alternating current (AC), and blocking direct current (DC).This symbol is used to indicate a capacitor in a circuit diagram.

The capacitor is constructed with two electrode plates facing each other, but separated by an insulator.

When DC voltage is applied to the capacitor, an electric charge is stored on each electrode. While the capacitor is charging up, current flows. The current will stop flowing when the capacitor has fully charged.

When a circuit tester, such as an analog meter set to measure resistance, is connected to a 10 microfarad (µF) electrolytic capacitor, a current will flow, but only for a moment. You can confirm that the meter's needle moves off of zero, but returns to zero right away.When you connect the meter's probes to the capacitor in reverse, you will note that current once again flows for a moment. Once again, when the capacitor has fully charged, the current stops flowing. So the capacitor can be used as a filter that blocks DC current. (A "DC cut" filter.)However, in the case of alternating current, the current will be allowed to pass. Alternating current is similar to repeatedly switching the test meter's probes back and forth on the capacitor. Current flows every time the probes are switched.

The value of a capacitor (the capacitance), is designated in units called the Farad(F).The capacitance of a capacitor is generally very small, so units such as the microfarad ( 10-6F ), nanofarad ( 10-9F ), and picofarad (10-12F ) are used.Recently, an new capacitor with very high capacitance has been developed. The Electric Double Layer capacitor has capacitance designated in Farad units. These are known as "Super Capacitors."

Page 16: Minor Report

Sometimes, a three-digit code is used to indicate the value of a capacitor. There are two ways in which the capacitance can be written. One uses letters and numbers, the other uses only numbers. In either case, there are only three characters used. [10n] and [103] denote the same value of capacitance. The method used differs depending on the capacitor supplier. In the case that the value is displayed with the three-digit code, the 1st and 2nd digits from the left show the 1st figure and the 2nd figure, and the 3rd digit is a multiplier which determines how many zeros are to be added to the capacitance. Picofarad ( pF ) units are written this way.For example, when the code is [103], it indicates 10 x 103, or 10,000pF = 10 nanofarad( nF ) = 0.01 microfarad( µF ).If the code happened to be [224], it would be 22 x 104 = or 220,000pF = 220nF = 0.22µF.Values under 100pF are displayed with 2 digits only. For example, 47 would be 47pF.

The capacitor has an insulator( the dielectric ) between 2 sheets of electrodes. Different kinds of capacitors use different materials for the dielectric.

Electrolytic Capacitors (Electrochemical type capacitors)

Aluminum is used for the electrodes by using a thin oxidization membrane.Large values of capacitance can be obtained in comparison with the size of the capacitor, because the dielectric used is very thin.The most important characteristic of electrolytic capacitors is that they have polarity. They have a positive and a negative electrode.This means that it is very important which way round they are connected. If the capacitor is subjected to voltage exceeding its working voltage, or if it is connected with incorrect polarity, it may burst.

Generally, in the circuit diagram, the positive side is indicated by a "+" (plus) symbol.

Page 17: Minor Report

Electrolytic capacitors range in value from about 1µF to thousands of µF. Mainly this type of capacitor is used as a ripple filter in a power supply circuit, or as a filter to bypass low frequency signals, etc. Because this type of capacitor is comparatively similar to the nature of a coil in construction, it isn't possible to use for high-frequency circuits. (It is said that the frequency characteristic is bad.)

The photograph on the is an example of the different values of electrolytic capacitors in which the capacitance and voltage differ.From the left to right:1µF (50V) [diameter 5 mm, high 12 mm] 47µF (16V) [diameter 6 mm, high 5 mm] 100µF (25V) [diameter 5 mm, high 11 mm]

220µF (25V) [diameter 8 mm, high 12 mm] 1000µF (50V) [diameter 18 mm, high 40 mm]

In the photograph to the right, the mark indicating the negative lead of the component can be seen.

Page 18: Minor Report

Ceramic Capacitors

Ceramic capacitors are constructed with materials such as titanium acid barium used as the dielectric. Internally, these capacitors are not constructed as a coil, so they can be used in high frequency applications. Typically, they are used in circuits which bypass high frequency signals to ground.These capacitors have the shape of a disk. Their capacitance is comparatively small.

The capacitor on the left is a 100pF capacitor with a diameter of about 3 mm.The capacitor on the right side is printed with 103, so 10 x 103pF becomes 0.01 µF. The diameter of the disk is about 6 mm.Ceramic capacitors have no polarity.Ceramic capacitors should not be used for analog circuits, because they can distort the signal.

Page 19: Minor Report

Diode

A diode is a semiconductor device which allows current to flow through it in only one direction. Although a transistor is also a semiconductor device, it does not operate the way a diode does. A diode is specifically made to allow current to flow through it in only one direction.Some ways in which the diode can be used are listed here.1. A diode can be used as a rectifier that converts AC (Alternating Current) to DC (Direct Current) for a power supply device.2. Diodes can be used to separate the signal from radio frequencies.3. Diodes can be used as an on/off switch that controls current.This symbol is used to indicate a diode in a circuit diagram.

The meaning of the symbol is (Anode) (Cathode).Current flows from the anode side to the cathode side.

Although all diodes operate with the same general principle, there are different types suited to different applications. For example, the following devices are best used for the applications noted.

Voltage regulation diode (Zener Diode)

The circuit symbol is .It is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize at a certain voltage when that voltage is applied in the opposite direction.

Page 20: Minor Report

Light emitting diode

The circuit symbol is .This type of diode emits light when current flows through it in the forward direction. (Forward biased.)

The graph shows the electrical characteristics of a typical diode.

When a small voltage is applied to the diode in the forward direction, current flows easily.Because the diode has a certain amount of resistance, the voltage will drop slightly as current flows through the diode. A typical diode causes a voltage drop of about 0.6 - 1V (VF) (In the case of silicon diode, almost 0.6V) This voltage drop needs to be taken into consideration in a circuit which uses many diodes in series. Also, the amount of current passing through the diodes must be considered.

When voltage is applied in the reverse direction through a diode, the diode will have a great resistance to current flow.Different diodes have different characteristics when reverse-biased. A given

Page 21: Minor Report

diode should be selected depending on how it will be used in the circuit.The current that will flow through a diode biased in the reverse direction will vary from several mA to just µA, which is very small.

Rectification / Switching / Regulation Diode

The stripe stamped on one end of the diode shows indicates the polarity of the diode.The stripe shows the cathode side.The top two devices shown in the picture are diodes used for rectification. They are made

to handle relatively high currents. The device on top can handle as high as 6A, and the one below it can safely handle up to 1A.However, it is best used at about 70% of its rating because this current value is a maximum rating.The third device from the top (red color) has a part number of 1S1588. This diode is used for switching, because it can switch on and off at very high speed. However, the maximum current it can handle is 120 mA. This makes it well suited to use within digital circuits. The maximum reverse voltage (reverse bias) this diode can handle is 30V.The device at the bottom of the picture is a voltage regulation diode with a rating of 6V. When this type of diode is reverse biased, it will resist changes in voltage. If the input voltage is increased, the output voltage will not change. (Or any change will be an insignificant amount.) While the output voltage does not increase with an increase in input voltage, the output current will. This requires some thought for a protection circuit so that too much current does not flow.The rated current limit for the device is 30 mA.

Page 22: Minor Report

Generally, a 3-terminal voltage regulator is used for the stabilization of a power supply. Therefore, this diode is typically used to protect the circuit from momentary voltage spikes. 3 terminal regulators use voltage regulation diodes

inside.

Rectification diodes are used to make DC from AC. It is possible to do only 'half wave rectification' using 1 diode. When 4 diodes are combined, 'full wave rectification' occurs.Devices that combine 4 diodes in one package are called diode bridges. They are used for full-wave rectification.

The photograph shows the example of diode bridges.

Page 23: Minor Report

Light Emitting Diode ( LED )

Light emitting diodes must be chosen according to how they will be used, because there are various kinds.The diodes are available in several colors. The most common colors are red and green, but there are even blue ones.

The device on the far right in the photograph combines a red LED and green LED in one package. The component lead in the middle is common to both LEDs. As for the remaining two leads, one side is for the green, the other for the red LED. When both are turned on simultaneously, it becomes orange.

When an LED is new out of the package, the polarity of the device can be determined by looking at the leads. The longer lead is the Anode side, and the short one is the Cathode side.

It is possible to use an LED to obtain a fixed voltage.The voltage drop (forward voltage, or VF) of an LED is comparatively stable at just about 2V.

Page 24: Minor Report

Power Supply

The power supply section is the important one. It should deliver constant output regulated power supply for successful working of the project. A 0-12V/500 mA transformer is used for this purpose. The primary of this transformer is connected in to main supply through on/off switch& fuse for protecting from overload and short circuit protection. The secondary is connected to the diodes to convert 12V AC to 12V DC voltage. And filtered by the capacitors ,Which is further regulated to +5v, by using IC 7805

LM7805

The LM78MXX series of three-terminal positive voltage regulators employ built-in current limiting, thermal shutdown, and safe-operating area protection which makes them virtually immune to damage from output overloads.

With adequate heat sinking, they can deliver in excess of 0.5A output current. Typical applications would include local (on-card) regulators which can eliminate the noise and degraded performance associated with single-point regulation.

Printed Wiring Boards

Page 25: Minor Report

When assembling an electronic circuit, a board is needed on which the components can be mounted and wired together. This board is called a Printed Wiring Board (PWB).In Japan, the printed wiring board used to be called a "Printed Circuit Board." Nowadays in Japan the name "Printed Circuit Board" is not used because the initials of "Printed Circuit Board" are "PCB." PCB also stands for "Polychlorinated Biphenyls (PCBs)," which is a poison. So in Japan, we refer to the boards as "Printed Wiring Boards." In other countries, they are still referred to as "Printed Circuit Boards," or PCBs.

Making a PWB takes a lot of work, and can be very difficult. For this reason, for many hand-made circuits, I often use a universal PWB.The universal PWB consists of an insulation board drilled with .8mm holes at 0.1 inch (2.54 mm) intervals. The board is completely covered with these holes from edge to edge. The insulation board is comprised of fiberglass (glass epoxy), paper epoxy, or bakelite plastic.Centered around each hole on the bottom of the PWB is an (approximately) 2mm copper leaf (known as the "land" or "pad").

To use the board, the parts are mounted on the face of the board, and the component leads are passed through the nearest holes, to project through the bottom of the board, where the wires can be soldered together.The interval between the holes is 0.1 inches (2.54 mm), so DIP or SIP ICs can be easily mounted.

The photograph shows a PWB made of glass epoxy. The color is green.

Page 26: Minor Report

Paper epoxy boards have a beige color. In case of bakelite, the color is thin brown.

As for the size of the board, there are several kinds by the number of the holes.From the left side in the photograph55 x 40 holes (size 160 x 115 mm)30 x 25 holes (size 95 x 72 mm)25 x 15 holes (size 72 x 47 mm)

There are various sizes in addition to what I have shown, so you can select a board according to your needs.The boards can also be cut to size.

On the top right in the photograph, the back side is shown. The copper leaf on this board has been pre-soldered ("tinned") to make soldering easier, so it has a silver color. If the board has not been pre-soldered, then it is seen to have a copper color.

Wiring materials

Wire is used to electrically connect circuit parts, devices, equipment etc.There are various kinds of wiring materials. On this page, I introduce the type that is used for the assembly of electronic circuits.

The different types of wire can be divided largely into two categories: single wire and twisted strand wire. It really doesn't matter which kind you use for a given application, but usually, single wire is used to connect

Page 27: Minor Report

devices (resistors, capacitors ect) together on the PWB. (Parts that don't move) It is also used for jumper wiring.Twisted strand wire can bend freely, so it can be used for wiring on the PWB, and also to connect discrete pieces of equipment.If single wire is used to connect separate equipment, it will break soon, as it is not very flexible. It is convenient to use the single tin coated wire of the diameter 0.32 mm for the wiring of PWB. If the diameter is larger, soldering becomes a little bit difficult. And if the diameter is too thin, it becomes difficult to bend the wire the way you want it to stay.

MICROCONTROLLER

A microcontroller (or MCU) is a computer on-a-chip used to control electronic devices. It is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC). A typical microcontroller contains all the memory and interfaces needed for a simple application, whereas a general purpose microprocessor requires additional chips to provide these functions.

A microcontroller is a single integrated circuit with the following key features:

central processing unit - usually small and simple input/output interfaces such as serial ports

Page 28: Minor Report

peripherals such as timers and watchdog circuits

RAM for data storage

ROM for program storage

clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit

This integration drastically reduces the number of chips and the amount of wiring and PCB space that would be needed to produce equivalent systems using separate chips.

Microcontrollers are inside many kinds of electronic equipment (see embedded system). They are the vast majority of all processor chips sold. Over 50% are "simple" controllers, and another 20% are more specialized digital signal processors (DSPs). A typical home in a developed country is likely to have only one or two general-purpose microprocessors but somewhere between one and two dozen microcontrollers. They can be found in almost any electrical device, washing machines, microwave ovens, telephones etc.

Description

In addition to the key features listed above, most microcontrollers today take further advantage of not needing external pins for memory buses. They can afford to use a Harvard architecture: separate memory buses for instructions and data, allowing accesses to take place concurrently.

Microcontrollers also usually have a variety of input/output interfaces. Serial I/O (UARTs) are very common, and many include analog-to-digital converters, timers, or specialized serial communications interfaces like I²C, Serial Peripheral Interface and Controller Area Network.

Originally, microcontrollers were only programmed in assembly language, or later in C code. Recent microcontrollers integrated with on-chip debug circuitry accessed by In-circuit emulator via JTAG enables a programmer to debug the software of an embedded system with a debugger.

Page 29: Minor Report

Some microcontrollers have begun to include a built-in high-level programming language interpreter for greater ease of use. The Intel 8052 and Zilog Z8 were available with BASIC very early on, and BASIC is more recently used in the popular BASIC Stamp MCUs.

Microcontrollers trade speed and flexibility against ease of equipment design and low cost. Manufacturers have to balance the need to minimize the chip size against additional functionality.

Finally, it must be mentioned that microcontroller architectures are available from many different vendors in so many varieties that they could rightly belong to a category of their own. Chief among these are the 8051, Z80 and ARM derivatives.

89C51-89C52-89C54-89C58; 80C51 8-bit microcontroller family 4K-8K-16K-32K Flash

General description

The 89C51/89C52/89C54/89C58 contain a non-volatile FLASH program memory that is parallel programmable. For devices that are serial programmable (In-System Programmable (ISP) and In-Application Programmable (IAP) with a boot loader), see the 89C51Rx2 or 89C66x datasheets. All three families are Single-Chip 8-bit Microcontrollers manufactured in advanced CMOS process and are derivatives of the 80C51 microcontroller family. All the devices have the same instruction set as the 80C51.

Features

80C51 Central Processing Unit On-chip FLASH Program Memory

Speed up to 33 MHz

Fully static operation

RAM expandable externally up to 64 kbytes

Page 30: Minor Report

4 interrupt priority levels

6 interrupt sources

Four 8-bit I/O ports

Full-duplex enhanced UART

o Framing error detection

o Automatic address recognition

Three 16-bit timers/counters T0, T1 (standard 80C51) and additional T2 (capture and compare)

Power control modes

o Clock can be stopped and resumed

o Idle mode

o Power down mode

Programmable clock out

Second DPTR register

Asynchronous port reset

Low EMI (inhibit ALE)

Wake up from power down by an external interrupt

Similar products

89C51/89C52/89C54/89C58 links to the similar products page containing an overview of products that are similar in function or related to the type number(s) as listed on this page. The similar products page includes products from the same catalog tree(s), relevant selection guides and products from the same functional category.

Page 31: Minor Report

The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer.

Pin Description

VCC Supply voltage

GND Ground

Page 32: Minor Report

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

Port 1 also receives the low-order address bytes during Flash programming and verification.

Page 33: Minor Report

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

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 receives some control signals for Flash programming and verification.

Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.

RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. If desired,

Page 34: Minor Report

ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S51 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.

XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2 Output from the inverting oscillator amplifier

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)

Page 35: Minor Report

SOLDERING

Soldering is a process in which two or more metal items are joined together by melting and flowing a filler metal into the joint, the filler metal having a relatively low melting point. Soft soldering is characterized by the melting point of the filler metal, which is below 400 °C (800 °F). The filler metal used in the process is called solder.

Soldering is distinguished from brazing by use of a lower melting-temperature filler metal; it is distinguished from welding by the base metals not being melted during the joining process. In a soldering process, heat is applied to the parts to be joined, causing the solder to melt and be drawn into the joint by capillary action and to bond to the materials to be joined by wetting action. After the metal cools, the resulting joints are not as strong as the base metal, but have adequate strength, electrical conductivity, and water-tightness for many uses. Soldering is an ancient technique mentioned in the Bible and there is evidence that it was employed up to 5000 years ago in Mesopotamia.

Applications

One of the most frequent application of soldering is assembling electronic components to printed circuit boards (PCBs). Another common application is making permanent but reversible connections between copper pipes in plumbing systems. Joints in sheet metal objects such as food cans, roof flashing, rain gutters and automobile radiators have also historically been soldered, and occasionally still are. Jewelry components are assembled and repaired by soldering. Small mechanical parts are often soldered as well. Soldering is also used to join lead came and copper foil in stained glass work. Soldering can also be used to effect a semi-permanent patch for a leak in a container cooking vessel.

Solders

Soldering filler materials are available in many different alloys for differing applications. In electronics assembly, the eutectic alloy of 63% tin and 37% lead (or 60/40, which is almost identical in performance to the eutectic) has

Page 36: Minor Report

been the alloy of choice. Other alloys are used for plumbing, mechanical assembly, and other applications.

A eutectic formulation has several advantages for soldering; chief among these is the coincidence of the liquidus and solidus temperatures, i.e. the absence of a plastic phase. This allows for quicker wetting out as the solder heats up, and quicker setup as the solder cools. A non-eutectic formulation must remain still as the temperature drops through the liquidus and solidus temperatures. Any differential movement during the plastic phase may result in cracks, giving an unreliable joint. Additionally, a eutectic formulation has the lowest possible melting point, which minimizes heat stress on electronic components during soldering.

Lead-free solders are suggested anywhere children may come into contact (since children are likely to place things into their mouths), or for outdoor use where rain and other precipitation may wash the lead into the groundwater. Common solder alloys are mixtures of tin and lead, respectively:

63/37: melts at 183 °C (361.4 °F) (eutectic: the only mixture that melts at a point, instead of over a range)

60/40: melts between 183–190 °C (361–374 °F)

50/50: melts between 185–215 °C (365–419 °F)

Lead-free solder alloys melt around 250 °C (482 °F), depending on their composition.

For environmental reasons, 'no-lead' solders are becoming more widely used. Unfortunately most 'no-lead' solders are not eutectic formulations, making it more difficult to create reliable joints with them. See complete discussion below; see also RoHS.

Other common solders include low-temperature formulations (often containing bismuth), which are often used to join previously-soldered assemblies without un-soldering earlier connections, and high-temperature formulations (usually containing silver) which are used for high-temperature operation or for first assembly of items which must not become unsoldered

Page 37: Minor Report

during subsequent operations. Specialty alloys are available with properties such as higher strength, better electrical conductivity and higher corrosion resistance.

Flux

In high-temperature metal joining processes (welding, brazing and soldering), the primary purpose of flux is to prevent oxidation of the base and filler materials. Tin-lead solder, for example, attaches very well to copper, but poorly to the various oxides of copper, which form quickly at soldering temperatures. Flux is a substance which is nearly inert at room temperature, but which becomes strongly reducing at elevated temperatures, preventing the formation of metal oxides. Secondarily, flux acts as a wetting agent in the soldering process, reducing the surface tension of the molten solder and causing it to better wet out the parts to be joined.

Fluxes currently available include water-soluble fluxes (no VOC's required for removal) and 'no-clean' fluxes which are mild enough to not require removal at all. Performance of the flux needs to be carefully evaluated; a very mild 'no-clean' flux might be perfectly acceptable for production equipment, but not give adequate performance for a poorly-controlled hand-soldering operation.

Traditional rosin fluxes are available in non-activated (R), mildly activated (RMA) and activated (RA) formulations. RA and RMA fluxes contain rosin combined with an activating agent, typically an acid, which increases the wettability of metals to which it is applied by removing existing oxides. The residue resulting from the use of RA flux is corrosive and must be cleaned off the piece being soldered. RMA flux is formulated to result in a residue which is not significantly corrosive, with cleaning being preferred but optional.

Basic soldering techniques

Methods

Soldering operations can be performed with hand tools, one joint at a time, or en masse on a production line. Hand soldering is typically performed with a soldering iron, soldering gun, or a torch, or occasionally a hot-air pencil.

Page 38: Minor Report

Sheetmetal work was traditionally done with "soldering coppers" directly heated by a flame, with sufficient stored heat in the mass of the soldering copper to complete a joint; torches or electrically-heated soldering irons are more convenient. All soldered joints require the same elements of cleaning of the metal parts to be joined, fitting up the joint, heating the parts, applying flux, applying the filler, removing heat and holding the assembly still until the filler metal has completely solidified. Depending on the nature of flux material used, cleaning of the joints may be required after they have cooled.

"Hard soldering" or "silver soldering" (performed with high-temperature solder containing up to 40% silver) is also often a form of brazing, since it involves filler materials with melting points in the vicinity of, or in excess of, 450 °C. Although the term "silver soldering" is used much more often than "silver brazing", it may be technically incorrect depending on the exact melting point of the filler in use. In silver soldering ("hard soldering"), the goal is generally to give a beautiful, structurally sound joint, especially in the field of jewelry. Thus, the temperatures involved, and the usual use of a torch rather than an iron, would seem to indicate that the process should be referred to as "brazing" rather than "soldering", but the endurance of the "soldering" apellation serves to indicate the arbitrary nature of the distinction (and the level of confusion) between the two processes.

Desoldering and resoldering

Used solder contains some of the dissolved base metals and is unsuitable for reuse in making new joints. Once the solder's capacity for the base metal has been achieved it will no longer properly bond with the base metal, usually resulting in a brittle cold solder joint with a crystalline appearance.

It is good practice to remove solder from a joint prior to resoldering—desoldering braids or vacuum desoldering equipment (solder suckers) can be used. Desoldering wicks contain plenty of flux that will lift the contamination from the copper trace and any device leads that are present. This will leave a bright, shiny, clean junction to be resoldered.

The lower melting point of solder means it can be melted away from the base metal, leaving it mostly intact though the outer layer will be "tinned" with

Page 39: Minor Report

solder. Flux will remain which can easily be removed by abrasive or chemical processes. This tinned layer will allow solder to flow into a new joint, resulting in a new joint, as well as making the new solder flow very quickly and easily.

Soldering Tools

The only tools that are essential to solder are a soldering iron and some solder. There are, however, lots of soldering accessories available (see soldering accessories for more information).

Different soldering jobs will need different tools, and different temperatures too. For circuit board work you will need a finer tip, a lower temperature and finer grade solder. You may also want to use a magnifying glass. Audio connectors such as XLR's will require a larger tip, higher temperature and thicker solder. Clamps and holders are also handy when soldering audio cables.

Soldering Irons

There are several things to consider when choosing a soldering iron.

Wattage adjustable or fixed temperature

power source (electric or gas)

portable or bench use

I do not recommend soldering guns, as these have no temperature control and can get too hot. This can result in damage to circuit boards, melt cable insulation, and even damage connectors.

Temperature

There are a lot of cheap, low watt irons with no temperature control available. Most of these are fine for basic soldering, but if you are going to be doing a lot you may want to consider a variable temperature soldering iron. Some of these

Page 40: Minor Report

simply have a boost button on the handle, which is useful with larger joints, others have a thermostatic control so you can vary the heat of the tip.

If you have a temperature controlled iron you should start at about 315-345°C (600-650°F). You may want to increase this however - I prefer about 700-750°F. Use a temperature that will allow you to complete a joint in 1 to 3 seconds.

Power

Most soldering irons are mains powered - either 110/230v AC, or benchtop soldering stations which transform down to low voltage DC. Also available are battery and gas powered. These are great for the toolbox, but you'll want a plug in one for your bench. Gas soldering irons loose their heat in windy outside conditions more easily that a good high wattage mains powered iron.

Solder

The most commonly used type of solder is rosin core. The rosin is flux, which cleans as you solder. The other type of solder is acid core and unless you are experienced at soldering, you should stick to rosin core solder. Acid core solder can be tricky, and better avoided for the beginner.

Rosin core solder comes in three main types - 50/50, 60/40 and 63/37. These numbers represent the amount of tin and lead are present in the solder,as shown below.

Solder Type

% Tin % LeadMelting Temp (°F)

50/50 50 50 425

60/40 60 40 371

63/37 63 37 361

Page 41: Minor Report

Soldering Accessories

Soldering Iron Tips

Try to use the right size tip whenever you can. Smaller wires and circuit boards require small fine tips, and mic cable onto an XLR would need a larger tip. You can get pointed tips, or flat tipped ones (sometimes called 'spade tips'). If you have a solder station with a desolderer, you will also want a range of desoldering tips and cleaners.

Soldering Iron Stands

These are handy to use if you are doing several or more joints. It is a heat resistant cradle for your iron to sit in, so you don't have to lie it down on the bench while it is hot. It really is essential if you are planning to do a lot of bench soldering as it is only a matter of time before you burn something (probably your elbow resting on the hot tip) if you don't use one.

Solder Wick

Solder wick is a mesh the you lie on a joint and heat. When it heats up it also melts the solder which is drawn out of the joint. It is usually used for cleaning up solder from tracks on a circuit board, but you will need a solder sucker to clean out the holes in the circuit board. Place the wick on the solder you want to remove then put your soldering iron on top of the wick. The wick will heat up, then the solder will melt and flow away from the joint and into wick.

Solder Suckers

If you don't have a solder station with desolderer, and you work on PCB's, you are going to need one of these before too long. They are spring loaded and suck the melted solder out of the joint. They are a bit tricky to use, as you have to melt the solder with your iron, then quickly position the solder sucker over the melted solder and release the spring to suck up the solder. I find solder wick to be easier to use and more effective.

Page 42: Minor Report

Preparation

Step 1: Preparation

If you are preparing the cable for a connector, I strongly suggest you put any connector parts on now (the screw on part of an XLR, or casing of a 1/4" jack for example). Get into the habit of sliding these on before you start on the cable, or else you can bet it won't be long before you finish soldering your connector only to discover you forgot to put the connector casing on, and have to start all over again.

Once you have all the connector parts on that you need, you will need to strip your cable. This means removing the insulation from the end of the wire and exposing the copper core. You can either use a wire stripper, side cutters, or a knife to do this.

The obvious tool to choose to strip a wire would be......a wire stripper. There are many types of wire stripper, and most of them work the same. You simply put the wire in, and squeeze it and pull the end bit off. It will cut to a preset depth, and if you have chosen the right depth it will cut the insulation off perfectly. It is possible to choose the wrong depth and cut too deeply, or too shallow, but they are very easy to use.

On the other hand, some people (myself included) prefer to use a knife or side cutters. I use side cutters for small cable and a Stanley knife for bigger cables...and although I have a couple of wire strippers, I haven't used them for years. This may seem odd, but I've got my side cutters and knife with me anyway, and they do the job fine.

If you are using side cutters (as shown here), position them about 10mm (1/2 inch) from the end, and gently squeeze the cutters into the insulation to pierce it, but not far enough to cut the copper strands of the core. Open the cutters slightly so you

Page 43: Minor Report

can turn the wire and pierce the rest of the insulation. You may have to do this a few times to cut through all of the insulation, but it is better to cut too shallow and have to turn and cut again rather than cut the core and have to start again. Now you should be able to slide the insulation off with your cutters, or pull it off with your fingers. This may sound a tedious method, but in no time at all you will be able to do it in two cuts and a flick of the cutters.

I won't explain how I use a knife to do larger cable, as I'd hate someone to slice a finger or thumb open following my instructions. Using a sharp blade like that certainly does have its risks, so stick with wire cutters or side cutters if you are at all unsure.

If your connector has been used before, make sure you remove any remnants of wire and solder from the contacts. Do this by putting the tip of your soldering iron into the hole and flicking the solder out when it has melted. Common Sense Alert! Please be careful when you flick melted solder...flick it away from you.

Tinning

Step 2: Tinning

Whatever it is you are soldering, you should 'tin' both contacts before you attempt to solder them. This coats or fills the wires or connector contacts with solder so you can easily melt them together.

To tin a wire, apply the tip of your iron to the wire for a second or two, then apply the solder to the wire. The solder should flow freely onto the wire and coat it (if it's stranded wire the solder should flow into it, and fill the wire). You may need to snip the end off afterwards, particularly if you have put a little too much solder on and it has formed a little ball at the end of the wire.

Page 44: Minor Report

Be careful not to overheat the wire, as the insulation will start to melt. On cheaper cable the insulation can 'shrink back' if heated too much, and expose more copper core that you intended. You can cut the wire back after you have tinned it, but it's best simply not to over heat it.

The larger the copper core, the longer it will take to heat up enough to draw the solder in, so use a higher temperature soldering iron for larger cables if you can.

To tin a contact on an audio XLR connector, hold the iron on the outside of the the contact for a second or two, then apply the solder into the cavity of the contact. Once again, the solder should flow freely and fill the contact. Connectors such as jacks have contacts that are just holes in a flat part of the connector. To tin these you put your iron on it, and apply the solder to where the iron is touching. The solder should flow and cover the hole.

Once you have tinned both parts, you are ready to solder them together.

Step 3: Soldering

This step can often be the easiest when soldering audio cables.

You simply need to place your soldering iron onto the contact to melt the solder.

Page 45: Minor Report

When the solder in the contact melts, slide the wire into the contact.

Remove the iron and hold the wire still while the solder solidifies again.

You will see the solder 'set' as it goes hard.

This should all take around 1-3 seconds.

A good solder joint will be smooth and shiny.

If the joint is dull and crinkly, the wire probably moved during soldering.

If you have taken too long it will have have solder spikes.

If it does not go so well, you may find the insulation has melted, or there is too much stripped wire showing. If this is the case, you should desolder the joint and start again.

Cleaning Your Soldering Iron

You should clean your tip after each use. There are many cleaning solutions and the cheapest (and some say best) is a damp sponge. Just rub the soldering iron tip on it after each solder.

Another option is to use tip cleaner. This comes in a little pot that you push the tip into. This works well if your tip hasn't been cleaned for a while. It does create a lot of smoke, so it is better not to let the tip get so dirty that you need to use tip cleaner.

Some solder stations come with a little pad at the base of the holder. If you have one of these, you should get into the habit of wiping the tip on the pad each time you apply solder with it.

Page 46: Minor Report

If you need to clean solder off a circuit board, solder wick is what you need. You place the wick on the joint or track you want to clean up, and apply your soldering iron on top. The solder melts and is drawn into the wick. If there is a lot of solder the wick will fill up, so gently pull the wick through the joint and your iron, and the solder will flow into it as it passes.

Tips and Tricks

1. Melted solder flows towards heat. 2. Most beginning solderers tend to use too much solder and heat the for

too long.

3. Don't move the joint until the solder has cooled.

4. Keep your iron tip clean.

5. Use the proper type of iron and tip size.

KEIL

How to work with keil

1. Open Keil from the Start menu

Page 47: Minor Report

2. The

Figure below shows the basic names of the windows referred in this document

Starting a new Assembler Project

1.Select New Project from the Project Menu.

2. Name the project ‘Toggle.a51’

3. Click on the Save Button.