SlideShare a Scribd company logo
Traffic Light Final Project
By Ali El Moselhy,
Sandy Shan,
and Peter He
Table of Contents:
- Introduction
- What is a Circuit?
- What are Logic Gates?
- What are Binary Numbers?
- What is a Comparator?
- What is a Clock?
- What are Flip-Flops?
- Putting it all together…
Introduction
- Our task was to construct a traffic light simulator which operated in three
different modes:
- Blinking red and yellow
- Solid red
- Standard operation (green, yellow and red)
- Here is a picture of the final circuit:
- This is quite complicated!
- Let’s break it down step by step…
What is a Circuit?
- Circuits use a difference in voltage to extract work.
- Electricity moves from high to low voltages, and that movement allows us to do ‘things’
- A Light Emitting Diode (LED) glows when electricity runs through it.
- When referring to circuits:
- “HIGH” = “1” = “high potential” = “on”
- “LOW” = “0” = “low potential” = “off”
What are Logic Gates?
- Logic Gates are the foundation of all modern circuits.
- Logic Gates take in multiple inputs, and output a single HIGH or LOW signal.
- There are 7 main types of logic gates:
- Inverter
- AND
- OR
- XOR
- NAND
- NOR
- XNOR
- We used 4 of these gate types.
AND gates
- AND gates output HIGH if both inputs are HIGH. Otherwise, they output LOW:
A B X
0 0 0
0 1 0
1 0 0
1 1 1
OR gates
- OR gates output HIGH if any input is HIGH. Otherwise, they output LOW:
A B X
0 0 0
0 1 1
1 0 1
1 1 1
XOR gates
- XOR gates output a HIGH if ONLY ONE input is HIGH. Otherwise, they output
LOW:
A B X
0 0 0
0 1 1
1 0 1
1 1 0
NOR gates
- NOR gates negate the output of an OR gate. They output HIGH when all
inputs are 0. Otherwise, they output LOW:
A B X
0 0 1
0 1 0
1 0 0
1 1 0
Binary Numbers
- Binary numbers are numbers stored in a format that the computer can
understand:
- How can we differentiate between 0, 1, 2, … 8, 9? We can’t…
- We DO have values of either 0 or 1, so we can use a system of binary numbers.
- Each place value in a binary number represents a power of two:
1101 = 1 + 4 + 8 = 13
1st place
value: 1*20
3rd place
value: 1*22
4th place
value: 1*23
2nd place
value: 0*21
What is a comparator?
- Some quick recall:
- An XOR gate only activates when the inputs are different e.g. 1 and 0, or 0
and 1.
- Therefore, if an XOR gate outputs 0, we know the two inputs must be the
same, either both 0’s or 1’s.
- With a NOR gate, we can use this feature to compare two binary numbers:
What is a clock?
- A clock is a device that outputs a waveform:
- Oscillating from HIGH to LOW and back to HIGH.
- Clock circuit:
What are Flip-Flops?
- Flip-flops are devices which act as basic memory - they can store a single bit
each.
- Two main types (that we used):
- J-K flip-flops - used in our counter.
- D-flip flops - used for general memory.
- Both types of Flip-Flops activate on a signal edge:
D Flip-Flop:
Pin Function
D Input Pin
Clock Triggers change of Q (output)
S Set Pin, sets Q = 1
Q Output
R Reset Pin, sets Q = 0
JK Flip-Flop:
Pin Function
J, K Input Pins
Clock Triggers change of Q (output)
Q Output
R Reset Pin, sets Q=0
JK Flip-Flop Behavior
- The behavior of JK flip-flops is quite complicated:
- The most useful thing to us is the behavior when both J and K are one: the
chip toggles back and forth between 0 and 1.
Counters
- Think of counting in binary:
0, 1, 10, 11, 100, 101, 110, 111, 1000…
- We examine the 3rd digit.
- It only changes on the digits highlighted in blue, and each time before the change, the
preceding digits are 1 (highlighted in red)
- To be more precise, for any digit to change when counting in binary, all preceding digits need
to be 1’s.
- We can use this idea to build a counter which operates off of a clock.
Counters
- Here is a synchronous counter (clock signals are simultaneous between each
flip-flop):
- Each digit only changes (toggles) when every preceding digit is 1. (We read
left as the smallest digit, and right as the largest digit.)
- Connecting together the Reset inputs of each flip flop allows us to reset the
entire counter with a single input.
Chained D Flip-Flops
- We handle the ‘chosen’ states as follows:
- Initialize 3 chained D flip-flops in a 1-0-0 format, and connect a button to the
clock input of each:
This construction causes a HIGH signal to propagate through the flip flops each
time we hit the switch.
Streetlight Logic (First Two Cases)
- For the first case (solid red), we connect the output of the first D-flip flop (out
of the 3) to the two red lights.
- For the second case (blinking red and yellow), we used an AND gate to
connect the output of the second D flip-flop to the clock signal:
- Each time both the flip-flop signal is HIGH (the state is correct) and the clock is HIGH (creates
the blinking effect), the LEDs will glow.
Final Case Logic
- For the final case (standard street light operation), all our preceding work
comes in handy:
- We build another 4 chained D flip-flops, in order to track the ‘progress’ of the traffic light (states
1, 2, 3, 4).
- We build a counter and connect it to two different comparators, one for a small number, and
one for a large number.
- We use AND gates to selectively reset the counter depending on the state
and the comparator output.
- We connect the reset signal
to the counter of the 4 D flip-flops:
Some Hand Waving…
- We hand wave some more complex details (reset input and exact gates), but
at this point, we have 4 (internal) states which light up according to schedule.
- Therefore, we can connect whichever lights we want to the flip-flops and have
them light up according to schedule.
- Final Circuit:

