Search for question
Question

2024 Session 1 ELEC3042 Major Project Introduction Your task is to design and implement the traffic control system for the intersection of Railway Parade and East Street, as well as also integrating the railway crossing on East Street (shown below). The minimum requirements listed for this assessment task are designed to enable you to demonstrate that you have achieved the learning outcomes of the unit. The extensions are for students who want to demonstrate that they have excelled in understanding the unit material. This document summarises the specifications and requirements. You should read the entire document carefully before starting. If you feel any part of the specifications are ambiguous, please post your question to the General Discussion Forum on iLearn. Do not make assumptions. This is an individual project. Your C code and answers to the defence questions must be your own work. You must not share your files with anybody else. The only external source files allowed are the xc.h, avr/io.h, avr/interrupt.h, and avr/sleep.h header files. You may write your own header files. For any other libraries, you must first obtain permission from the convenors before using them. Railway Parade S1 SO S4 S2 S3 Gates Closed S5 O v1.0 24S1 ELEC3042 Major Project East Street รวย This material is provided to you as a Macquarie University student for your individual research and study purposes only. You cannot share this material publicly without permission. Macquarie University is the copyright owner of (or has licence to use) the intellectual property in this material. Legal and/or disciplinary actions may be taken if this material is shared without the University's written permission. Major Project Intersection The road intersection is the cross road junction between a main road and a minor road. The main road is called Railway Parade and the minor road is called East Street. East Street has two lanes, one for each direction, with cars entering the junction from East Street being able to turn both left and right. Railway Parade has two lanes entering the intersection from both the northbound and southbound directions. There is one through lane, and a dedicated right hand turn lane. When a right hand turning lane has a green light then the opposite through lane must be displaying a stop light. If there is NO light showing on a turning lane then traffic can turn with care if there is no oncoming traffic. When traffic is exiting East Street, no traffic should be allowed to enter the intersection from Railway Parade. East Street Railway Junction East Street crosses a railway level crossing. Traffic on East Street is controlled by lights and gates for the level crossing When a train is approaching the two signal lights start to flash in an alternating pattern, with each light being on when the other is off. The gate starts to close after the light pattern is established and must be closed before the train passes. When the level crossing is activated the main cross road intersection's behaviour should be modified to reduce the number of cars entering East Street, and to allow any cars on East Street to exit through the intersection. This is designed to enable the cars waiting for the lights to drain in case there were cars illegally queued on the train tracks. Minimum System Requirements These requirements, if fully implemented will results in a credit grade. Operation of the Controller: The controller must initialise itself in the Hazard phase. In the Hazard phase, all lights in the system are off except for the nominated lights. These nominated lights flash simultaneously in an alternate on/off fashion. The nominated lights are all on for one second then all off for one second. All non-nominated lights remain off at all times during hazard phase. The nominated lights at the intersection are the car yellow lights on Railway Parade and the car yellow lights on East Street. After 10 s in the Hazard phase, your system will move to normal operation, initially allowing through traffic on Railway Parade between north and south. During normal operation, one of the following traffic phases of the intersection should occur: East Street Through (EST): Traffic is allowed to proceed from both sides of East Street into the intersection. Railway Parade Right Turn (RPR): One or both of the right turn lanes on Railway Parade are green. Railway Parade Straight (RPS): The car lanes that allow traffic on Railway Parade to go straight can proceed. The extensions may add additional flows to this state. Note that turning and straight phases are acceptable, and additional phases may need to be added. ELEC3042-2024 Session 1 Major Project v1.6 O Macquarie University 2024 Page 2 The lights in the intersection should change in a predictable order to allow for the phases of traffic described above. You will need to arrange and justify the order you select. Your arrangement of lights should be optimal to maintain traffic flow. As a hint, the phases of traffic and state of the lights in the intersection are not synonymous and should not be considered interchangeable with each other when you are designing your system. Your controller should only allow a particular phase of traffic to occur when the corresponding sensor(s) has been triggered. A sensor is considered triggered for as long as it is connected to ground. If a sensor is triggered and then untriggers before you respond you must still respond to the triggering event. There are five input sensors at the intersection (indicated by So to S4 in the diagram), one for each lane of traffic in the intersection. If no sensors are triggered, the default phase of the intersection should be Railway Parade straight. Note: Consecutive occurrences of the same phase are not allowed. If necessary a phase of RPS must be inserted to ensure the same phase does not repeat. Points will be deducted if a set of lights progresses green → yellow → red and immediately goes to green again without some other light set going green in between. Timing: Except for the Hazard phase, the duration of the phases of traffic are prescribed in terms of time periods. A time period is by default 1 s. However, you are to add an adjustable input using a 10k linear potentiometer. The potentiometer is to be connected to Port C, Pin 0. When on 'full' (5 V), the time period is 1 s. As the voltage is reduced, the time per time period is reduced until it reaches 0 V where it should represent 50 ms per time period. Each phase of traffic has a minimum time of operation. The timing should be extended to the maximum time as long as the sensor(s) corresponding to that phase are triggered. However, when the maximum time is reached, it should move on to the next phase according to your predetermined order (as long as that next sensor has been triggered). The minimum and maximum Green light times are: Phase Minimum Time Maximum Time East Street to Railway Parade Railway Parade Right Turn(s) Railway Parade Straight 2 Time Periods 4 Time Periods 2 Time Periods 3 Time Periods 4 Time Periods 6 Time Periods / Unlimited if no other traffic Lights: →> The order of the traffic lights within a phase should be Red Green Yellow Red. Yellow lights are to be illuminated for 2 time periods (not included in the time period for the phase). Between phases, the red light must be illuminated for 2 time periods before the following phase's green lights are illuminated. If a green light will be illuminated for both the current and next phases, that light set should not change to yellow, then red, then green. ELEC3042-2024 Session 1 Major Project v1.6 O Macquarie University 2024 Page 3 LCD Display: There is to be a 16x2 LCD display on the main controller. This display gives status information about the system. The top row of the LCD display is reserved for indicating the state of the sensors and and the system time. The bottom row is for showing the phase of the intersection. The grey character positions are reserved and should not be used. The remaining character locations on the bottom row can be used to display other useful diagnostic information of your choosing. The leftmost 7 positions are reserved for displaying the state of the input sensors. Whilst a sensor is triggered, the corresponding character location should display an 'X' character (display code 0x58). When the trigger input has been handled, the corresponding character should display an ‘_' character (display code 0x5F). These should follow the debounced inputs. Thus they are triggered whenever the corresponding button is pressed and not triggered when the software has handled the input. The rightmost 5 positions on the top row are reserved for displaying a 5-digit time period counter. The counter is initialised to 00000 and increases once per time period until 99999. When 99999 is reached, it should roll over back to 00000 and continue the count. The leftmost 9 positions on the bottom row are for showing the active phase(s) of the system and the state of the lights. Here, active means lights corresponding to that phase of traffic will cycle through red->green->yellow->red. The positions indicated by P1 and P2 are reserved for showing the current phase(s) of traffic using the acronyms above (EST, RPR, RPS). If only one phase of traffic is active, use only the positions indicated by P1 and C1. The positions P2 and C2 should be blank. If two phases of traffic are active simultaneously, use P1 and P2. The character positions C1 and C2 should be used to indicate the current colour (R, Y, G, or B (all lights off)) of the light that is illuminated corresponding to the phase shown in P1 and P2, respectively. Position D is to indicate the direction of traffic on Railway Parade if only one direction is flowing. Use N to indicate Northbound and S to indicate Southbound. If traffic is flowing in both directions on Railway Parade, D should be blank. During the Hazard phase, the acronym HZD should be shown in P1, and the colour characters should be blank. The grey character positions are reserved and should not be used. The remaining character locations on the bottom row can be used to display other useful diagnostic information of your choosing. S6 S5 S4 S3 S2 S1 So 00 0 0 0 D P1 P1 P1 C1 P2 P2 P2 C2 Hazard Input: Port B, Pin 0, is the hazard input. When this input is connected to ground, the traffic lights must change to the hazard phase of operation (as described earlier), and must remain in Hazard as long as this pin is grounded. When disconnected from ground, the controller must continue in the hazard phase for an additional 10 seconds before returning to normal operation. ELEC3042-2024 Session 1 Major Project v1.6 O Macquarie University 2024 Page 4 Extension 1 (required for Distinction Grade) You must meet the above requirements and pass all published tests before attempting this extension. Note, the POT and thus variable time periods MUST be working before you attempt any extensions. Duplicate the working project from above before starting the extension. You will need to upload both versions for submission. In addition to the above requirements, your traffic control system must now also control the train crossing on East Street. For the operation of the train crossing there is a single input, train approaching. This input, when active, will signal that a train is approaching and that the train lights should be flashing and the gate should be lowered. The lights will continue to flash, and the gate should remain down until the train is no longer present and the signal is no longer asserted, in which case the gates should be opened and the lights stop flashing. Hazard phase for Extension 1: At the train crossing on East Street, the additional nominated lights are the two train crossing lights only. The timing pattern of the flashing is identical and in phase with the main intersection. After the hazard phase the crossing will continue to flash if a train is approaching until there is no train signalled. Normal operation: There are two modes of traffic at the train crossing: Train approaching and No Train. Port B, pin 2, input S5 is the train approaching input. When asserted (asserted LOW) the system must change to train approaching mode and stay in that mode until the signal is de-asserted. Mode Speaker Train Signals Train Gate Train Approaching Chirps once per second Until the signal is no longer asserted Until the signal is no longer asserted No train Silent Off Off When a train is approaching the two train lights (TC1, TC2: Port D pins 4 and 5) will flash in an alternating pattern. One will be illuminated for 1 time period with the other not illuminated then they both change and the other is not illuminated. This is different to the hazard style of flashing, where they both are illuminated or not illuminated simultaneously. When the train gate is lowered the Train gate Signal (Port D pin 7) must be illuminated. A speaker is to be attached to the system through Port B, Pin 1, for pedestrians with visual impairment. The speaker should issue a chirp once every time period when the train signals are red. When there is no train the speaker should not sound. Note, the pitch of your speaker sounds must not be affected by the setting of the POT. ELEC3042-2024 Session 1 Major Project v1.6 O Macquarie University 2024 Page 5/n • Deliverables Need a C code for the Arduino Uno including xc.h, avr/io.h, avr/interrupt.h, and avr/sleep.h only files and written own header file to complete all extensions separately. Code should run in MP Lab. It should compile with ardiuno ide with the mentioned requirements in the documents. The code should compile without any error and warning and it need to satisfy minimum requirement before go to the extension. Need to select the preferred traffic phase order from the given traffic phases. Student choose in RPR to EST to RPR order. Port setup should be same as provided document Minimum requirement code should be in separately and extension 1 code should be separate files NOTE: Student Have attached the state diagram and pseudo code as reference. and attached written header file for SPI you can use that to code. and use xc.h, avr/io.h, avr/interrupt.h, and avr/sleep.h only files and written own header file.