Close
0%
0%

Traffic Light

Tiny traffic light on a breadboard controllable with a button.

Similar projects worth following
404 views
0 followers
This project is a private project and the first non-guided, self-imagined of mine.

It has 3 LEDs (Red, Yellow, Green) on a breadboard connected to 3 different pins on a Raspberry Pi 2B. Furthermore the LEDs will be controllable with a button, running the standard traffic light sequence: R, RY, G, Y, R

Programming Language(s):

  • Python 3

trfc_light.py

Python 3 code to control the traffic light with a button.

x-python-script - 2.49 kB - 12/31/2015 at 01:17

Download

  • 1 × Raspberry Pi 2B As it comes out of the box
  • 3 × LEDs Red, Yellow and Green
  • 1 × Breadboard Whatever fits your needs
  • 3 × 220Ω resistors
  • 1 × Push-Button With a software pull_up resistance

  • Semi-finished

    Steven Roch12/31/2015 at 00:47 0 comments

    Finished version with a minor drawback


    I had to move the buttons control pin from Pin 2 to Pin 8 because the pins 2 & 3 have a built-in pull resistance which I didn't know by the time I was making the projects layout.

    The Python code as it is in its current state, checks the status of the button every 0.5s.

    This is just an emergency solution because in the initial state of the code, the button was checked several hundred times a second (no sleep-function) which led to an issue where you press the button and the status variable changes its state to fast and therefore you ended up with weird signals.

View project log

  • 1
    Step 1

    Connect any GND pin to an empty minus-Rail on your breadboard

    I prefer to use pin 39 on my RPi2B to have more structure

  • 2
    Step 2

    Connect your LEDs

    1. Red LED with a 220Ω-resistor on Pin15 (use a red m-f-wire), connect to GND-to-minus-Rail
    2. Yellow LED with a 220Ω-resistor on Pin13 (use a yellow m-f-wire), connect to GND-to-minus-Rail
    3. Green LED with a 220Ω-resistor on Pin11 (use a green m-f-wire), connect to GND-to-minus-Rail
  • 3
    Step 3

    Connect your Button

    1. Use a white m-f-wire and connect one side of the button to Pin8 on your Pi
    2. Connect the other side with a black m-m-jumper to the GND-to-minus-Rail

View all 3 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates