User:Abhi2012/sandbox

A PROJECT REPORT ON

Traffic light controller using AT89S51 Submitted by

GHADAGE AJIT P.

JADHAV PRAVIN A.

JOSHI SHRIKANT P.

KALDHONE NITIN A.

Department of

Electronics & Telecommunication Engineering

SHIVAJI POLYTECHNIC ATPADI

2012-2013

Guided by

MISS. JADHAV MADAM

In partial fulfillment for the award of diploma in

ELECTRONICS & TELECOMMUNICATION ENGINEERING

ACKNOWLEDGEMENT

This project  Report  is  an  Acknowledgement  to  the  sincere  efforts  of  all  individuals  who  have  contributed  to  the  completion  of  our  project. We would  like  to  record  our  deep gratitude  and  appreciation  of  our  H.O.D.   Miss. S. P. Jogdand, for inspiring  and  encouraging  us  while  we  were  working  on  the  project. We are  highly  indebted  to  our  Lecturers  and  Guide, Mrs.Naware Nisha, who  initiated  us  in  this  field  and provided  us  with  his  sincere  advise  in  all  phases  of  its  progress  and  subsequent  completion.

We would  like  to  express  our  sincere  appreciation  to  all  the  teachers  of  Electronics and  Telecommunication  Engineering  Department, who  were  always  supporting  and  advising  us  whenever  we  encountered  any  problem.

Last but  not  the  least ,  thanks to  those  person  who  directly  or  indirectly  contributed  to  the  completion  of  this  project.

Traffic light controller using AT89S51

A Project – II (Semester VI of third  Year) carried out in partial fulfillment of

The requirements for the award of Diploma of

Electronics and Telecommunication Engineering

In Academic Year 2012 – 2013

Submitted to

SSS’s SHIVAJI Polytechnic ATPADI

PRESENTED BY- 1) GHADAGE AJIT P.             2)JADHAV PRAVIN A.              3)JOSHI SHRIKANT P.              4)KALDHONE NITIN Y. Project Supervisor- MISS- JADHAV MADAM

SHIVAJI Polytechnic ATPADI. CONTENTS

Chapter No. Name of Topic						Page No. 1. 			Introduction                    					     06 2.   			History                   					        	     09 3.1 Traffic light control 					    10 3.2 Related Work in Intelligent Traffic Light Control 	     11 3.3 Light District						    13 3.			Block Diagram of Traffic Light Controller			    15

4.			List Of Component						    16

5.			Circuit Diagram Of Traffic Light Controller			    17

6.			Microcontroller AT89S51 IC					    18 7.1 Features 							    18 7.2 Description						    20 7.3 Architecture of IC89S51					    24

7.			Diode								    28 8.1 Light Emitting Diode					    29

8.			LM7805 Voltage Regulator IC				    31 9.1 Pin Description						    32

9.			Resistor						 	    34 Advantages 							    36		Future scope							     37 Conclusion							    38 References							    39 Chapter No.1 1.1: INTRODUCTION: Vehicular travel is increasing throughout the world, particularly in large urban areas. Therefore the need arises for simulating and optimizing traffic control algorithms to Better accommodate this increasing demand. In this paper we study the simulation and Optimization of traffic light controllers in a city.

A road signal for directing vehicular traffic by means of colored lights, typically red for stop, green for go, and yellow for proceed with caution. Also called stoplight, traffic signal. Traffic light, signal One of a set of colored lights placed at crossroads, junctions, etc., to control the flow of traffic. A red light indicates that traffic must stop and a green light that it may go: usually an amber warning light is added between the red and the green. This article is about the traffic control device.

Traffic lights, which may also be known as stoplights, traffic lamps, traffic signals, signal lights, robots or semaphore, are signaling devices positioned at road intersections, pedestrian crossings and other locations to control competing flows of traffic. Traffic lights were first installed in 1868 in London, and today are installed in most cities around the world. Traffic lights alternate the right of way of road users by displaying lights of a standard color(red, yellow/amber, and green), using a universal color code (and a precise sequence to enable comprehension by those who are color blind). In the typical sequence of colored lights: 	Illumination of the green light allows traffic to proceed in the direction denoted, 	Illumination of the orange/yellow light denoting, if safe to do so, prepare to stop short of the intersection, and 	Illumination of the red signal prohibits any traffic from proceeding. Usually, the red light contains some orange in its hue, and the green light contains some blue, for the benefit of people with red-green color blindness, and "green" lights in many areas are in fact blue lenses on a yellow light (which together appear green). Transportation research has the goal to optimize transportation flow of people and goods. As the number of road users constantly increases, and resources provided by current infrastructures are limited, intelligent control of traffic will become a very important issue in the Future. However, some limitations to the usage of intelligent traffic control exist. Avoiding Traffic jams for example is thought to be beneficial to both environment and economy, but Improved traffic-flow may also lead to an increase in demand [Levinson, 2003].

