Xtreme STEM
DashX

RoboBloX

Mintguy (en-Wiki) und Archenzo (it-Wiki) - Das Original (mit Linksverkehr) stammt von Mintguy (en-Wiki) und wurde durch Archenzo (it-Wiki) für Verhältnisse mit Rechtsverkehr adaptiert.TrafficBlock

Traffic Light

 

Theory

The TrafficBlock holds three LEDs: Red, Yellow, and Green.
Each LED has two legs (wires). This means we would need 2x3=6 wires to connect all three LEDs.
However, by sharing a “common” connection, we can reduce the number of wires by sharing the positive or negative side.  This is called common-anode or common-cathode.

LED

Common Cathode Common Anode

Schematic

Assembly

  1. Required Materials
    • 2x4 Block
    • 3 LEDs 5mm (Red, Yellow, Green)
    • 100 Ohm resistor
    • Cable (4 wires)
  2. Drill 3 Holes in the 2x4 block for the LEDs
  3. Insert the LEDs
    Make sure Red is at the Top
    Make sure the short legs (- Cathodes) are all on the right
    Make sure the long legs (+ Anodes) are all on the left
  4. Bend the Red and Yellow short legs (- Cathodes) downward
    (toward the green LED)
  5. Bend all the long legs (+ Anodes) toward the left side
  6. Make a hook shape in one end of the resistor
  7. Hook the resistor to the cathodes (-)
    between the Yellow and Green LEDs
  8. Position the resistor directly between the legs of the green LED
  9. Cut the black connectors off ONE END only of your cable
  10. Cut your wires to the right lengths to nicely reach each LED
  11. Strip 1mm off each wire
  12. Stop
    Check with Mr. Dash before continuing
  13. Solder the 3 cathodes (-) and resistor together
  14. Solder one wire to each Anode (+)
    Solder one wire to the bottom of the resistor
  15. Mark your wires with the right color for each LED
    and silver for common ground (G)
  16. Test your block
  17. Hot glue your block

Connection Diagram

You can connect the LEDs to any digital pins.
Connect the common (cathode) to any Ground (G) pin

Backwards connections will not hurt the LEDs.

 

 

mBlock

Hints

Use the set digital pin block to turn the LEDs on and off.
Make sure the pin numbers match the pins you have connected the LEDs to

We have designed this circuit for only 1 LED to be on at a time -
more than one LED at a time will not work very well (but won't hurt anything).

bb

 

Challenge Program

Can you make the traffic lights work correctly?

Traffic
Click the picture to download the challenge program: Traffic

Level 1

Make one set of lights on the screen change everytime you click the spacebar

Level 2

Make your LEDs work with the lights on the screen

Level 3

Make the lights change automatically (every 5 seconds or so)

Level 4

Make the second set of lights on the screen also work

Level 5

Work with someone else to make two sets of LEDs work with all the lights on the screen

Level 6

Add safety - do your lights give cars enough time to stop?
What if someone runs the yellow light? (Is the other light still red?)
What if someone runs the red light? (Both lights should be red at the same time for about 1 second)

Bonus

Use your LineBlock to detect a car waiting at the light and change the light to green (as quickly as is safe)

Scroll to Top