Title: Computer Engineering Interfacing Activity The Traffic Light Project ACSE Nov 13 2004
1Computer Engineering Interfacing ActivityThe
Traffic Light ProjectACSE Nov 13 2004
- Graham Smyth
- Jerry Dolata
2Computer Engineering Units
- Grade 10/11/12
- 1. Hardware
- 2. Networking
- 3. Integrated Circuits
- 4. Programming
- 5. Interfaces
3Interfacing System Unit 5
Computer Interface Peripheral
- Resistors
- Relays
- Power Supply
- Breadboard
- etc
- LED's
- or Sealed Beams
- or Real World
Wires
Wires
4Introduction to Traffic Lights
5Interfacing Activities
6Interfacing Activities
7Breadboard Connections
Connected
High Fives
Divider
Low Fives
Connected
8Parallelport
Input I0 I3
Output D0 D7
13 12 11 10 9 8 7 6
5 4 3 2 1
25 24 23 22 21 20 19 18 17
16 15 14
Input I4
Grounds 18 - 25
View from back of Computer
9Traffic Light Software
Turing
- parallelput(number) - reads 8 pins
- put parallelget - reads 5 pins
- mousewhere(x,y,click)
- play(CDEFG)
- drawline(x1,y1,x2,y2,red)
- Provincially Licenced
10parallelput(number)
11Traffic Light Hardware
- Four male pins
- One D sub connector
- Cable
- Breadboard
- 3 sealed beams
- 3 pig tails
- 3 mounting Brackets
- 3 PN2222A transistors
- 1 2x4x9 (base)
- 1 1x2x9 (backing)
- 1 5/8x12 dowel
- Screws
- 2 clamps for dowel
- 12VDC Power Supply
- extra wire
12Stop Light Brackets
1x4 Mounting Board
Align Brackets
Evenly Space
Two Screws
13Rat Tail
Snap Rat Tail into Light
14Rat Tail and Lights
Insert Rat Tail into Hole
Shorter End of Board
Then Rotate Light ΒΌ turn Clockwise to
Tighten Repeat for All 3 Lights
15 Stop Light Wiring
Wrap Red Wire to Red Light
Wrap Yellow Wire to Yellow Light
Add White Wire to EACH of the THREE White Wires
Wrap Green Wire to Green Light
Wrap ALL Connections with Electrical Tape
16Cable ConstructionMale Pin Connections
Male Pin
Insulated Wire
Small Crimp Tab
Stripped Wire
Large Crimp Tab
17Cable With Male Pins (3 pair colour scheme)
White/Green
Green/White
Orange/White
White/Orange
Blue/White
change
White/Blue
18D sub and Cable Colour Codes
19The D Sub Connector(with extraction wire)
20The D Sub Connector
Pin 2
D sub Connector
Pin 18
21D Sub Connector Wiring
White/Orange (Pin18)
Green/White (Pin4)
Blue/White (Pin3)
Orange/White (Pin2)
22PN2222A Transistor
Flat Side Front
Emitter (Ground)
Collector (Remote)
Base (Trigger)
23Breadboard with Transistors
Black/White ()
Transistors (3) Flat Front
Black (-)
24Transistors with Grounds(left pin)
Jumper
3 Transistors Grounded
25Breadboard to Lights
To Green Light
To Red Light
To Yellow Light
Jumper
26Cable to Transistors (middle pin)
To Pin 18
To Pin 2
To Pin 4
To Pin 3
27Lights to Transistors (right pin ground)
Ground to Yellow Light
Ground to Green Light
Ground to Red Light
28The hardware is complete. Now to the software
29Stop Light Question 1
- Write a program that will output a traditional
stop light pattern.
30Stop Light Activation Answer 1 Version 1
- parallelput (1) Red light
- delay (500)
- parallelput (2) Yellow light
- delay (500)
- parallelput (4) Green light
- delay (500)
31Stop Light Activation Answer 1 Version 2
- for counter 0 .. 2 three lights
- parallelput (2 counter) clever expon.
- delay (500)
- end for three lights
32Stop Light Question 2
- Write a program that will output a traditional
stop light pattern including an advanced green.
33Stop Light Software Answer 2 Advanced Green
- Insert at appropriate place
- for counter 1 .. 5
- parallelput (4) Green light on
- delay (300)
- parallelput (0) Green light off
- delay (300)
- end for
34Stop Light Question 3
- Write a program that will add a virtual stop
light that will activate with the real world
light.
35Adding Graphics Screen
(640,400)
(0,0)
36Virtual Traffic Lights
- Outline of traffic box
- drawfillbox (100, 60, 250, 370, gray)
- Red light
- drawfilloval (175, 315, 35, 35, red)
- Yellow light
- drawfilloval (175, 225, 35, 35, 92)
- Green light
- drawfilloval (175, 135, 35, 35, green)
37Real and Virtual Traffic Lights RED
delay (2000) loop Red light parallelput
(1) drawfilloval (175, 315, 35, 35,
brightred) drawfilloval (175, 225, 35, 35,
92) drawfilloval (175, 135, 35, 35, green)
delay (2000)
38Real and Virtual Traffic LightsYELLOW
- Yellow light
- parallelput (2)
- drawfilloval (175, 315, 35, 35, red)
- drawfilloval (175, 225, 35, 35, yellow)
- drawfilloval (175, 135, 35, 35, green)
- delay (2000)
39Real and Virtual Traffic LightsGREEN
- Green light
- parallelput (4)
- drawfilloval (175, 315, 35, 35, red)
- drawfilloval (175, 225, 35, 35, 92)
- drawfilloval (175, 135, 35, 35, brightgreen)
- delay (2000)
- end loop
40Stop Light Question 4
- Write a program that will continuously flash all
lights to indicate a power outage.
41Stop Light Question 5
- Write a program that will add a second traffic
light to simulate an intersection.
42Stop Light Question 6
- Write a program that will output a traditional
stop light pattern to real world traffic lights.
43Stop Light Software Answer 6
- The software for DC LED traffic lights
- and the real world AC traffic lights is
- the same.
- The interface and the peripheral changes.
44AC Schematic
Red Traffic Light
To GFI
1 2 Solid State Relay
3 4
Check Specs
Pin 18
Pin 2
45Real World Traffic Interface
To AC Light
To AC Light
To Pin 18
To Pin 2
46Addresses
smythel_at_mnsi.net www.classictechnology.ca www.ho
ltsoft.com