There are several models for traffic simulation. In our research we focus on microscopic Models that model the behavior of individual vehicles, and thereby can simulate dynamics Of groups of vehicles. Research has shown that such models yield realistic behavior.

Cars in urban traffic can experience long travel times due to inefficient traffic light control. Optimal control of traffic lights using sophisticated sensors and intelligent optimization Algorithms might therefore be very beneficial. Optimization of traffic light switching increases Road capacity and traffic flow, and can prevent traffic congestions. Traffic light control is a Complex optimization problem and several intelligent algorithms, such as fuzzy logic, evolutionary algorithms, and reinforcement learning (RL) have already been used in attempts To solve it. In this paper we describe model-based, multi-agent reinforcement learning Algorithm for controlling traffic lights.

In our approach, reinforcement learning [Sutton and Barto, 1998, Kaelbling et al., 1996] With road-user-based value functions [Wiering, 2000] is used to determine optimal decisions For each traffic light. The decision is based on a cumulative vote of all road users standing For a traffic junction, where each car votes using its estimated advantage (or gain) of setting It’s light to green. The gain-value is the difference between the total times it expects to wait During the rest of its trip if the light for which it is currently standing is red, and if it is green. The waiting time until cars arrive at their destination is estimated by monitoring cars flowing Through the infrastructure and using reinforcement learning (RL) algorithms.

We compare the performance of our model-based RL method to that of other controllers Using the Green Light District simulator (GLD). GLD is a traffic simulator that allows us To design arbitrary infrastructures and traffic patterns, monitor traffic flow statistics such as Average waiting times, and test different traffic light controllers. The experimental resultsShow that in crowded traffic, the RL controllers outperform all other tested non-adaptive Controllers. We also test the use of the learned average waiting times for choosing routes of Cars through the city (co-learning) and show that by using co-learning road users can avoid Bottlenecks.

This paper is organized as follows. Section 2 describes how traffic can be modeled, Predicted, and controlled. In section 3 reinforcement learning is explained and some of its Applications are shown. Section 4 surveys several previous approaches to traffic light control, And introduces our new algorithm. Section 5 describes the simulator we used for our experiments.

In this paper we are mainly interested in the optimization of traffic flow, thus effectively Minimizing average traveling (or waiting) times for cars. A common tool for analyzing traffic is the traffic simulator. In this section we will first describe two techniques commonly used to model traffic. We will then describe how models can be used to obtain real time traffic Information or predict traffic conditions. Afterwards we describe how information can be communicated as a means of controlling traffic, and what the effect of this communication on traffic conditions will be. Finally, we describe research in which all cars are controlled using computers.

Chapter no.2 2.1: HISTORY: On December 10, 1868, the first traffic lights were installed outside the British Houses of Parliament in London, by the railway engineer J. P. Knight. They resembled railway signals of the time, with semaphore arms and red and green gas lamps for night use. The gas lantern was turned with a lever at its base so that the appropriate light faced traffic. Unfortunately, it exploded on 2 January 1869, injuring or killing the policeman who was operating it.

The modern electric traffic light is an American invention. As early as 1912 in Salt Lake City, Utah, policeman Lester Wire invented the first red-green electric traffic lights. On August 5, 1914, the American Traffic Signal Company installed a traffic signal system on the corner of East 105th Street and Euclid Avenue in Cleveland, Ohio. It had two colors, red and green, and a buzzer, based on the design of James Hoge, to provide a warning for color changes. The design by James Hoge allowed police and fire stations to control the signals in case of emergency.