More Related Content

What's hot

Water Level Indicator Project Presentation
Water Level Indicator Project PresentationWater Level Indicator Project Presentation
Water Level Indicator Project Presentation
Abdul Rehman
 
Bidirectional visitor counter
Bidirectional visitor counterBidirectional visitor counter
Bidirectional visitor counter
Zakir Gulzar
 
Clap switch
Clap switchClap switch
Traffic light controller
Traffic light controllerTraffic light controller
Traffic light controller
nimmi_abes
 
a project on automatic traffic control using IC 555
a project on automatic traffic control using IC 555a project on automatic traffic control using IC 555
a project on automatic traffic control using IC 555
jack990315
 
Distance Measurement by Ultrasonic Sensor
Distance Measurement by Ultrasonic SensorDistance Measurement by Ultrasonic Sensor
Distance Measurement by Ultrasonic Sensor
Edgefxkits & Solutions
 
Report (color 1,6,7,8,10)
Report (color 1,6,7,8,10)Report (color 1,6,7,8,10)
Report (color 1,6,7,8,10)
Vijendrasingh Rathor
 
Applications Of Clapping Switch
Applications Of Clapping SwitchApplications Of Clapping Switch
Applications Of Clapping Switch
souvikbiet
 
Log antilog amplifiers by ransher
Log antilog amplifiers by ransherLog antilog amplifiers by ransher
Log antilog amplifiers by ransher
ransherraj
 
Water level indicator
Water level indicator Water level indicator
Water level indicator
Saurabh Manchanda
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
Mannavapremkumar
 
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Abhishekvb
 
MOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATIONMOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATION
MOHAMMAD HANNAN
 
Transformer
TransformerTransformer
Transformer
Ayyarao T S L V
 
Project report of Cell phone detector circuit
Project report of Cell phone detector circuitProject report of Cell phone detector circuit
Project report of Cell phone detector circuit
Moin Aman
 
Clap switch
Clap switchClap switch
Clap switch
swiss2020
 
Mobile detector
Mobile detectorMobile detector
Ultrasonic based distance meter
Ultrasonic based distance meterUltrasonic based distance meter
Ultrasonic based distance meter
Uttej Kumar Palavai
 
LIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATELIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATE
abdullahkhalid50
 
Simple water level indicator1
Simple water level indicator1Simple water level indicator1
Simple water level indicator1
UdayKumar937
 

What's hot (20)

Water Level Indicator Project Presentation
Water Level Indicator Project PresentationWater Level Indicator Project Presentation
Water Level Indicator Project Presentation
 
Bidirectional visitor counter
Bidirectional visitor counterBidirectional visitor counter
Bidirectional visitor counter
 
Clap switch
Clap switchClap switch
Clap switch
 
Traffic light controller
Traffic light controllerTraffic light controller
Traffic light controller
 
a project on automatic traffic control using IC 555
a project on automatic traffic control using IC 555a project on automatic traffic control using IC 555
a project on automatic traffic control using IC 555
 
