report traffic kami

Upload: kerk-yi-wen

Post on 03-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Report Traffic Kami

    1/22

    i

    1.0 INTRODUCTION

    The main purpose of this project is to monitor the smart traffic light system. The

    monitoring system in engineering is a process within a distributed system for collecting and

    storing state data. The source is monitored by using a computer at the receiver end. A simple

    monitoring system is established where a computer is used to monitor the system hardware

    which is the representation of the traffic light source that have to be monitored using software

    such as C++ or Visual Basic. In this project, Microsoft Visual Basic had been chosen in order to

    monitor the system.

    The project design consists of two main parts which are the smart part and the monitoring

    part. The monitoring system involves interfacing device between sensor and computer for

    database display. The sensor communicates with the computer through parallel communication.

    The communication between the hardware and the computer is implemented from the Open

    System Interconnection (OSI) reference model; a standard for inter computing in this project.

    The device is based on the Physical Layer and Data Link Layer, the 1st & 2nd layer of the OSI

    model respectively

    Furthermore, this project would help to enhance teamwork within each of the group

    members, build communication skills, and expose each member to the practical applications of

    Data and Computer Networking.

    1.1 Objectives

    To design smart traffic light circuit (hardware) and its monitoring system. To monitor the smart traffic light circuit in which to create a network for data to be

    transmitted from hardware to a user interface.

    To enhance each members teamwork and communication skills by sharing information. To expose each student to the possible networking solutions for a particular situation,

    learning how to evaluate each solution and applying the best choice in real-time

    successfully.

    To apply the application of Data and Computer Networking in daily applications.

  • 7/29/2019 Report Traffic Kami

    2/22

  • 7/29/2019 Report Traffic Kami

    3/22

    iii

    2.0 LITERATURE REVIEWA traffic signal is an electronic device that assigns right-of-way at an intersection or street

    crossing by means of displaying the standard red, yellow, and green-colored indications. In

    addition, it also works in conjunction with pedestrian displays to assign pedestrian crossing right-

    of-way.

    Most traffic lights will have the following components or parts [1]:

    Figure 1: Traffic light parts

    From the above figure:

    A. Main display with red, yellow, and green lights.B. Pedestrian crossing lights containing both the WALK and DONT WALK light

    indications.

    C. Traffic light cabinet containing the traffic light controller.

  • 7/29/2019 Report Traffic Kami

    4/22

    iv

    And vehicles system either:

    D. Inductive loops or sensors.E. Video detection system.

    Figure 2: Traffic light sequence

    This project operates red and green LEDs in the correct sequence. It uses a 555 astable

    circuit to provide the clock pulses for the 4017 counter.

    The 555 astable circuit provides clock pulses for the 4017 counter which has ten outputs

    (Q0 to Q9). Each output becomes high in turn as the clock pulses are received. Appropriate

    outputs are combined with diodes to supply the amber and green LEDs. The red LED is

    connected to the 10 output which is high for the first 5 counts (Q0-Q4 high), this saves using 5

    diodes for red and simplifies the circuit.

    This project also uses a Universal Serial Bus (USB) where it is a serial bus standard to

    interface devices to a host computer. USB was designed to allow many peripherals to be

    connected using a single standardized interface socket and to improve the plug-and-play

    capabilities by allowing hot swapping, that is, by allowing devices to be connected and

    disconnected without rebooting the computer or turning off the device. Its providing power to

    low-consumption without the need for an external power supply

  • 7/29/2019 Report Traffic Kami

    5/22

    v

    The following table shows the classes of the USB:

    Classes Descriptions Examples

    Class 1 Audio Speaker, microphone, sound card

    Class 2 Communication Device Class Analog Modems, ISDN modems, Telephone

    sets, Ethernet control, ATM control, etc.

    Class 3 Human Interface Devices Mouse, Keyboard, Tablet, Joystick, Barcode

    reader,

    Class 6 Image Webcam, scanner

    Class 7 Printers Laser printer, inkjet printer, CNC machine

    Class 8 Mass Storage USB flash drive, memory card reader, digital

    audio player, digital camera, external drive

    Class 9 HUB Full speed hub, hi-speed hub

    Class 10 Data Interface Class

    Class 11 Chip card/ Smart Card

    Class 255 Vendor - Specific

    Table 2: Classification of USB

    Apart from that, another important component is the PIC18F4550 which has USB

    connector to connect and interface with PC or other USB host. Microchip provides free firmware

    for USB HID (human interface device) device which can use to make custom mouse, joystick,

    CDC (communication class device), Audio class device, Mass storage device, USB to RS232.

    NE555 timer also plays an important rule in this project. The 555 Timer IC is an

    integrated circuit (chip) implementing a variety of timer and multivibrator applications.

    The 555 has three operating modes:

    http://en.wikipedia.org/wiki/Loudspeakerhttp://en.wikipedia.org/wiki/Microphonehttp://en.wikipedia.org/wiki/Sound_cardhttp://en.wikipedia.org/wiki/Webcamhttp://en.wikipedia.org/wiki/Image_scannerhttp://en.wikipedia.org/wiki/Laser_printerhttp://en.wikipedia.org/wiki/Inkjet_printerhttp://en.wikipedia.org/wiki/Numerical_controlhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Memory_cardhttp://en.wikipedia.org/wiki/Card_reader#Memory_card_readershttp://en.wikipedia.org/wiki/Digital_audio_playerhttp://en.wikipedia.org/wiki/Digital_audio_playerhttp://en.wikipedia.org/wiki/Digital_camerahttp://en.wikipedia.org/wiki/Digital_camerahttp://en.wikipedia.org/wiki/Digital_audio_playerhttp://en.wikipedia.org/wiki/Digital_audio_playerhttp://en.wikipedia.org/wiki/Card_reader#Memory_card_readershttp://en.wikipedia.org/wiki/Memory_cardhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Numerical_controlhttp://en.wikipedia.org/wiki/Inkjet_printerhttp://en.wikipedia.org/wiki/Laser_printerhttp://en.wikipedia.org/wiki/Image_scannerhttp://en.wikipedia.org/wiki/Webcamhttp://en.wikipedia.org/wiki/Sound_cardhttp://en.wikipedia.org/wiki/Microphonehttp://en.wikipedia.org/wiki/Loudspeaker
  • 7/29/2019 Report Traffic Kami

    6/22

    vi

    Monostable mode: in this mode, the 555 functions as a "one-shot". Applications includetimers, missing pulse detection, bouncefree switches, touch switches, frequency divider,

    capacitance measurement, pulse-width modulation (PWM).

    Astable - free running mode: the 555 can operate as an oscillator. Uses include LED andlamp flashers, pulse generation, logic clocks, tone generation, security alarms, pulse

    position modulation.

    Bistable mode or Schmitt trigger: the 555 can operate as a flip-flop, if the DIS pin is notconnected and no capacitor is used. Uses include bounce free latched switches.

    Figure 3: NE555 Timer

    4017 counter also had been used in this circuit. It is an automatic counter correction. It aCMOS. Therefore, it is sensitive with electricity.

    The model 4017 integrated circuit is a CMOS counter with ten output terminals. One of

    these ten terminals will be in a "high" state at any given time, with all others being "low," giving

    a "one-of-ten" output sequence. If low-to-high voltage pulses are applied to the "clock" (Clk)

    terminal of the 4017, it will increment its count, forcing the next output into a "high" state.

    With a 555 timer connected as an astable multivibrator (oscillator) of low frequency, the

    4017 will cycle through its ten-count sequence, lighting up each LED, one at a time, and

    "recycling" back to the first LED. The result is a visually pleasing sequence of flashing lights.

    Feel free to experiment with resistor and capacitor values on the 555 timer to create different

    flash rates.

  • 7/29/2019 Report Traffic Kami

    7/22

    vii

    3.0 METHODOLOGY

    This project requires hardware, software and system requirements. Concerning

    requirements, there are two major parts to this project, thus for the sake of proper assignment, the

    requirements will be considered for each part respectively.

    Hardware:

    Requirements for the hardware:

    1. Minimal power consumption

    2. Easy for maintenance

    3. Must be networked in some form to the user interface (monitoring system).

    Hardware Flow chart

    Figure 4: Hardware Flow chart

    Conceptualization

    Equipment Identification

    Drawing board design

    Schematic and Layout Design

    Soldering components according to Schematic

    Simulation and Testing

    Validation and Verification

    In the event of failure,

    return to drawing board

  • 7/29/2019 Report Traffic Kami

    8/22

    viii

    Software:

    Requirements for the software:

    1. The user shall be able to deduce the status of the traffic lights at any time from theDisplay.

    2. The system has the means to display all the information it contains.Software Flow chart

    Figure 5: Software Flow Chart

  • 7/29/2019 Report Traffic Kami

    9/22

  • 7/29/2019 Report Traffic Kami

    10/22

    x

    3.1 Project Management

    To ensure the smoothest possible progress during the course of the project, a timeline was

    created using Microsoft Project 2003. The main objective of this timeline is to provide a general

    guideline as to what activity or phase of the project was to be conducted at a specific point in

    time from start to finish. This way, the group had a concrete way of knowing if the project could

    be finished in time. The following is a screen capture of the timeline.

    Table 3: Timeline

  • 7/29/2019 Report Traffic Kami

    11/22

    xi

    Figure 6: Gantt chart

  • 7/29/2019 Report Traffic Kami

    12/22

    xii

    3.2 Hardware Design Summary

    To implement the hardware, this schematic was selected from a pool of resources

    provided by the research division. The following schematic was selected for its simplicity and

    cost-effectiveness (relatively cheap to design to serve as a prototype). [2]

    Figure 7: Strip board layout

  • 7/29/2019 Report Traffic Kami

    13/22

    xiii

    Figure 8: Circuit Block diagram for Software using Pspice

  • 7/29/2019 Report Traffic Kami

    14/22

    xiv

    3.3 Software Design Summary

    Figure 9: Software design in Visual Basic

  • 7/29/2019 Report Traffic Kami

    15/22

    xv

    Figures below shows the coding of the PIC pin declaration for receiving the input data

    and the program sending keyboard command:

    Figure 10: PIC pin declaration

    Assign the keyboard

    key character

    Send the

    data as

    packet

    according

    to the input

    detect

    Initialize port as

    digital I/O

    Assign the input pin

    for the PIC

  • 7/29/2019 Report Traffic Kami

    16/22

    xvi

    For the software part, Visual Basic 2008 is the graphic user interface that used to show

    the output from the hardware by using graphic. Visual basic will decode the raw data sent by the

    PIC chip into data that is intelligible by human. In visual basic, the source code used to convert

    the raw data of keyboard key that is programmed in the PIC to show the output of the hardware

    is shown below.

    Figure 11: Source code for output of the hardware

    The first prototype developed is tested and it shows positive result. Then, the prototype is

    integrated with the hardware part for further testing as a whole system. The software is

    connected with the hardware through the parallel cable. There is a minor error when the system

    is tested. The synchronization is not accurate. Initially, it is predicted there are some connection

    problems with the hardware. The other problem is predicted due to the coding of the software

    that is not relevant with the hardware.

    Function when key 5 from keyboard is

    received

    Function when key 3 from keyboard is

    received

    Function when key 2 from keyboard is

    received

    Function when key 4 from keyboard is

    received

    Function when key 6 from keyboard is

    received

  • 7/29/2019 Report Traffic Kami

    17/22

    xvii

    The OSI (Open System Interconnection) layer involve in this project are all the seven

    layer which include the physical layer, data link layer, network layer, transport layer, session

    layer, presentation layer and application layer.

    The physical layer is the sensor hardware and the PIC18F4550 hardware circuit that

    transmit raw bit (0 or 1) of data through communication channel like the wire use in this project.

    The physical layer is a medium that ensure that the data sent from the sensor hardware is

    correctly receive by the PIC and the data from PIC hardware is correctly receive by the computer

    via USB connection.

    The data link layer involve in this project is the node-to-node packet delivery service.

    In this data link, the raw bit data receive from the sensor hardware will be sub-divided into

    blocks of information known as frame. The data link also establishes the connection between

    hardware and hardware and use for error detection by using a simple checksum included at the

    end of the frame. The data link that involve in PIC 18F4550 will have the function of

    transmission or reception of structured streams of bits over the network media

    The network layer in this project is done by the PIC18F4550 where it converts themessage data from the data link into packets, and insure that all the packets can be correctly

    receive at the correct destination and in proper order.

    The transport layer also had been applied in this project. This layer provides for the

    transparent transfer of data and it can be viewed as a bridge between the communications

    oriented lower three layers and the application oriented upper three layers. The operating system

    in computer is the one that acts as the transport layer in this project. The speed of transferring

    data within the hardware and the computer is depending on the operating system in different

    computer. The transport layer also in charge of translates the packet into keyboard character

    according to keyboard protocol.

    The session layer supports the establishment, control and termination of dialoguesbetween application processes. In this project, visual basic shows the session layer when the

    circuit is plug into the computer using the USB, the data is receives by the visual basic from the

    keyboard. It facilitates full duplex operation and maintains continuity of session connections.

    The presentation layer is concerned with the syntax and semantics of the information

    transmitted. The presentation layer in this project is the script or source code use in the visual

    basic. The script or source code build in the visual basic is written based on the circuit that had

    been designed in this project.

    The application layer holds the user programs that do the actual work for which the

    computers were purchased. These programs make use of the services offered by the presentation

    layer for their communication needs. The application layer in this project is shows by the result

    that can be seen in the software implemented in the visual basic.

  • 7/29/2019 Report Traffic Kami

    18/22

    xviii

    4.0 RESULT AND DISCUSSION

    Figure 12: Final Circuit

    In this project, it consists of the hardware part, the interface part and the software part.

    The hardware is the smart traffic light circuit which consists of a Light Dependent Resistor

    (LDR), an IC555 timer and an IC4017 counter. The IC555 timer is connected according to the

    astable circuit to provide clock pulse to the 4017 counter which gives the outputs for the traffic

    light. The output of the 4017 counter time is calculate using T = 0.693 x (R1+2R2) x C1. In this

    hardware part, the LDR will be used to determine the time change of the traffic light for the car.

    When the resistance of the LDR is high, the time change will increase and vice verse.

  • 7/29/2019 Report Traffic Kami

    19/22

    xix

    Figure 13: Schematic of PIC18F4550

    As for the interface part shown in Figure 13, PIC18F4550 is used to interface the

    computer with the traffic light circuit using the USB. The 20MHz crystal oscillator of the PIC is

    used to provide the clock signal to the PIC while its corresponding 15pF capacitors and 1Mohm

    resistor are used to make the PIC oscillate properly. As for the two switch button from theschematic, the switch connected to the pin 1 of PIC is used for the reset function while the switch

    connected to pin 38 is used to program the chip. By holding the reset switch and the program

    switch, it will enter the bootloader mode which allows new program application to be loaded into

    the PIC. The others pin of PIC is used for I/O ports that is used to connected to the output of the

    hardware. The circuit above based on CUI board schematic for PIC chip programming.

    The PIC18F4550 in this project was programmed as HID (Human Interface Device) boot

    loader and MPLAB is used to write the C program coding into the .Hex file for the PIC. The

    program is based on sending keyboard command to the computer.

    The project was implemented and after final assembly, the testing phase was done. For

    the purpose of evaluating the performance of the system, the testing was conducted in several

    phases.

  • 7/29/2019 Report Traffic Kami

    20/22

    xx

    Firstly, the hardware and software were tested individually. After ascertaining that both

    components were working according to specifications, they were integrated.

    Upon integration, the system has achieved a final assembly phase. This is where the most

    vital testing was conducted. To enable a smooth testing, the requirements that have been set out

    for the system were consulted:

    1. The system must be able to detect errors.2. The system must be able to display the status of the traffic lights perpetually whilst

    powered on.

    3. The system must be able to provide enough of a change in terms of display in the userinterface to attract the attention of a user in the event of a failure

    The system stood up to all the non-functional requirements that were set out for it in the

    beginning. The users used the fault switches to throw the system into a state of error. The system

    was efficient enough to even display multiple errors that occurred simultaneously or

    concurrently.

    Advantages

    1. A simple circuitry had been implemented in this project.2. An infrared sensor had been uses in circuit of traffic light.

    Disadvantages

    1. Only consist of one set of traffic light.2. The sensor in this circuit only one second of delay.

  • 7/29/2019 Report Traffic Kami

    21/22

    xxi

    5.0 CONCLUSIONS AND RECOMMENDATIONS

    5.1 Conclusions:

    Project satisfied the plan as it was executed in an orderly fashion. The workload of each

    group member was evenly spread so as to reduce the burden and to enable fine-tuning of each

    phase. Integration was seamless and the system performed well under normal testing indicating

    its reliability and efficiency level to be adequate. Possible improvements have been noted and

    could be implemented if required. The system is open-ended enough to accept modifications.

    5.2 Recommendation:

    Hardware

    The traffic light is monitored at the operating room or operating building at one location. The

    distance is long between the traffic light and the operating room. If using parallel cable, the cost

    is increased when the distance is longer. To reduce the cost, the parallel cable is replaced by the

    serial cable and multiplexing and demultiplexing devices.

    Figure 14: Monitor the system using parallel cable.

    Figure 15: Monitor the system using serial cable.

  • 7/29/2019 Report Traffic Kami

    22/22

    xxii

    When monitoring more than one traffic light in an area, cabling is hard to perform.

    Wireless can be used to solve this problem when the geography of the area is hard to implement

    the cabling.

    Figure 16: Monitor the system using the wireless system.

    Another upgrade that can be made to the circuit is to make it compatible with a master

    control which enables discrete manipulation to the hardware function from the back of user seat.

    Personnel who monitor the status of the traffic light can use the master control to override

    control in case of malfunction, or any unexpected problem. Either the programming of the PIC

    have to be remade, or the circuitry, or both.

    Software

    The software could be equipped with the function of sending information to contact or

    notify the relevant personnel about the error that in the traffic lights. This can improve the

    troubleshooting. Since it has direct contact with the personnel or technician by just clicking few

    buttons in the software, therefore the traffic lights that have error can be repaired as soon as

    possible.

    The second improvement is the software will able to save the error and the time of the

    error occur in a database automatically. All the data consists of types of error, time and date of

    the error as well as the area or the particular traffic lights which is at fault. All these data will be

    used to manipulate an analysis on the probability of the fault of the traffic lights. By using all

    these analysis, the lifetime or performance of the traffic lights can be estimated and predicted.

    6.0 References[1]http://www.cityofpasadena.net/trans

    [2]www.rshelectronics.co.uk

    http://www.cityofpasadena.net/transhttp://www.cityofpasadena.net/transhttp://www.cityofpasadena.net/transhttp://www.rshelectronics.co.uk/http://www.rshelectronics.co.uk/http://www.rshelectronics.co.uk/http://www.rshelectronics.co.uk/http://www.cityofpasadena.net/trans