The four ways, three color traffic lights was created by police officer William Potts in Detroit, Michigan in 1920. In 1922, T.E. Hayes patented his "Combination traffic guide and traffic regulating signal" (Patent # 1447659). Ashville, Ohio claims to be the location of the oldest working traffic light in the United States, used at an intersection of public roads until 1982 when it was moved to a local museum.

In contrast to macroscopic models, microscopic traffic models offer a way of simulating various driver behaviors. A microscopic model consists of an infrastructure that is occupied by a set of vehicles. Each vehicle interacts with its environment according to its own rules. Depending on these rules, different kinds of behavior emerge when groups of vehicles interact. Cellular Automata. One specific way of designing and simulating (simple) driving rules of cars on an infrastructure, is by using cellular automata (CA). CA use discrete partially connected cells that can be in a specific state. For example, a road-cell can contain a car or is empty.

2.2 Traffic Light Control:

Fig:2.2.1: Installation of Old Traffic Light

Traffic light optimization is a complex problem. Even for single junctions there might be no obvious optimal solution. With multiple junctions, the problem becomes even more complex, as the state of one light influences the flow of traffic towards many other lights. Another complicate- ion is the fact that flow of traffic constantly changes, depending on the time of day, the day of the week, and the time of year. Roadwork and accidents further influence complexity and performance.

In practice most traffic lights are controlled by fixed-cycle controllers. A cycle of configurations is defined in which all traffic gets a green light at some point. The split time determines for how long the lights should stay in each state. Busy roads can get preference by adjusting the split time. The cycle time is the duration of a complete cycle. In crowded traffic, longer cycles lead to better performance. The offset of a cycle defines the starting time of a cycle relative to other traffic lights. Offset can be adjusted to let several lights cooperate, and for example create  green waves.

Fixed controllers have to be adapted to the specific situation to perform well. Often a table of time-specific settings is used to enable a light to adapt to recurring events like rush hour traffic. Setting the control parameters for fixed controllers is a lot of work, and controllers have to be updated regularly due to changes in traffic situation. Unique events cannot be handled well, since they require a lot of manual changes to the system. Fixed controllers could respond to arriving traffic by starting a cycle only when traffic is present, but such vehicle actuated controllers still require lots of fine-tuning.

Most research in traffic light control focuses on adapting the duration or the order of the control cycle. In our approach we do not use cycles, but let the decision depend on the actual traffic situation around a junction, which can lead to much more accurate control. Of course, our approach requests that information about the actual traffic situation can be obtained by using different sensors or communication systems. We will first describe related work on intelligent traffic light control, and then describe our car-based reinforcement learning algorithm.

2.3 Related Work in Intelligent Traffic Light Control: The Intelligent Traffic Light Controller consist of the following work such as expert system used in the Traffic Light Controller. and Prediction based optimization.

2.3.1: Expert Systems: An expert system uses a set of given rules to decide upon the next action. In traffic light control, such an action can change some of the control parameters. Findler and Stapp (1992) describe a network of roads connected by traffic light-based expert systems. The expert systems can communicate to allow for synchronization. Performance on the network depends on the rules that are used. For each traffic light controller, the set of rules can be optimized by analyzing how often each rule fires, and the success it has. The system could even learn new rules. Findler and Stapp showed that their system could improve performance, but they had to make some simplifying assumptions to avoid too much computation.

2.3.2: Prediction-based optimization: Tavladakis and Voulgaris (1999) describe a traffic light controller using a simple predictor. Measurements taken during the current cycle are used to test several possible settings for the next cycle, and the setting resulting in the least amount of queued vehicles is executed. The system seems highly adaptive, and maybe even too much so.

In this case, the system would adapt too quickly, resulting in poor performance.Liu et al. (2002) introduce a way to overcome problems with fluctuations. Traffic detectors at both sides of a junction and vehicle identification are used to measure delay of vehicles at a junction. This is projected to an estimated average delay time using a filter function to smooth out random fluctuations. The control system tries to minimize not only the total delay, but the summed deviations from the average delay as well. Since it is no longer beneficial to let a vehicle wait for a long time, even if letting it pass would increase the total waiting time, this introduces a kind of fairness. Data of about 15 minutes is used to determine the optimal settings for the next cycle, and even using a simple optimization algorithm, the system performs well compared to preset and actuated controllers.

2.3.3: Car-based traffic light control:

Therefore, we chose the second possibility that allows for a lot of flexibility, since we have the option to model each car’s destination, position, and possibly speed. This is also a natural system, since if cars would exactly know their overall waiting time until their destination (note that this would require static traffic patterns) when the light is green or red, a voting system that adds all waiting times for different traffic node decisions can be used to minimize the overall waiting time. Furthermore, the number of states for a car is not so large.

For example if we use the information that the car is at a traffic node, occupies some place, is at some direction, and has some destination, this makes a feasible number of car-states which can be stored in lookup tables. Note that we take the destination address of cars into account.

2.3: Light District:

Fig:2.3.1: Light District

We used the Green Light District (GLD)3 traffic simulator for our experiments. GLD consists of an editor to define infrastructures (based on cellular automata), a Multi-Agent System (MAS) to run the simulation, and a set of controllers for the agents. The simulator has several statistical functions to measure performance. In the next section we will describe the simulator.

An infrastructure consists of roads and nodes. A road connects two nodes, and can have several lanes in each direction (see Figure 1). The length of each road is expressed in units. A node is either a junction where traffic lights are operational (although when it connect. only two roads, no traffic lights are used), or an edge-node. There are two types of agents that occupy an infra- structure; vehicles and traffic lights. All agents act autonomously, following some simple rules, and get updated every time-step. Vehicles enter the network at the edge-nodes.

Each edge-node has a certain probability of generating a vehicle at each time step. Each vehicle that is generated is assigned a destination, which is one of the other edge-nodes. The distribution of destinations for each edge-node canbe adjusted.

There are several types of vehicles, defined by their speed, length, and number of passengers. For our experiments we only used cars, which move at a speed of two units (or one or zero if they have to brake) per time step, have a length of two units, and have two passengers.

The state of each vehicle is updated every time step. It either moves with the distance given by its speed, or stops when there is another vehicle or a red traffic light ahead. At a junction, a car decides to which lane it should go next according to its driving policy. Once a car has entered a lane, it cannot switch lanes.

Junctions can be occupied by traffic lights. For each junction, there are a number of possible ways of switching the lights that are safe. At each time-step, the traffic light controller decides which of these is the best. It can use information on waiting vehicles and their destination, and about other traffic lights to make this decision.

In practice most traffic lights are controlled by fixed-cycle controllers. A cycle of configurations is defined in which all traffic gets a green light at some point. The split time determines for how long the lights should stay in each state. Busy roads can get preference by adjusting the split time. The cycle time is the duration of a complete cycle. In crowded traffic, longer cycles lead to better performance. The offset of a cycle defines the starting time of a cycle relative to other traffic lights. Offset can be adjusted to let several lights cooperate, and for example create green waves.

Chapter NO.3

3.1:Block diagram of Traffic Light Controller:

Fig:3.1: Block Diagram Of Traffic Light Controller

Above figure shows the block diagram of Mcrocontroller IC 89S51 based Traffic Light Controller. The main block diagram shows the power supply circuit. Here 9volt DC power supply i.e. battery is used. Then this signal passed to Regulator IC i.e. 7805IC. This is used to make the stable voltage of +5volt for microcontroller IC. The LM7805 is three terminal positive regulatore are available in the maket and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shut down & safe operating area protection. It used convert 9volt dc supply into a 5volt dc supply.

This signal is passed to microcontroller IC AT89S51. Crystal Oscillator is used to give oscillation frequency signal to the microcontroller IC AT89S51. Here 11.0592MHZ crystal frequency generated to the this crystal oscillator. It is used a piezoelectric material  which are used to electric signal to very low frequency signal are used. Then signal passed to microcontroller IC89S51.then by using some microcontroller instruction set we give the signal to the traffic light that is nothing but LED.

Chapter No 4

4.1: LIST OF COMPONENTS:

R1-3, R5-10, R12-14	 	- 220Ohm (RED, RED, BROWN) R4				- 10K (BROWN,BLACK,ORANGE) R11				- 1K (BROWN,BLACK,RED) C1				- 10µF/25v Electrolytic C2,C3				- 33PF Ceramic Disc C4				- 220µF /16V Electrolytic C5,C6				- 100KPF DISC (O.1microF) Y1				- 11.0592 MHZ Crystal D1				- IN4007 Diode L1				- 3mm OR 5mm GREEN LED (5 nos) U2				- LM 7805 (3 Pin Voltage Regulator) U1				- AT89S51 MICROCONTROLLER 1 nos				- 40 Pin IC Socket 1 nos				- Traffic Light Controller Main PCB L2				- 3mm RED LED (4 nos) L3				- 3mm Yellow LED (4 nos) 4 nos 				- Traffic Light LED PCB(4 nos)

Chapter No. 5

5.1: CIRCUIT DIAGRAM OF TRAFFIC LIGHT CONTROLER:

Fig:5.1: Circuit Diagram Of Traffic Light Controller Above figure shows the circuit diagram of traffic light controller based on microcontroller AT89S51 IC. In this system we used the the assembly language programming. There are several models for traffic simulation. In our research we focus on microscopicmodels that model the behavior of individual vehicles, and thereby can simulate dynamicsof groups of vehicles.

Cars in urban traffic can experience long travel times due to inefficient traffic light control.Optimal control of traffic lights using sophisticated sensors and intelligent optimization algorithms might therefore be very beneficial. Optimization of traffic light switching increases road capacity and traffic flow, and can prevent traffic congestions.

The 9volt dc power supply are produced to diode. Diode is only conducting in forword biased reverse biased are not conducted because P-N junction diode is used & this P-N junction diode is only conducting in forward biased. If reverse voltage is applied to the circuit then it cannot be passed through P-N junction diode.

Simple green LED is used to indicate power supply is ON or OFF. Then 1K resistor is used to oppose the flow of current coming through the P-N junction diode. Then it is passed to conductor .This conductor is used to remove unwanted ripple if present in the circuit & this signal passed to 7805 Regulator IC.It is based on three terminal voltage regulator which provide the required +5volt. This Regulator IC is Used to Regulate the power supply. The 9volt dc is converted into the 5volt by using this regulator IC 7805.

Then two capacitor are used to filtering the purpose. Then this signal is applied to the ontroller IC AT89S51. IC AT89S51 is similar to that of MCS-51 IC. It is a high performance CMOS 8- bit microcontroller with 4K & 8K byte of flash progrraming and erasable read only memory (PEROM). The device is manufacture by using ATMEL high density non volatile memory technology and compatible with industry standard MCS-51.IC AT89S51 is a powerful microcontroller which provide high flexible & cost effective solution to many embeded controller application.

IC 89S51 is required crystal frequency oscillation for there operation. Here we used 11.0592MHZ crystal for providing oscillation frequency to the microcontroller IC AT89S51. Crystal is a piezoelectric material to creat a electrical signal with very precise frequency. This frequency are commonly used for track of time to produce a stable clock signal for digital integrated circuit and two capacitor are used to charging & discharging process.then the signal are passed to the variouse LED via resistor. Here we use 220Ω resistor for controlling current passing through it. Traffic is divided into 8 unit of 10 second. The flow of traffic in all permissible direction during the 8 time of unit of 8 second.

Chapter No. 6 6.1: MICROCONTROLLERS 89S51 USED FOR TRAFFIC LIGHT CONTROLLER:

Fig:6.1: Pin Diagram Of 89s51

6.2: FEATURES: • Compatible with MCS-51™ Products • 4K 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 • 128 x 8-bit Internal RAM • 32 Programmable I/O Lines • Two 16-bit Timer/Counters • Six Interrupt Sources

6.3: Description:

The AT89S51 is a low-power, high-performance CMOS 8-bit microcomputer with 4Kbytes of Flash programmable and erasable read only memory (PEROM). The deviceis manufactured using Atmel’s high-density nonvolatile memory technology and iscompatible with the industry-standard MCS-51 instruction set and pinout.

The on-chipFlash allows the program memory to be reprogrammed in-system or by a conventionalnonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcomputer which providesa highly-flexible and cost-effective solution to many embedded control applications.

The AT89S51 provides the following standard features: 4Kbytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bittimer/counters, a fivevector two-l evel interrupt architecture,a full duplex serial port, on-chip oscillator and clock circuitry.In addition, the AT89S51 is designed with static logicfor operation down to zero frequency and supports twosoftware selectable power saving  modes.

The Idle Modestops 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 freezesthe oscillator disabling all other chip functions until the next hardware reset.

6.2.1: Pin Description: VCC: Supply voltage. GND: Ground.

Port 0: Port 0 is an 8-bit open-drain bi-directional I/O port. As anoutput port, each pin can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as highimpedanceinputs.Port 0 may also be configured to be the multiplexed loworderaddress/data bus during accesses to external programand data memory. In this mode P0 has internalpullups.Port 0 also receives the code bytes during Flash programming,and outputs the code bytes during programverification. External pullups are required during programverification.

Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pullups.The Port 1 output buffers can sink/source four TTL inputs.When 1s are written to Port 1 pins they are pulled high bythe internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being pulled low will sourcecurrent (IIL) because of the internal pullups.Port 1 also receives the low-order address bytes duringFlash programming and verification.

Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pullups.The Port 2 output buffers can sink/source four TTL inputs.When 1s are written to Port 2 pins they are pulled high bythe internal pullups and can be used as inputs. As inputs,Port 2 pins that are externally being pulled low will sourcecurrent (IIL) because of the internal pullups.

Port 2 emits the high-order address byte during fetchesfrom external program memory and during accesses toexternal data memory that use 16-bit addresses (MOVX @DPTR). In this application, it uses strong internal pullupswhen emitting 1s. During accesses to external data memorythat use 8-bit addresses (MOVX @ RI), Port 2 emits thecontents of the P2 Special Function Register. Port 2 also receives the high-order address bits and somecontrol signals during Flash programming and verification.

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

ALE/PROG: Address Latch Enable output pulse for latching the low byteof the address during accesses to external memory. Thispin is also the program pulse input (PROG) during Flashprogramming.In normal operation ALE is emitted at a constant rate of 1/6the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE.

PSEN: Program Store Enable is the read strobe to external programmemory.When the AT89S51 is executing code from external programmemory, PSEN is activated twice each machinecycle, except that two PSEN activations are skipped duringeach access to external data memory.

EA/VPP: External Access Enable. EA must be strapped to GND inorder to enable the device to fetch code from external programmemory locations starting at 0000H up to FFFFH.Note, however, that if lock bit 1 is programmed, EA will beinternally 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, for parts that require12-volt VPP.

Port 3: Port 3 is an 8-bit bi-directional I/O port with internal pullups.The Port 3 output buffers can sink/source four TTL inputs.When 1s are written to Port 3 pins they are pulled high bythe internal pullups and can be used as inputs. As inputs,Port 3 pins that are externally being pulled low will sourcecurrent (IIL) because of the pullups.Port 3 also serves the functions of various special featuresof the AT89S51 as listed below:Port 3 also receives some control signals for Flash programmingand verification.

Port 3 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) XTAL1: Input to the inverting oscillator amplifier and input to theinternal clock operating circuit.

XTAL2: Output from the inverting oscillator amplifier. Unconnected while XTAL1 is driven as shown in Figure 2. 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.

6.3 :Architecture of AT89S51: Fig:6.3: Architecture of IC 89S51

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 AT89S51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The AT89S51 provides the following standard features: 4Kbytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the AT89S51 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, The 8051 architecture provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.) in a single package. One particularly useful feature of the 8051 core was the inclusion of a boolean processing engine which allows bit-level boolean logic operations to be carried out directly and efficiently on select internal registers and select RAM locations. This advantageous feature helped cement the 8051's popularity in industrial control applications because it reduced code size by as much as 30%. Another valued feature is the including of four bank selectable working register sets which greatly reduce the amount of time required to complete an interrupt service routine. With a single instruction the 8051 can switch register banks as opposed to the time consuming task of transferring the critical registers to the stack or designated RAM locations. These registers also allowed the 8051 to quickly perform a context switch which is essential for time sensitive real-time applications. The MCS-51 UARTs make it simple to use the chip as a serial communications interface. External pins can be configured to connect to internal shift registers in a variety of ways, and the internal timers can also be used, allowing serial communications in a number of modes, both synchronous and asynchronous. Some modes allow communications with no external components. A mode compatible with an RS-485 multi-point communications environment is achievable, but the 8051's real strength is fitting in with existing ad-hoc protocols (e.g., when controlling serial-controlled devices). Once a UART, and a timer if necessary, have been configured, the programmer needs only to write a simple interrupt routine to refill the send shift register whenever the last bit is shifted out by the UART and/or empty the full receive shift register (copy the data somewhere else). The main program then performs serial reads and writes simply by reading and writing 8-bit data to stacks. MCS-51 based microcontrollers typically include one or two UARTs, two or three timers, 128 or 256 bytes of internal data RAM (16 bytes of which are bit-addressable), up to 128 bytes of I/O, 512 bytes to 64 kB of internal program memory, and sometimes a quantity of extended data RAM (ERAM) located in the external data space. The original 8051 core ran at 12 clock cycles per machine cycle, with most instructions executing in one or two machine cycles. With a 12 MHz clock frequency, the 8051 could thus execute 1 million one-cycle instructions per second or 500,000 two-cycle instructions per second. Enhanced 8051 cores are now commonly used which run at six, four, two, or even one clock per machine cycle, and have clock frequencies of up to 100 MHz, and are thus capable of an even greater number of instructions per second. All SILabs, some Dallas and a few Atmel devices have single cycle cores. Features of the modern 8051 include built-in reset timers with brown-out detection, on-chip oscillators, self-programmable Flash ROM program memory, built-in external RAM, bootloader code in ROM, EEPROM non-volatile data storage, I²C, SPI, and USB host interfaces, CAN or LIN bus, PWM generators,analogcomparators, A/D and D/A converters, RTCs, extra counters and timers, in-circuit debugging facilities, more interrupt sources, and extra power saving modes.In many engineering schools the 8051 microcontroller is used in introductory microcontroller courses.

6.3.1: Memory architecture: The MCS-51 has four distinct types of memory – internal RAM, special function registers, program memory, and external data memory. Internal RAM (IRAM) is located from address 0 to address 0xFF. IRAM from 0x00 to 0x7F can be accessed directly, and the bytes from 0x20 to 0x2F are also bit-addressable. IRAM from 0x80 to 0xFF must be accessed indirectly, using the @R0 or @R1 syntax, with the address to access loaded in R0 or R1. Special function registers (SFR) are located from address 0x80 to 0xFF, and are accessed directly using the same instructions as for the lower half of IRAM. Some of the SFR's are also bit-addressable. Program memory (PMEM, though less common in usage than IRAM and XRAM) is located starting at address 0. It may be on- or off-chip, depending on the particular model of chip being used. Program memory is read-only, though some variants of the 8051 use on-chip flash memory and provide a method of re-programming the memory in-system or in-application. Aside from storing code, program memory can also store tables of constants that can be accessed by MOVC A, @DPTR, using the 16-bit special function register DPTR. External data memory (XRAM) also starts at address 0. It can also be on- or off-chip; what makes it "external" is that it must be accessed using the MOVX (Move eXternal) instruction. Many variants of the 8051 include the standard 256 bytes of IRAM plus a few KB of XRAM on the chip. If more XRAM is required by an application, the internal XRAM can be disabled, and all MOVX instructions will fetch from the external bus.

Chapter No. 7 7.1: Diode : Fig:7.1: Diagram of P-N junction Diode

In electronics, a diode is a type of two-terminal electronic component with nonlinear resistance and conductance (i.e., a nonlinear current–voltage characteristic), distinguishing it from components such as two-terminal linear resistors which obey Ohm's law. A semiconductor diode, the most common type today, is a crystalline piece of semiconductor material connected to two electrical terminals. A vacuum tube diode (now rarely used except in some high-power technologies) is a vacuum tube with two electrodes: a plate and a cathode. The most common function of a diode is to allow an electric current to pass in one direction (called the diode's forward direction), while blocking current in the opposite direction (the reverse direction). Thus, the diode can be thought of as an electronic version of a check valve. This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, and to extract modulation from radio signals in radio receivers—these diodes are forms of rectifiers. However, diodes can have more complicated behavior than this simple on–off action. Semiconductor diodes do not begin conducting electricity until a certain threshold voltage is present in the forward direction (a state in which the diode is said to be forward-biased). The voltage drop across a forward-biased diode varies only a little with the current, and is a function of temperature; this effect can be used as a temperature sensor or voltage reference. Semiconductor diodes' nonlinear current–voltage characteristic can be tailored by varying the semiconductor materials and introducing impurities into (doping) the materials. These are exploited in special purpose diodes that perform many different functions