Distance Measurement by Ultrasonic Sensor
Distance Measurement by Ultrasonic SensorDistance Measurement by Ultrasonic Sensor
Distance Measurement by Ultrasonic Sensor
 
Report (color 1,6,7,8,10)
Report (color 1,6,7,8,10)Report (color 1,6,7,8,10)
Report (color 1,6,7,8,10)
 
Applications Of Clapping Switch
Applications Of Clapping SwitchApplications Of Clapping Switch
Applications Of Clapping Switch
 
Log antilog amplifiers by ransher
Log antilog amplifiers by ransherLog antilog amplifiers by ransher
Log antilog amplifiers by ransher
 
Water level indicator
Water level indicator Water level indicator
Water level indicator
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
 
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
A Report on Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
 
MOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATIONMOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATION
 
Transformer
TransformerTransformer
Transformer
 
Project report of Cell phone detector circuit
Project report of Cell phone detector circuitProject report of Cell phone detector circuit
Project report of Cell phone detector circuit
 
Clap switch
Clap switchClap switch
Clap switch
 
Mobile detector
Mobile detectorMobile detector
Mobile detector
 
Ultrasonic based distance meter
Ultrasonic based distance meterUltrasonic based distance meter
Ultrasonic based distance meter
 
LIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATELIGHT DETECTOR USING NAND GATE
LIGHT DETECTOR USING NAND GATE
 
Simple water level indicator1
Simple water level indicator1Simple water level indicator1
Simple water level indicator1
 

Similar to Traffic Light.pdf

Practica 4 algebra booleana por compuertas lógicas.
Practica 4 algebra booleana por compuertas lógicas.Practica 4 algebra booleana por compuertas lógicas.
Practica 4 algebra booleana por compuertas lógicas.
JavierDeJesusCamacho1
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
ragu nath
 
digita circuit design.pptx
digita circuit design.pptxdigita circuit design.pptx
digita circuit design.pptx
Godwin585235
 
assignment_mathematics.pptx
assignment_mathematics.pptxassignment_mathematics.pptx
assignment_mathematics.pptx
AravindaAKumar1
 
Bt0064 logic design1
Bt0064 logic design1Bt0064 logic design1
Bt0064 logic design1
Techglyphs
 
Digital Logic circuit
Digital Logic circuitDigital Logic circuit
Digital Logic circuit
kavitha muneeshwaran
 
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptxDigital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
UtsavDas21
 
Lecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptxLecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptx
WilliamJosephat1
 
Class 12th Logic Gates
Class 12th Logic GatesClass 12th Logic Gates
Class 12th Logic Gates
Priyanka Jakhar
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manual
Nitesh Dubey
 
Worksheet de 1.2
Worksheet de 1.2Worksheet de 1.2
Worksheet de 1.2
ManojB66
 
Logic gates
Logic gatesLogic gates
our 1st project
our 1st projectour 1st project
our 1st project
mohamed sarhan
 
Automation and Robotics 20ME51I_Week_2_Practicals.pdf
Automation and Robotics 20ME51I_Week_2_Practicals.pdfAutomation and Robotics 20ME51I_Week_2_Practicals.pdf
Automation and Robotics 20ME51I_Week_2_Practicals.pdf
Gandhibabu8
 
Integrated circuit
Integrated circuitIntegrated circuit
Integrated circuit
cooljunk
 
Deld lab manual
Deld lab manualDeld lab manual
Deld lab manual
Vivek Kumar Sinha
 
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdf
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdfBasic_Digital_Circuits_Implementation_using_Virtuoso.pdf
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdf
Ankita Tiwari
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015
Edhole.com
 
COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
SUBHA SHREE
 
COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
Sairam Adithya
 

Similar to Traffic Light.pdf (20)

Practica 4 algebra booleana por compuertas lógicas.
Practica 4 algebra booleana por compuertas lógicas.Practica 4 algebra booleana por compuertas lógicas.
Practica 4 algebra booleana por compuertas lógicas.
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
 
digita circuit design.pptx
digita circuit design.pptxdigita circuit design.pptx
digita circuit design.pptx
 
assignment_mathematics.pptx
assignment_mathematics.pptxassignment_mathematics.pptx
assignment_mathematics.pptx
 
Bt0064 logic design1
Bt0064 logic design1Bt0064 logic design1
Bt0064 logic design1
 
