SlideShare a Scribd company logo
1 of 22
Download to read offline
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

Over view of Laplace Transform and its Properties
Over view of Laplace Transform and its Properties Over view of Laplace Transform and its Properties
Over view of Laplace Transform and its Properties Neel Shah
 
Bidirectional visitor counter
Bidirectional visitor counterBidirectional visitor counter
Bidirectional visitor counterZakir Gulzar
 
Frequency response analysis I
Frequency response analysis IFrequency response analysis I
Frequency response analysis IMrunal Deshkar
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & DecoderSyed Saeed
 
multirate signal processing for speech
multirate signal processing for speechmultirate signal processing for speech
multirate signal processing for speechRudra Prasad Maiti
 
Design of Buck Converter
Design of Buck ConverterDesign of Buck Converter
Design of Buck ConverterAkhil Syamalan
 
DAC-digital to analog converter
DAC-digital to analog converterDAC-digital to analog converter
DAC-digital to analog converterShazid Reaj
 
120 & 180 degree Conduction Mode of Inverter.pptx
120 & 180 degree Conduction Mode of Inverter.pptx120 & 180 degree Conduction Mode of Inverter.pptx
120 & 180 degree Conduction Mode of Inverter.pptxsenthil ilangovan
 
Modern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of SystemsModern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of SystemsAmr E. Mohamed
 
4 Way traffic controll new
4 Way traffic controll new4 Way traffic controll new
4 Way traffic controll newMainak Nandi
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoderAbid Ali
 
Automatic street light using ldr and relay
Automatic street light using ldr and relayAutomatic street light using ldr and relay
Automatic street light using ldr and relayShivam Raidas
 
Voltage Doubler using NE 555 timer IC
Voltage Doubler using NE 555 timer IC Voltage Doubler using NE 555 timer IC
Voltage Doubler using NE 555 timer IC Partha P. Mishra
 
Making Of 0-9 Decade Counter with 7 segment display
Making Of 0-9 Decade Counter with 7 segment displayMaking Of 0-9 Decade Counter with 7 segment display
Making Of 0-9 Decade Counter with 7 segment displayOmkar Rane
 

What's hot (20)

Over view of Laplace Transform and its Properties
Over view of Laplace Transform and its Properties Over view of Laplace Transform and its Properties
Over view of Laplace Transform and its Properties
 
Bidirectional visitor counter
Bidirectional visitor counterBidirectional visitor counter
Bidirectional visitor counter
 
Frequency response analysis I
Frequency response analysis IFrequency response analysis I
Frequency response analysis I
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & Decoder
 
multirate signal processing for speech
multirate signal processing for speechmultirate signal processing for speech
multirate signal processing for speech
 
Buffer op amplifier
Buffer op amplifierBuffer op amplifier
Buffer op amplifier
 
Design of Buck Converter
Design of Buck ConverterDesign of Buck Converter
Design of Buck Converter
 
DAC-digital to analog converter
DAC-digital to analog converterDAC-digital to analog converter
DAC-digital to analog converter
 
Mosfet
MosfetMosfet
Mosfet
 
120 & 180 degree Conduction Mode of Inverter.pptx
120 & 180 degree Conduction Mode of Inverter.pptx120 & 180 degree Conduction Mode of Inverter.pptx
120 & 180 degree Conduction Mode of Inverter.pptx
 
08 decoder
08 decoder08 decoder
08 decoder
 
BCD ADDER
BCD ADDER BCD ADDER
BCD ADDER
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Modern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of SystemsModern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of Systems
 
4 Way traffic controll new
4 Way traffic controll new4 Way traffic controll new
4 Way traffic controll new
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Automatic street light using ldr and relay
Automatic street light using ldr and relayAutomatic street light using ldr and relay
Automatic street light using ldr and relay
 
Voltage Doubler using NE 555 timer IC
Voltage Doubler using NE 555 timer IC Voltage Doubler using NE 555 timer IC
Voltage Doubler using NE 555 timer IC
 
Control chap4
Control chap4Control chap4
Control chap4
 
Making Of 0-9 Decade Counter with 7 segment display
Making Of 0-9 Decade Counter with 7 segment displayMaking Of 0-9 Decade Counter with 7 segment display
Making Of 0-9 Decade Counter with 7 segment display
 

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
 
digita circuit design.pptx
digita circuit design.pptxdigita circuit design.pptx
digita circuit design.pptxGodwin585235
 
assignment_mathematics.pptx
assignment_mathematics.pptxassignment_mathematics.pptx
assignment_mathematics.pptxAravindaAKumar1
 
Bt0064 logic design1
Bt0064 logic design1Bt0064 logic design1
Bt0064 logic design1Techglyphs
 
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.pptxUtsavDas21
 
Lecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptxLecture 04-Digital logic gates.pptx
Lecture 04-Digital logic gates.pptxWilliamJosephat1
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manualNitesh Dubey
 
Worksheet de 1.2
Worksheet de 1.2Worksheet de 1.2
Worksheet de 1.2ManojB66
 
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.pdfGandhibabu8
 
Integrated circuit
Integrated circuitIntegrated circuit
Integrated circuitcooljunk
 
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.pdfAnkita Tiwari
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015Edhole.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