7.2: LIGHT EMITTING DIODE:

Fig:7.2: Construction Diagram Of LED Parts of an LED. Although not directly labeled, the flat bottom surfaces of the anvil and post embedded inside the epoxy act as anchors, to prevent the conductors from being forcefully pulled out from mechanical strain or vibration.

LED retrofit "bulb" with aluminium heatsink, a diffusing dome and E27 base, using a built-in power supply working on mains voltage. A light-emitting diode (LED) is a semiconductor light source] LEDs are used as indicator lamps in many devices and are increasingly used for other lighting. Introduced as a practical electronic component in 1962 early LEDs emitted low-intensity red light, but modern versions are available across the visible, ultraviolet, and infrared wavelengths, with very high brightness.

When a light-emitting diode is forward-biased (switched on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. LEDs are often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, and faster switching. LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output. Light-emitting diodes are used in applications as diverse as aviation lighting, automotive lighting, advertising, general lighting, and traffic signals. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also useful in advanced communications technology. Infrared LEDs are also used in the remote control units of many commercial products including televisions, DVD players, and other domestic appliances. Electroluminescence as a phenomenon was discovered in 1907 by the British experimenter H. J. Round of Marconi Labs, using a crystal of silicon carbide and a cat's-whisker detector. Russian Oleg Vladimirovich Losev reported creation of the first LED in 1927. His research was distributed in Russian, German and British scientific journals, but no practical use was made of the discovery for several decades. Rubin Braunstein of the Radio Corporation of America reported on infrared emission from gallium arsenide (GaAs) and other semiconductor alloys in 1955. Braunstein observed infrared emission generated by simple diode structures using gallium antimonide (GaSb), GaAs, indium phosphide (InP), and silicon-germanium (SiGe) alloys at room temperature and at 77 kelvin. In 1961 American experimenters Robert Biard and Gary Pittman, working at Texas Instruments, found that GaAs emitted infrared radiation when electric current was applied and received the patent for the infrared LED.

Chapter No.8 8.1: LM7805 VOLTAGE REGULATOR IC: 7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The 7805 in 7905 indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.

Fig:8.1: Pin Diagram Of IC LM7805

8.2: Pin Description:

Pin No	Function	Name 1	Input voltage (5V-18V)	Input 2	Ground (0V)	Ground 3	Regulated output; 5V (4.8V-5.2V)	Output

The 7805 is a family of self-contained fixed linear voltage regulator integrated circuits. The 78xx family is commonly used in electronic circuits requiring a regulated power supply due to their ease-of-use and low cost. For ICs within the family, the xx is replaced with two digits, indicating the output voltage (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx line are positive voltage regulators: they produce a voltage that is positive relative to a common ground. There is a related line of 7805 devices which are complementary negative voltage regulators. 7805 ICs can be used in combination to provide positive and negative supply voltages in the same circuit. 7805 ICs have three terminals and are commonly found in the TO220 form factor, although smaller surface-mount and larger TO3 packages are available. These devices support an input voltage anywhere from a couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and typically provide 1 or 1.5 amperes of current (though smaller or larger packages may have a lower or higher current rating). A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. A voltage regulator may be a simple "feed-forward" design or may include negative feedback control loops. It may use an electromechanical mechanism, or electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. Electronic voltage regulators are found in devices such as computer power supplies where they stabilize the DC voltages used by the processor and other elements. In automobile alternators and central power station generator plants, voltage regulators control the output of the plant. The 78xx (sometimes LM7805) is a family of self-contained fixed linear voltage regulator integrated circuits. The 7805 family is commonly used in electronic circuits requiring a regulated power supply due to their ease-of-use and low cost. For ICs within the family, the xx is replaced with two digits, indicating the output voltage (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx line are positive voltage regulators: they produce a voltage that is positive relative to a common ground. There is a related line of 7805 devices which are complementary negative voltage regulators. 7805 and 7905 ICs can be used in combination to provide positive and negative supply voltages in the same circuit. 7805 ICs have three terminals and are commonly found in the TO220 form factor, although smaller surface-mount and larger TO3 packages are available. These devices support an input voltage anywhere from a couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and typically provide 1 or 1.5 amperes of current (though smaller or larger packages may have a lower or higher current rating). 7805 series ICs have built-in protection against a circuit drawing too much power. They have protection against overheating and short-circuits, making them quite robust in most applications. In some cases, the current-limiting features of the 7805 devices can provide protection not only for the 7805 itself, but also for other parts of the circuit. 7805 series ICs do not require additional components to provide a constant, regulated source of power, making them easy to use, as well as economical and efficient uses of space. Other voltage regulators may require additional components to set the output voltage level, or to assist in the regulation process. Some other designs (such as a switched-mode power supply) may need substantial engineering expertise to implement.

Chapter No. 9 9.1: Resistor:

Fig:9.1: Diagram Of Resistor A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. The current through a resistor is in direct proportion to the voltage across the resistor's terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the intensity of current through the circuit is called resistance. This relation is represented by Ohm's law: where I is the current through the conductor in units of amperes, V is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current. Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are also implemented within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits. The electrical functionality of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than nine orders of magnitude. When specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications. Practical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is mainly of concern in power electronics applications. Resistors with higher power ratings are physically larger and may require heat sinks. In a high-voltage circuit, attention must sometimes be paid to the rated maximum working voltage of the resistor. Practical resistors have a series inductance and a small parallel capacitance; these specifications can be important in high-frequency applications. In a low-noise amplifier or pre-amp, the noise characteristics of a resistor may be an issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent on the technology used in manufacturing the resistor. They are not normally specified individually for a particular family of resistors manufactured using a particular technology A family of discrete resistors is also characterized according to its form factor, that is, the size of the device and the position of its leads (or terminals) which is relevant in the practical manufacturing of circuits using them.

Advantages: ●	Major advantages of street lighting includes: prevention of accidents and increase in safety.Studies have shown that darkness results in a large number of crashes and fatalities, especially those involving pedestrians; pedestrian fatalities are 3 to 6.75 times more likely in the dark than in daylight. Street lighting has been found to reduce pedestrian crashes by approximately 50%. ●	Furthermore, lighted intersections and highway interchanges tend to have fewer crashes than unlighted intersections and interchanges. ●	Towns, cities, and villages use the unique locations provided by light poles to hang decorative or commemorative banners. ●	Many communities in the U.S. use light poles as a tool for fund raising via light pole banner sponsorship programs first designed by a U.S. based light pole banner manufacturer.

Future Scope:

● Wireless based sensor traffic light controller. ●  As Traffic light controller in every road. ● As Traffic light controller in bridge.

Conclusions: In this article we first showed that traffic control is an important research area, and its benefits Make investments worthwhile. We described how traffic can be modelled, and showed the practical use of some models. In section 3 we explained reinforcement learning, and showed its use as an optimization algorithm for various control problems. We then described the problem of traffic light control and several intelligent traffic light controllers, before showing how car-based reinforcement learning can be used for the traffic light control problem. In our approach we let cars estimate their gain of setting their lights to green and let all cars vote to generate the traffic light decision. Co-learning is a special feature of our car-based reinforcement learning algorithm that allows drivers to choose the shortest route with lowest expected waiting time.

References: www.wikepedia.com www.whereisdoc.com www.8091.com