Density based traffic light controlling (2)


Published on

Published in: Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Density based traffic light controlling (2)

  1. 1. DENSITY BASED TRAFFIC LIGHT CONTROLLINGTABLE OF CONTENTS1.ABSTRACT2.SCHEMATIC DIAGRAM3. CIRCUIT DESCRIPTION4.INTRODUCTION4.1. EMBEDDED INTRODUCTION4.2. MICROCONTROLLER INTRODUCTION4.3. INTRODUCTION TO IRPAIRS.4.4. INTRODUCTION TO LCD.4.5 INTRODUCTION TO LEDS.4.5. KEIL INTRODUCTION5.COMPONENT DESCRIPTION5.1 .AT89S525.2. IR PAIRS5.3. LED ‘S5.4 LCD6.CODING7. REFERENCEAim:The aim of the project is to build a Traffic Control System Based onDensity.Scope:densityand by doing this Now a day’s public is facing lot of problems due the traffic controlespeciallywhere the heavy traffic junctions are present. In order to solvethe above problem the governmenthas implemented traffic light system,by which each side/way will be given an appropriate time forthe vehiclesto move on at regular time intervals. This is the scenario what we observeon behalf oftraffic control system.In the above scenario the traffic signal to a particular way will be givenonlyafter a particular time period. i.e., a time period is fixed we haveobserved a case where the densityof the traffic is more on one way whencompared to the other side. At this level the time is beingwasted leavingthe junction cool for some time. Due to this there are many problems. Inorder tosolve the above problem we have designed this project. Wherewe can automatically observe thedensity of the traffic and give thatparticular way priority and exceed the problem.In the presentproject we are using the help of IR Tx and Rx pairs atparticular intervals and taking appropriatecalculation of the density andat the same time giving priority to the way which is having high thetraffic will be automatically controlled based ondensity of the traffic.1)half wave2)Full wave and3)Bridge rectifier Here we short listed to use Bridge rectifier, because halfwave rectifier has we less in efficiency.Even though the efficiency of full wave and bridge rectifierare the same, since there is norequirement for any negative voltage for our application, we gonewith bridge rectifier.Since the output voltage of the rectifier is pulsating DC, in order to convert itinto pure DC we usea high value (1000UF/1500UF) of capacitor in parallel that acts as a filter. The
  2. 2. most easy way toregulate this voltage is by using a 7805 voltage regulator, whose output voltage isconstant 5VDC irrespective of any fluctuation in line voltageSELECTION OF MICROCONTROLLER:As we know that there so many types of micro controller families that areavailable in themarket.Those are1) 8051 Family2) AVR microcontroller Family3) PIC microcontroller Family4) ARMFamilyBasic 8051 family is enough for our application; hence we are not concentratingon higher endcontroller families.In order to fulfill our application basic that is AT89C51 controller is enough.Butstill we selected AT89S52 controller because of inbuilt ISP (in system programmer) option.Thereare minimum six requirements for proper operation of microcontroller.Those are:1)power supplysection2)pull-ups for ports (it is must for PORT 0)3)Reset circuit4)Crystal circuit5)ISP circuit (for programdumping)6)EA/VPP pin is connected to VccPORT0 is open collector that’s why we are using pull-up resistor which makes PORT0 as an I/Oport.Reset circuit is used to reset the microcontroller. Crystal circuit is used for themicrocontroller fortiming pluses. In this project we are not using external memory that’s whyEA/VPP pin in themicrocontroller is connected to Vcc that indicates internal memory is used for this application.SELECTION OF IR PAIR:IR PAIRSare available in IR TX & IR RX. Here we are using it only for Detectingand sending information to themicrocontroller.This is wireless applications, these IR TX issending information upto 1 feet & thissignal is received by IR RX .SELECTION OF RELAYS:The relay is an automatic control element whose output variableundergoes a change by leaps andbounds when its input variable (electric, magnetic,sound, light) reaches a set pointSELECTION OF LCD:A liquid crystal display (LCD) is an electronically-modulatedoptical device shaped into a thin, flatpanel made up of any number of color or filled monochrome pixels withliquid crystals and arrayed infront of a light source(backlight) or reflector. In this project l LCD isused to display the GSM status.CONNECTIONS OF LCD
  3. 3. :We can connect LCD in 8 bit mode or 4 bit mode, if use 8 bit mode more pins necessaryto interfaceLCD, so we can use 4 bit mode to reduce pins .In this project i used 4 bit mode and itis connected toP0.CIRCUIT OPERATIONIn this application we are using GSM module to receive as well as totransmit the messages.whenever we send the command to GSM module then it can doparticular operation dependingupon the command. Whenever we send a command to GSMmodule it can send the messages as wellas mobile number to controller through serialinterface .The controller read the message from serialinterface of GSM if it is valid messagethen controller can turn the motor to open the door as well ascontroller can display the mobilenumber on lcd. After a particular time the door is automatically willbe closed. Microcontroller can send the result operation to GSM whether door is opened or notopened then GSM modulecan send the message back to mobile.INTRODUCTION TO EMBEDDED SYSTEMSEmbedded systems are electronic devices that incorporate microprocessors with in theirimplementations. The main purposes of the microprocessors are to simplify the system designandprovide flexibility. Having a microprocessor in the device helps in removing the bugs,makingmodifications, or adding new features are only matter of rewriting the software that controlsthedevice. Or in other words embedded computer systems are electronic systems that includeamicrocomputer to perform a specific dedicated application. The computer is hidden insidetheseproducts. Embedded systems are ubiquitous. Every week millions of tiny computer chipscomepouring out of factories finding their way into our everyday products.Embedded systems areself-contained programs that are embedded within a piece of hardware. Whereas a regularcomputer has many different applications and software that can beapplied to various tasks,embedded systems are usually set to a specific task that cannot bealtered without physicallymanipulating the circuitry. Another way to think of an embedded systemis as a computer systemthat is created with optimal efficiency, thereby allowing it to completespecific functions as quickly aspossible.Embedded systems designers usually have a significant grasp of hardwaretechnologies.They use specific programming languages and software to develop embedded systemsandmanipulate the equipment. When searching online, companies offer embeddedsystemsdevelopment kits and other embedded systems tools for use by engineers andbusinesses.Embedded systems technologies are usually fairly expensive due to thenecessarydevelopment time and built in efficiencies, but they are also highly valued in specificindustries.Smaller businesses may wish to hire a consultant to determine what sort of embeddedsystemswill add value to their organization.
  4. 4. CHARACTERISTICS:Two major areas of differences are cost and power consumption. Since many embeddedsystems areproduced in tens of thousands to millions of units range, reducing cost is a major concern.Embedded systems often use a (relatively) slow processor and small memory size tominimize costsThe slowness is not just clock speed. The whole architecture of the computer is oftenintentionallysimplified to lower costs. For example, embedded systems often use peripheralscontrolled bysynchronous serial interfaces, which are ten to hundreds of times slower thancomparableperipherals used in PCs. Programs on an embedded system often run with real-timeconstraints withlimited hardware resources: often there is no disk drive, operating system,keyboard or screen. Aflash drive may replace rotating media, and a small keypad and LCDscreen may be used instead of aPCs keyboard and screen.Firmware is the name for software that is embedded in hardware devices,e.g. in one or more ROM/Flash memory IC chips. Embedded systems are routinely expected tomaintain 100%reliability while running continuously for long periods, sometimes measured in years.Firmware isusually developed and tested too much harsher requirements than is general-purposesoftware,which can usually be easily restarted if a problem occurs.PLATFORM:There are many different CPU architectures used in embedded designs. This in contrastto thedesktop computer market which is limited to just a few competing architectures mainlytheIntel/AMD x86 and the Apple/Motorola/IBM Power PC’s which are used in the AppleMacintosh.One common configuration for embedded systems is the system on a chip, anapplication-specific integrated circuit, for which the CPU was purchased as intellectual property toadd to theICs design.TOOLS:Like a typical computer programmer, embedded system designers use compilers,assemblers anddebuggers to develop an embedded system. Those software tools can comefrom severalsources:Software companies that specialize in the embedded market Ported from theGNU softwaredevelopment tools. Sometimes, development tools for a personal computer can beused if theembedded processor is a close relative to a common PC processor. Embeddedsystem designers alsouse a few software tools rarely used by typical computer programmers.Some designers keep a utilityprogram to turn data files into code, so that they can include anykind of data in a program. Mostdesigners also have utility programs to add a checksum or CRCto a program, so it can check itsprogram data before executing it.OPERATING SYSTEM:They often have no operating system, or a specialized embedded operating system(often a real-timeoperating system), or the programmer is assigned to port one of these to thenew system.DEBUGGING:
  5. 5. Debugging is usually performed with an in-circuit emulator, or some type of debugger thatcaninterrupt the micro controller’s internal microcode. The microcode interrupt lets the debuggeroperate in hardware in which only the CPU works. The CPU-based debugger can be used to testanddebug the electronics of the computer from the viewpoint of the CPU.Developers should insist ondebugging which shows the high-level language, withbreakpoints and single stepping, because thesefeatures are widely available. Also, developersshould write and use simple logging facilities to debugsequences of real-time events. PC or mainframe programmers first encountering this sort ofprogramming often become confusedabout design priorities and acceptable methods. Mentoring,code-reviews and ego lessprogramming are recommended.DESIGN OF EMBEDDED SYSTEMS:The electronics usually uses either a microprocessor or a microcontroller. Some large or old systemsuse general-purpose mainframes computers or minicomputers.START-UP:All embedded systems have start-up code. Usually it disables interrupts, sets up theelectronics, teststhe computer (RAM, CPU and software), and then starts the application code.Many embeddedsystems recover from short-term power failures by restarting (without recentself-tests). Restarttimes under a tenth of a second are common.Many designers have found one of more hardwareplus software-controlledLED’s useful to indicate errors during development (and in some instances,after product release,to produce troubleshooting diagnostics). A common scheme is to have theelectronics turn off theLED(s) at reset, whereupon the software turns it on at the first opportunity,to prove that thehardware and start-up software have performed their job so far. After that, thesoftware blinks theLED(s) or sets up light patterns during normal operation, to indicate programexecution progressand/or errors. This serves to reassure most technicians/engineers and some usersTHE CONTROL LOOP:In this design, the software has a loop. The loop calls subroutines. Each subroutinemanages a part ofthe hardware or software. Interrupts generally set flags, or update countersthat are read by the restof the software. A simple API disables and enables interrupts. Doneright, it handles nested calls innested subroutines, and restores the preceding interrupt state inthe outermost enable. This is one ofthe simplest methods of creating an exocrine.Typically, theres some sort of subroutine in the loopto manage a list of software timers,using a periodic real time interrupt. When a timer expires, anassociated subroutine is run, or flagis set. Any expected hardware event should be backed-up with asoftware timer. Hardwareevents fail about once in a trillion times.State machines may beimplemented with a function-pointer per state-machine(in C++, C or assembly, anyway). A change ofstate stores a different function into the pointer.The function pointer is executed every time theloop runs.Many designers recommend reading each IO device once per loop, and storing theresultso the logic acts on consistent values. Many designers prefer to design their state machinestocheck only one or two things per state. Usually this is a hardware event, and a softwaretimer.Designers recommend that hierarchical state machines should run the lower-level statemachinesbefore the higher, so the higher run with accurate information.Complex functions like
  6. 6. internal combustion controls are often handled with multi-dimensional tables. Instead of complexcalculations, the code looks up the values. The softwarecan interpolate between entries, to keep thetables small and cheap.One major disadvantage of this system is that it does not guarantee a time torespond toany particular hardware event. Careful coding can easily assure that nothing disablesinterruptsfor long. Thus interrupt code can run at very precise timings. Another major weakness ofthissystem is that it can become complex to add new features. Algorithms that take a long time torunmust be carefully broken down so only a little piece gets done each time through the mainloop.This systems strength is its simplicity, and on small pieces of software the loop is usuallyso fastthat nobody cares that it is not predictable. Another advantage is that this systemguarantees thatthe software will run. There is no mysterious operating system to blame for badbehavior.USER INTERFACES:Interface designers at PARC, Apple Computer, Boeing and HP minimize the number of types of useractions. For example, use two buttons (the absolute minimum) to control a menusystem (just to beclear, one button should be "next menu entry" the other button should be"select this menu entry").A touch-screen or screen-edge buttons also minimize the types of user actions.Another basic trick isto minimize and simplify the type of output. Designs should consider using a status light for eachinterface plug, or failure condition, to tell what failed. A cheapvariation is to have two light bars witha printed matrix of errors that they select- the user can glueon the labels for the language that shespeaks.For example, Boeings standard test interface is a button and some lights. When youpress thebutton, all the lights turn on. When you release the button, the lights with failures stayon. The labelsare in Basic English.Designers use colors. Red defines the users can get hurt- think of blood. Yellowdefinessomething might be wrong. Green defines everythings OK.Another essential trick is to makeany modes absolutely clear on the users display. If aninterface has modes, they must be reversiblein an obvious way. Most designers prefer thedisplay to respond to the user. The display shouldchange immediately after a user action. If themachine is going to do anything, it should start within 7seconds, or give progress reports.One of the most successful general-purpose screen-basedinterfaces is the two menubuttons and a line of text in the users native language. Its used in pagers,medium-pricedprinters, network switches, and other medium-priced situations that require complexbehavior from users. When theres text, there are languages. The default language should be theone mostwidely understoodINTRODUCTION TO MICROCONTROLLERMicrocontrollers as the name suggests are small controllers. They are like singlechip computers thatare often embedded into other systems to function as processing/controllingunit. For example theremote control you are using probably has microcontrollers inside that dodecoding and othercontrolling functions. They are also used in automobiles, washing machines,microwave ovens, toys... etc, where automation is needed.Micro-controllers are useful to the extent that theycommunicate with other devices, such as sensors, motors, switches, keypads, displays, memory andeven other micro-controllers. Many interface methods have been developed over the years to solvethe complexproblem of balancing circuit design criteria such as features, cost, size, weight, power
  7. 7. consumption, reliability, availability, manufacturability. Many microcontroller designs typicallymixmultiple interfacing methods. In a very simplistic form, a micro-controller system can be viewedasa system that reads from (monitors) inputs, performs processing and writes to (controls)outputs.Embedded system means the processor is embedded into the requiredapplication. Anembedded product uses a microprocessor or microcontroller to do one task only.In an embeddedsystem, there is only one application software that is typically burned into ROM.Example: printer,keyboard, video game player Microprocessor - A single chip that contains the CPU or most of thecomputer Microcontroller - A single chip used to control other devicesMicrocontroller differs from amicroprocessor in many ways. First and the mostimportant is its functionality. In order for amicroprocessor to be used, other components such asmemory, or components for receiving andsending data must be added to it. In short that meansthat microprocessor is the very heart of thecomputer. On the other hand, microcontroller isdesigned to be all of that in one. No other externalcomponents are needed for its applicationbecause all necessary peripherals are already built into it.Thus, we save the time and spaceneeded to construct devicesMICROPROCESSOR VS MICROCONTROLLER:Microprocessor:•CPU is stand-alone, RAM, ROM, I/O, timer are separate•Designer can decide on the amount of ROM, RAM and I/O ports.•expensive•versatility general-purposeMicrocontroller:•CPU, RAM, ROM, I/O and timer are all on a single chip•fix amount of on-chip ROM, RAM, I/O ports•for applications in which cost, power and space are critical•
  8. 8. single-purposeINTRODUCTION TO IR PAIRS•INTRODUCTION TO LIQUID CRYSTAL DISPLAY (LCD)Liquid crystal displayis a type of display which used in digital watches and manyportable computers. LCD displays utilizetwo sheets of polarizing material with a liquid crystalsolution between them. An electric currentpassed through the liquid causes the crystals to alignso that light cannot pass through them. Eachcrystal, therefore, is like a shutter, either allowinglight to pass through or blocking the light.Theliquid crystals can be manipulated through an applied electric voltage so that light isallowed to passor is blocked. By carefully controlling where and what wavelength (color) of lightis allowed to pass,the LCD monitor is able to display images. A back light provides LCDmonitor’s brightness.Otheradvances have allowed LCD’s to greatly reduce liquid crystal cell responsetimes. Response time isbasically the amount of time it takes for a pixel to “change colors”. Inreality response time is theamount of time it takes a liquid crystal cell to go from being active toinactive. They makecomplicated equipment easier to operate. LCD’s come in manyshapes and sizes but the mostcommon is the 16 character x 4 line (16x4) display with nobacklight. It requires only 11 connections –eight bits for data (which can be reduced to four if necessary) and three control lines (we have onlyused two here). It runs off a 5V DC supply andonly needs about 1mA of current. The display contrastcan be varied by changing the voltage intopin 3 of the display,PIN DESCRIPTIONOF LCD:From this description,the interface is a
  9. 9. parallel bus, allowingsimple andfastreading/writing ofdata to and from theLCD. This waveformwill write an ASCIIByte out to theLCDsscreen.PINDESCRIPTIONS:VCC, VSS and VEE:
  10. 10. While VCC and VSSprovide +5V and groundrespectively, VEE isused for controllingLCDcontrast.P I N S YM B O L I/ O D E SC R I P TI O N1 VS S --
  11. 11. G r ou n d2 V C C- -+ 5 Vp o w ers u p pl y 3 VE E - -P o w ers u p p
  12. 12. l yt o controlcontrast4 RS I RS = 0t os e le c t command register
  13. 13. PIN DESCRIPTION OF LCD:From this description, the interface is a parallel bus, allowing simple and fastreading/writing of datato and from the LCD. This waveform will write an ASCII Byte out to theLCDs screen.PIN DESCRIPTIONS:VCC, VSS and VEE:
  14. 14. While VCC and VSS provide +5V and ground respectively, VEE is used for controllingLCD contras