Digital Logic circuit
Digital Logic circuitDigital Logic circuit
Digital Logic circuit
 
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptxDigital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
Digital_Electronics_Module_4_Sequential_Circuits v0.6.pptx
 
Lecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptxLecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptx
 
Class 12th Logic Gates
Class 12th Logic GatesClass 12th Logic Gates
Class 12th Logic Gates
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manual
 
Worksheet de 1.2
Worksheet de 1.2Worksheet de 1.2
Worksheet de 1.2
 
Logic gates
Logic gatesLogic gates
Logic gates
 
our 1st project
our 1st projectour 1st project
our 1st project
 
Automation and Robotics 20ME51I_Week_2_Practicals.pdf
Automation and Robotics 20ME51I_Week_2_Practicals.pdfAutomation and Robotics 20ME51I_Week_2_Practicals.pdf
Automation and Robotics 20ME51I_Week_2_Practicals.pdf
 
Integrated circuit
Integrated circuitIntegrated circuit
Integrated circuit
 
Deld lab manual
Deld lab manualDeld lab manual
Deld lab manual
 
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdf
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdfBasic_Digital_Circuits_Implementation_using_Virtuoso.pdf
Basic_Digital_Circuits_Implementation_using_Virtuoso.pdf
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015
 
COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
 
COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
 

Recently uploaded

Basics of crystallography, crystal systems, classes and different forms
Basics of crystallography, crystal systems, classes and different formsBasics of crystallography, crystal systems, classes and different forms
Basics of crystallography, crystal systems, classes and different forms
MaheshaNanjegowda
 
The binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defectsThe binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defects
Sérgio Sacani
 
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
Travis Hills MN
 
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Leonel Morgado
 
HOW DO ORGANISMS REPRODUCE?reproduction part 1
HOW DO ORGANISMS REPRODUCE?reproduction part 1HOW DO ORGANISMS REPRODUCE?reproduction part 1
HOW DO ORGANISMS REPRODUCE?reproduction part 1
Shashank Shekhar Pandey
 
Pests of Storage_Identification_Dr.UPR.pdf
Pests of Storage_Identification_Dr.UPR.pdfPests of Storage_Identification_Dr.UPR.pdf
Pests of Storage_Identification_Dr.UPR.pdf
PirithiRaju
 
Farming systems analysis: what have we learnt?.pptx
Farming systems analysis: what have we learnt?.pptxFarming systems analysis: what have we learnt?.pptx
Farming systems analysis: what have we learnt?.pptx
Frédéric Baudron
 
The cost of acquiring information by natural selection
The cost of acquiring information by natural selectionThe cost of acquiring information by natural selection
The cost of acquiring information by natural selection
Carl Bergstrom
 
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdfMending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Selcen Ozturkcan
 
11.1 Role of physical biological in deterioration of grains.pdf
11.1 Role of physical biological in deterioration of grains.pdf11.1 Role of physical biological in deterioration of grains.pdf
11.1 Role of physical biological in deterioration of grains.pdf
PirithiRaju
 
Modelo de slide quimica para powerpoint
Modelo  de slide quimica para powerpointModelo  de slide quimica para powerpoint
Modelo de slide quimica para powerpoint
Karen593256
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
Leonel Morgado
 
The debris of the ‘last major merger’ is dynamically young
The debris of the ‘last major merger’ is dynamically youngThe debris of the ‘last major merger’ is dynamically young
The debris of the ‘last major merger’ is dynamically young
Sérgio Sacani
 
molar-distalization in orthodontics-seminar.pptx
molar-distalization in orthodontics-seminar.pptxmolar-distalization in orthodontics-seminar.pptx
molar-distalization in orthodontics-seminar.pptx
Anagha Prasad
 
AJAY KUMAR NIET GreNo Guava Project File.pdf
AJAY KUMAR NIET GreNo Guava Project File.pdfAJAY KUMAR NIET GreNo Guava Project File.pdf
AJAY KUMAR NIET GreNo Guava Project File.pdf
AJAY KUMAR
 
Gadgets for management of stored product pests_Dr.UPR.pdf
Gadgets for management of stored product pests_Dr.UPR.pdfGadgets for management of stored product pests_Dr.UPR.pdf
Gadgets for management of stored product pests_Dr.UPR.pdf
PirithiRaju
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
İsa Badur
 
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
PsychoTech Services
 
8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf
by6843629
 
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdfwaterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
LengamoLAppostilic
 

Recently uploaded (20)

Basics of crystallography, crystal systems, classes and different forms
Basics of crystallography, crystal systems, classes and different formsBasics of crystallography, crystal systems, classes and different forms
Basics of crystallography, crystal systems, classes and different forms
 
The binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defectsThe binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defects
 
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
Travis Hills of MN is Making Clean Water Accessible to All Through High Flux ...
 
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
 
HOW DO ORGANISMS REPRODUCE?reproduction part 1
HOW DO ORGANISMS REPRODUCE?reproduction part 1HOW DO ORGANISMS REPRODUCE?reproduction part 1
HOW DO ORGANISMS REPRODUCE?reproduction part 1
 
Pests of Storage_Identification_Dr.UPR.pdf
Pests of Storage_Identification_Dr.UPR.pdfPests of Storage_Identification_Dr.UPR.pdf
Pests of Storage_Identification_Dr.UPR.pdf
 
Farming systems analysis: what have we learnt?.pptx
Farming systems analysis: what have we learnt?.pptxFarming systems analysis: what have we learnt?.pptx
Farming systems analysis: what have we learnt?.pptx
 
The cost of acquiring information by natural selection
The cost of acquiring information by natural selectionThe cost of acquiring information by natural selection
The cost of acquiring information by natural selection
 
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdfMending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
 
11.1 Role of physical biological in deterioration of grains.pdf
11.1 Role of physical biological in deterioration of grains.pdf11.1 Role of physical biological in deterioration of grains.pdf
11.1 Role of physical biological in deterioration of grains.pdf
 
Modelo de slide quimica para powerpoint
Modelo  de slide quimica para powerpointModelo  de slide quimica para powerpoint
Modelo de slide quimica para powerpoint
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
 
The debris of the ‘last major merger’ is dynamically young
The debris of the ‘last major merger’ is dynamically youngThe debris of the ‘last major merger’ is dynamically young
The debris of the ‘last major merger’ is dynamically young
 
molar-distalization in orthodontics-seminar.pptx
molar-distalization in orthodontics-seminar.pptxmolar-distalization in orthodontics-seminar.pptx
molar-distalization in orthodontics-seminar.pptx
 
AJAY KUMAR NIET GreNo Guava Project File.pdf
AJAY KUMAR NIET GreNo Guava Project File.pdfAJAY KUMAR NIET GreNo Guava Project File.pdf
AJAY KUMAR NIET GreNo Guava Project File.pdf
 
Gadgets for management of stored product pests_Dr.UPR.pdf
Gadgets for management of stored product pests_Dr.UPR.pdfGadgets for management of stored product pests_Dr.UPR.pdf
Gadgets for management of stored product pests_Dr.UPR.pdf
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
 
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
 
8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf8.Isolation of pure cultures and preservation of cultures.pdf
8.Isolation of pure cultures and preservation of cultures.pdf
 
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdfwaterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
waterlessdyeingtechnolgyusing carbon dioxide chemicalspdf
 