Heads-Up Multitasker: CHI 2024 Presentation.pdf
Heads-Up Multitasker: CHI 2024 Presentation.pdfHeads-Up Multitasker: CHI 2024 Presentation.pdf
Heads-Up Multitasker: CHI 2024 Presentation.pdfbyp19971001
 
Fun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfFun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfhoangquan21999
 
Taphonomy and Quality of the Fossil Record
Taphonomy and Quality of the  Fossil RecordTaphonomy and Quality of the  Fossil Record
Taphonomy and Quality of the Fossil RecordSangram Sahoo
 
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Ansari Aashif Raza Mohd Imtiyaz
 
VILLAGE ATTACHMENT For rural agriculture PPT.pptx
VILLAGE ATTACHMENT For rural agriculture  PPT.pptxVILLAGE ATTACHMENT For rural agriculture  PPT.pptx
VILLAGE ATTACHMENT For rural agriculture PPT.pptxAQIBRASOOL4
 
Film Coated Tablet and Film Coating raw materials.pdf
Film Coated Tablet and Film Coating raw materials.pdfFilm Coated Tablet and Film Coating raw materials.pdf
Film Coated Tablet and Film Coating raw materials.pdfPharmatech-rx
 
NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.syedmuneemqadri
 
EU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdfEU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdfStart Project
 
ANATOMY OF DICOT AND MONOCOT LEAVES.pptx
ANATOMY OF DICOT AND MONOCOT LEAVES.pptxANATOMY OF DICOT AND MONOCOT LEAVES.pptx
ANATOMY OF DICOT AND MONOCOT LEAVES.pptxRASHMI M G
 
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...dkNET
 
Introduction and significance of Symbiotic algae
Introduction and significance of  Symbiotic algaeIntroduction and significance of  Symbiotic algae
Introduction and significance of Symbiotic algaekushbuR
 
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptxNanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptxssusera4ec7b
 
Warming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptxWarming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptxGlendelCaroz
 
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonVital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoonintarciacompanies
 
Classification of Kerogen, Perspective on palynofacies in depositional envi...
Classification of Kerogen,  Perspective on palynofacies in depositional  envi...Classification of Kerogen,  Perspective on palynofacies in depositional  envi...
Classification of Kerogen, Perspective on palynofacies in depositional envi...Sangram Sahoo
 
Efficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence accelerationEfficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence accelerationSérgio Sacani
 
Factor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandFactor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandRcvets
 
Polyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptxPolyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptxMuhammadRazzaq31
 

Recently uploaded (20)

Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
Chemistry Data Delivery from the US-EPA Center for Computational Toxicology a...
 
Heads-Up Multitasker: CHI 2024 Presentation.pdf
Heads-Up Multitasker: CHI 2024 Presentation.pdfHeads-Up Multitasker: CHI 2024 Presentation.pdf
Heads-Up Multitasker: CHI 2024 Presentation.pdf
 
Fun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdfFun for mover student's book- English book for teaching.pdf
Fun for mover student's book- English book for teaching.pdf
 
Taphonomy and Quality of the Fossil Record
Taphonomy and Quality of the  Fossil RecordTaphonomy and Quality of the  Fossil Record
Taphonomy and Quality of the Fossil Record
 
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
Molecular and Cellular Mechanism of Action of Hormones such as Growth Hormone...
 
VILLAGE ATTACHMENT For rural agriculture PPT.pptx
VILLAGE ATTACHMENT For rural agriculture  PPT.pptxVILLAGE ATTACHMENT For rural agriculture  PPT.pptx
VILLAGE ATTACHMENT For rural agriculture PPT.pptx
 
Film Coated Tablet and Film Coating raw materials.pdf
Film Coated Tablet and Film Coating raw materials.pdfFilm Coated Tablet and Film Coating raw materials.pdf
Film Coated Tablet and Film Coating raw materials.pdf
 
NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.
 
EU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdfEU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdf
 
ANATOMY OF DICOT AND MONOCOT LEAVES.pptx
ANATOMY OF DICOT AND MONOCOT LEAVES.pptxANATOMY OF DICOT AND MONOCOT LEAVES.pptx
ANATOMY OF DICOT AND MONOCOT LEAVES.pptx
 
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...
dkNET Webinar: The 4DN Data Portal - Data, Resources and Tools to Help Elucid...
 
Introduction and significance of Symbiotic algae
Introduction and significance of  Symbiotic algaeIntroduction and significance of  Symbiotic algae
Introduction and significance of Symbiotic algae
 
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptxNanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
 
Warming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptxWarming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptx
 
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonVital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
 
Classification of Kerogen, Perspective on palynofacies in depositional envi...
Classification of Kerogen,  Perspective on palynofacies in depositional  envi...Classification of Kerogen,  Perspective on palynofacies in depositional  envi...
Classification of Kerogen, Perspective on palynofacies in depositional envi...
 
HIV AND INFULENZA VIRUS PPT HIV PPT INFULENZA VIRUS PPT
HIV AND INFULENZA VIRUS PPT HIV PPT  INFULENZA VIRUS PPTHIV AND INFULENZA VIRUS PPT HIV PPT  INFULENZA VIRUS PPT
HIV AND INFULENZA VIRUS PPT HIV PPT INFULENZA VIRUS PPT
 
Efficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence accelerationEfficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence acceleration
 
Factor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandFactor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary Gland
 
Polyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptxPolyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptx
 

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: