You are on page 1of 8

ELET 435

DATA ACQUISITION AND CONTROL

LABORATORY EXPERIMENT 12
LAB MANUAL
LAB EXPERIMENT – 12: THE TWO WAY TRAFFIC LIGHT PROJECT

THE TWO WAY TRAFFIC LIGHT PROJECT

PERFORMANCE OBJECTIVES
Upon completion of this laboratory exercise, the student technicians/engineers will be able to:
1. Generate 4 bit patterns of predefined delays.
2. Interface digital signals using LABVIEW on NI ELVIS board using DAQmx.
3. Design a LABVIEW traffic light controller.

TOOLS & EQUIPMENT


 LABVIEW equipped PC
 NI ELVIS
 NI LABVIEW 8.6 or above
 NI MULTSIM
 Digital Multi Meter (DMM)

MATERIALS
 Any M-Series Data Acquisition Board (i.e. NI PCI 6122)
 Terminal Block and Function Generator, for example the BNC-2120, NI ELVIS, or
any other connector block
 SH68-68-EP Shielded Cable or r6868 Ribbon Cable
 BNC to BNC cables
 connection wires
 Six 220 Ω resistors
 Two red LEDs
 Two yellow LEDs
 Two green LEDs

DISCUSSION
Traffic control signals are signaling devices positioned at road intersections, pedestrian
crossings and other locations to control competing flows of traffic. Traffic lights alternate
the right of way accorded to road users by displaying lights of a standard color (red, yellow,
and green) following a universal color code.

EEET 435–DATA ACQUISITION AND CONTROL 131


LAB MANUAL
LAB EXPERIMENT - 12: THE TWO WAY TRAFFIC LIGHT PROJECT

TASK-1: LED PATTERNS USING ELVIS

A. PROCEDURE
Complete the following steps to build and manually test and control a two-way stoplight
intersection.

1. Install two each of red, yellow, and green LEDs on the NI ELVIS proto-board,
positioned as a two-way stoplight intersection. Each LED is controlled by one binary bit
on one of the 8-bit parallel ports on the proto-board. Use digital I/O bit sockets DO
<0...7>.
2. Connect the pin socket DO <0> to the anode of the red LED in the north-south
direction. Connect the other end of the LED through a 220 Ωresistor to digital ground.
Similarly,connect the anodes of remaining colored LEDs as per the following scheme see
table 12.1 on the prototyping board on ELVIS board.

Table 12.1: LEDs connection on digital outputs of ELVIS board.

CONNECTION ON ELVIS BOARD


LED NORTH SOUTH EAST WEST DIRECTION
DIRECTION
RED DO 0 DO 4
YELLOW DO 1 DO 5
GREEN DO 2 DO 6

3. From the NI ELVIS Instrument Launcher, select Digital Writer (DigOut). Using the
vertical slide switches, select any 8-bit pattern and output that pattern to the NI ELVIS
digital lines. After this perform the following steps:
a. Set the “Generation Mode” to “Run Continuous”.
b. Set the “Pattern” to “Manual”.
c. Click on the “Run” button to observe the behavior.

TASK-2: TIMING CONTROL AND BINARY PATTERN FOR


INTERSECTION

A. PROCEDURE
The basic operation of a traffic light is based on a 60-second time interval with 30 seconds
for red, followed by 25 seconds for green, followed by 5 seconds for yellow. For example, in
a two-way intersection, the yellow light in the North-South direction is on while the red light
in the East-West direction is on. This modifies the 30-second red timing interval to two
timing intervals: a 25-second cycle followed by a 5-second cycle. Hence there are four timing
periods (T1, T2, T3, and T4) for two-way stoplight intersection operation.
a. Time T1 the duration of which is 25 seconds
132 YANBU INDUSTRIAL COLLEGE
Educating Technologies
LAB MANUAL
LAB EXPERIMENT – 12: THE TWO WAY TRAFFIC LIGHT PROJECT

b. Time T2 the duration of which is 5 seconds


c. Time T3 the duration of which is 25 seconds
d. Time T4 the duration of which is 5 seconds
The table 12.2 shows the 3 bit LED pattern for north south and east west direction during the
various time intervals.

Table 12.2: 3 bit Pattern for East-West and North-South LEDs.

NORTH SOUTH DIRECTION LEDs EAST WEST DIRECTION LEDs


Time Red Yellow Green Decimal Red Yellow Green Decimal
T1 0 0 1 1 1 0 0 4
T2 0 1 0 2 1 0 0 4
T3 1 0 0 4 0 0 1 1
T4 1 0 0 4 0 1 0 2

By inserting a blank bit at the startup of each pattern an 8 bit code can be created. Write down
the decimal equivalent of the 8 bit pattern in the provided space.

Table 12.3: 8 bit pattern for North-South and East-West LEDs.

NORTH SOUTH DIRECTION EAST WEST DIRECTION LEDs


LEDs
Time Blank Red Yellow Green Blank Red Yellow Green Decimal
T1 0 0 0 1 0 1 0 0
T2 0 0 1 0 0 1 0 0
T3 0 1 0 0 0 0 0 1
T4 0 1 0 0 0 0 1 0

TASK-3: LABVIEW GUI OF THE LOGIC

A. PROCEDURE
1. Using LABVIEW develop the front panel shown in figure 12.1. The steps for which
are shown in the following:
a. In order to create the binary array, on the front panel place the array place holder
from array, matrix and cluster control palette.
b. From Boolean control take a round LED and place it inside the Array place
holder.
c. Now drag the array vertically from the bottom right till three copies of round LED
appear inside the array.
d. Rename the array as North South.
e. Repeat the above steps a) to d) and rename the new array as East West.
f. Include a stop button to control the execution.
2. The block diagram of the logic is shown in figure 12.2. The steps of development are
shown in the following:
EEET 435–DATA ACQUISITION AND CONTROL 133
LAB MANUAL
LAB EXPERIMENT - 12: THE TWO WAY TRAFFIC LIGHT PROJECT

a. Place a while loop from structure sub palette of the programming palette and
connect the stop button.
b. Place the For loop from and place bring the two arrays inside the loop.
c. From Boolean sub palette select the number to Boolean array function and make
its two copies. Each copy will be connected to the each array.
d. From the timing sub palette place the wait (ms) function.
e. Outside the For loop, create three arrays and insert the information as discussed in
task 2. (Timing pattern and Table 12.2)
f. Using figure 12.2 as reference, connect all components accordingly.
3. Execute the VI and observe the output on front panel.

Figure 12.2: Front panel of the solution. Figure 12.1: Block diagram of the logic.

TASK-4: INTERFACING WITH ELVIS BOARD

A. PROCEDURE
1. Using following scheme connect the LEDs’ anode to the following scheme:

Table 12.4: LEDs connection on Programmable Function I/Os of ELVIS board.

CONNECTION ON ELVIS BOARD


LED NORTH SOUTH EAST WEST DIRECTION
DIRECTION
RED PFI 1 PFI 6
YELLOW PFI 2 PFI 7
GREEN PFI 5 SCANCLK
134 YANBU INDUSTRIAL COLLEGE
Educating Technologies
LAB MANUAL
LAB EXPERIMENT – 12: THE TWO WAY TRAFFIC LIGHT PROJECT

2. In block diagram of figure 12.2 insert a DAQ assistant.

3. Configure it to generate digital output for 8 digital output lines. Note that lines must
be organized according to following pattern. Make sure that

Blank Red Yellow Green Blank Red Yellow Green

4. Create a new array outside the For loop and which contains decimal equivalent of the
8 bit pattern as discussed in table 12.3.

5. Set the “Representation” of this array as Byte (I8) by clicking the right button of the
mouse or pointing device.

6. To speed up the process the all time delays should be reduced by a factor of 10.

7. The final block diagram of the solution is shown in figure 12.3.

8. Execute the VI and observe the output on front panel and the LEDs mounted on the
ELVIS board.

Figure 12.3: Realization using DAQ assistant.

REVIEW QUESTIONS
Q1 Write a VI that generates patterns of fixed delays.
Q2 Write a VI that generates patterns of variable delays.

EEET 435–DATA ACQUISITION AND CONTROL 135


LAB MANUAL
LAB EXPERIMENT - 12: THE TWO WAY TRAFFIC LIGHT PROJECT

Q3 If you observe all LEDs have same color, change the program so that we have red,
yellow and green color in GUI as well.
Q4 What changes are required in the design of two way traffic light to make it
four way traffic light.

Q5 Draw the state machine of the two way traffic light controller.

FINAL CHECKLIST

1. Clean your equipment, materials, and work benches before you leave.
2. Return all equipment and materials to their proper storage area.
3. Submit your lab report before the next laboratory session.

136 YANBU INDUSTRIAL COLLEGE


Educating Technologies

You might also like