Computer Engineering Interfacing Activity
Computer Engineering Interfacing Activity
Interfacing Activity
The Traffic Light Project
ACSE
Nov 13 2004
Graham Smyth
Jerry Dolata
Computer Engineering Units
Grade 10/11/12
1. Hardware
2. Networking
3. Integrated Circuits
4. Programming
5. Interfaces
Interfacing System
Unit 5
Wires Wires
Introduction to Traffic Lights
Interfacing Activities
Interfacing Activities
Breadboard Connections
Connected
High
Fives
Low Divider
Fives
Connected
Parallelport
Input Output
I0 – I3 13 12 11 10 9 8 7 6 5 4 3 2 1
D0 – D7
25 24 23 22 21 20 19 18 17 16 15 14
Grounds Input I4
18 - 25
View from back of Computer
Traffic 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
parallelput(number)
Number D7 D6 D5 D4 D3 D2 D1 D0
parallelput(4) 0 0 0 0 0 1 0 0
parallelput(5) 0 0 0 0 0 1 0 1
parallelput(255) 1 1 1 1 1 1 1 1
Traffic Light Hardware
Wrap Yellow
Wire to Yellow
Light
Add White Wire
to EACH of the
THREE White Wrap Green Wire
Wires to Green Light
Wrap ALL Connections with Electrical Tape
Cable Construction
Male Pin Connections
White/Green
Green/White
Orange/White
White/Orange
Blue/White
change
White/Blue
D sub and Cable Colour Codes
Pin 2
D sub
Connector
Pin 18
D Sub Connector Wiring
White/Orange (Pin18)
Green/White (Pin4)
Blue/White (Pin3)
Orange/White (Pin2)
PN2222A Transistor
Emitter Collector
(Ground) (Remote)
Base
(Trigger)
Breadboard with Transistors
Black/White (+)
Transistors (3)
Flat Front
Black (-)
Transistors with Grounds
(left pin)
Jumper
3 Transistors Grounded
Breadboard to Lights
To Red Light To Green Light
To Yellow Light
Jumper
Cable to Transistors (middle pin)
To Pin 2 To Pin 18
To Pin 4
To Pin 3
Lights to Transistors
(right pin – ground)
Ground to Ground to Ground to
Red Light Yellow Light Green Light
The hardware is complete.
for counter : 1 .. 5
parallelput (4) % Green light on
delay (300)
parallelput (0) % Green light off
delay (300)
end for
Stop Light Question 3
(0,0)
Virtual 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)
Real 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)
Real and Virtual Traffic Lights
YELLOW
% Yellow light
parallelput (2)
drawfilloval (175, 315, 35, 35, red)
drawfilloval (175, 225, 35, 35, yellow)
drawfilloval (175, 135, 35, 35, green)
delay (2000)
Real and Virtual Traffic Lights
GREEN
% 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
Stop Light Question 4
To GFI
Check Specs 1 2
Solid State Relay
3 4
Pin 18 Pin 2
Real World Traffic Interface
To AC
To AC Light
Light
To Pin 2 To Pin 18
Addresses
www.classictechnology.ca
www.holtsoft.com