400 likes | 517 Views
Computer Engineering Activities Introduction to Interfacing Traffic Light Project SI 2003. Graham Smyth Yungsiow Yang Kevin Shea Jerry Dolata Ilana Smyth. Computer Engineering Units. Grade 10/11/12 1. Hardware 2. Networking 3. Integrated Circuits 4. Programming 5. Interfaces.
E N D
Computer Engineering ActivitiesIntroduction to InterfacingTraffic Light ProjectSI 2003 Graham Smyth Yungsiow Yang Kevin Shea Jerry Dolata Ilana Smyth
Computer Engineering Units Grade 10/11/12 1. Hardware 2. Networking 3. Integrated Circuits 4. Programming 5. Interfaces
Interfacing Activities • Grade 10 • One bit • Three LEDs • LED simulators • ASCII • Binary counting • Light patterns • Intersections • AC ??? • Grade 11 • One bit • One byte • DC motor • Bi-directional • LED traffic light • LED intersection • Demultiplexer • GUIs • Mouse control • AC??
Breadboard Connections Connected High Fives Divider Low Fives Connected
Parallelport 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 Grounds 18 - 25 Input I4 View from back of Computer
Interfacing System Unit 5 Computer Interface Peripheral • Parallelport • Resistors • LED's Wires Wires
Joystick Software Turing • parallelput(number) - reads 8 pins • put parallelget - reads 5 pins • mousewhere(x,y,click) • play(“CDEFG”) • drawline(x1,y1,x2,y2,red) • FREE!!!
Traffic Light Hardware • Four male pins • One D sub connector • Cable • Three 220 ohm resistors (red/red/brown) • Three LEDs • One Breadboard
220 ohm Resistor 2 2 X 101 Red Red Brown Gold Direction Resistor inserted IS NOT important
LED + = Edge - = No Edge + = Long Lead - = Short Lead Direction LED inserted IS important
D sub to Breadboard Male Pin Insulated Wire Small Crimp Tab Stripped Wire Large Crimp Tab
Traffic Light Hardware (Eight wire colour scheme) White/Orange White/Blue Orange White/Brown Blue change Brown Green White/Green
The D Sub Connector Pin 2 D sub Connector Pin 18
Stop Light Wiring White/Orange (Pin4) White/Brown (Pin3) Green (Pin18) White/Green (Pin2)
Traffic Light (hardware) GND Wire - + Pin 18 Pin 4 Pin 3 Pin 2
Traffic Light (hardware) Resistor to GND Align
Stop Light Question 1 Write a program that will output a traditional stop light pattern.
Stop Light Activation Answer 1 Version 1 parallelput (4) % Red light delay (500) parallelput (2) % Yellow light delay (500) parallelput (1) % Green light delay (500)
Stop Light Activation Answer 1 Version 2 for counter : 0 .. 2% three lights parallelput (2 ** counter) % clever expon. delay (500) end for % three lights
Adding Graphics Screen (640,400) (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 (4) drawfilloval (175, 315, 35, 35, brightred) drawfilloval (175, 225, 35, 35, 92) drawfilloval (175, 135, 35, 35, green) delay (2000)
Real 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)
Real and Virtual Traffic LightsGREEN % Green light parallelput (1) 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 2 Write a program that will output a traditional stop light pattern including an advanced green.
Stop Light Software Answer 2 Advanced Green Insert at appropriate place for counter : 1 .. 5 parallelput (1) % Green light on delay (300) parallelput (0) % Green lightoff delay (300) end for
Stop Light Question 3 Write a program that will add a second traffic light to simulate an intersection.
Stop Light Question 4 Write a program that will output a traditional stop light pattern to real world traffic lights.
Stop Light Software Answer 4 The software for DC LED traffic lights and the real world AC traffic lights is the same. The interface and the peripheral changes.
AC Schematic Red Traffic Light To GFI 1 2 Solid State Relay 3 4 Check Specs Pin 18 Pin 2
Real World Traffic Interface To AC Light To AC Light To Pin 2 To Pin 18
More Hands-On Activities • Keyboard • Intersection • Robot • World’s Largest Joystick
Addresses smythel@mnsi.net www.classictechnology.ca www.holtsoft.com