Traffic Light.pdf

  • 1. Traffic Light Final Project By Ali El Moselhy, Sandy Shan, and Peter He
  • 2. Table of Contents: - Introduction - What is a Circuit? - What are Logic Gates? - What are Binary Numbers? - What is a Comparator? - What is a Clock? - What are Flip-Flops? - Putting it all together…
  • 3. Introduction - Our task was to construct a traffic light simulator which operated in three different modes: - Blinking red and yellow - Solid red - Standard operation (green, yellow and red) - Here is a picture of the final circuit: - This is quite complicated! - Let’s break it down step by step…
  • 4. What is a Circuit? - Circuits use a difference in voltage to extract work. - Electricity moves from high to low voltages, and that movement allows us to do ‘things’ - A Light Emitting Diode (LED) glows when electricity runs through it. - When referring to circuits: - “HIGH” = “1” = “high potential” = “on” - “LOW” = “0” = “low potential” = “off”
  • 5. What are Logic Gates? - Logic Gates are the foundation of all modern circuits. - Logic Gates take in multiple inputs, and output a single HIGH or LOW signal. - There are 7 main types of logic gates: - Inverter - AND - OR - XOR - NAND - NOR - XNOR - We used 4 of these gate types.
  • 6. AND gates - AND gates output HIGH if both inputs are HIGH. Otherwise, they output LOW: A B X 0 0 0 0 1 0 1 0 0 1 1 1
  • 7. OR gates - OR gates output HIGH if any input is HIGH. Otherwise, they output LOW: A B X 0 0 0 0 1 1 1 0 1 1 1 1
  • 8. XOR gates - XOR gates output a HIGH if ONLY ONE input is HIGH. Otherwise, they output LOW: A B X 0 0 0 0 1 1 1 0 1 1 1 0
  • 9. NOR gates - NOR gates negate the output of an OR gate. They output HIGH when all inputs are 0. Otherwise, they output LOW: A B X 0 0 1 0 1 0 1 0 0 1 1 0
  • 10. Binary Numbers - Binary numbers are numbers stored in a format that the computer can understand: - How can we differentiate between 0, 1, 2, … 8, 9? We can’t… - We DO have values of either 0 or 1, so we can use a system of binary numbers. - Each place value in a binary number represents a power of two: 1101 = 1 + 4 + 8 = 13 1st place value: 1*20 3rd place value: 1*22 4th place value: 1*23 2nd place value: 0*21
  • 11. What is a comparator? - Some quick recall: - An XOR gate only activates when the inputs are different e.g. 1 and 0, or 0 and 1. - Therefore, if an XOR gate outputs 0, we know the two inputs must be the same, either both 0’s or 1’s. - With a NOR gate, we can use this feature to compare two binary numbers:
  • 12. What is a clock? - A clock is a device that outputs a waveform: - Oscillating from HIGH to LOW and back to HIGH. - Clock circuit:
  • 13. What are Flip-Flops? - Flip-flops are devices which act as basic memory - they can store a single bit each. - Two main types (that we used): - J-K flip-flops - used in our counter. - D-flip flops - used for general memory. - Both types of Flip-Flops activate on a signal edge:
  • 14. D Flip-Flop: Pin Function D Input Pin Clock Triggers change of Q (output) S Set Pin, sets Q = 1 Q Output R Reset Pin, sets Q = 0
  • 15. JK Flip-Flop: Pin Function J, K Input Pins Clock Triggers change of Q (output) Q Output R Reset Pin, sets Q=0
  • 16. JK Flip-Flop Behavior - The behavior of JK flip-flops is quite complicated: - The most useful thing to us is the behavior when both J and K are one: the chip toggles back and forth between 0 and 1.
  • 17. Counters - Think of counting in binary: 0, 1, 10, 11, 100, 101, 110, 111, 1000… - We examine the 3rd digit. - It only changes on the digits highlighted in blue, and each time before the change, the preceding digits are 1 (highlighted in red) - To be more precise, for any digit to change when counting in binary, all preceding digits need to be 1’s. - We can use this idea to build a counter which operates off of a clock.
  • 18. Counters - Here is a synchronous counter (clock signals are simultaneous between each flip-flop): - Each digit only changes (toggles) when every preceding digit is 1. (We read left as the smallest digit, and right as the largest digit.) - Connecting together the Reset inputs of each flip flop allows us to reset the entire counter with a single input.
  • 19. Chained D Flip-Flops - We handle the ‘chosen’ states as follows: - Initialize 3 chained D flip-flops in a 1-0-0 format, and connect a button to the clock input of each: This construction causes a HIGH signal to propagate through the flip flops each time we hit the switch.
  • 20. Streetlight Logic (First Two Cases) - For the first case (solid red), we connect the output of the first D-flip flop (out of the 3) to the two red lights. - For the second case (blinking red and yellow), we used an AND gate to connect the output of the second D flip-flop to the clock signal: - Each time both the flip-flop signal is HIGH (the state is correct) and the clock is HIGH (creates the blinking effect), the LEDs will glow.
  • 21. Final Case Logic - For the final case (standard street light operation), all our preceding work comes in handy: - We build another 4 chained D flip-flops, in order to track the ‘progress’ of the traffic light (states 1, 2, 3, 4). - We build a counter and connect it to two different comparators, one for a small number, and one for a large number. - We use AND gates to selectively reset the counter depending on the state and the comparator output. - We connect the reset signal to the counter of the 4 D flip-flops:
  • 22. Some Hand Waving… - We hand wave some more complex details (reset input and exact gates), but at this point, we have 4 (internal) states which light up according to schedule. - Therefore, we can connect whichever lights we want to the flip-flops and have them light up according to schedule. - Final Circuit: