Raspberry Pi Traffic Light

This is the manual students enrolled in the week-long intermediate Raspberry Pi & Python class at the museum receive.  Before they take this class they must take an intro to the Pi (1 week) and a shorter introduction to using a port expander or transistor class (I’ll be uploading that manual soon.)

UPDATE: The December 2014  MagPi magazine will feature a shortened version of my project. During the process of review a  much improved Python code was suggested. That’s what will appear in the article.  For the full manual I’ve included the original code, because I think it is instructive, and the new and improved version.

Traffic_v3

 

7 thoughts on “Raspberry Pi Traffic Light”

  1. Could your latch be used for debouncing a switch ? it would seem to be a lot easier than writing code to debounce a switch that triggers an ISR. Obviously that wouldn’t work on a pin change interrupt.
    Thanks

    1. If you’re using an ISR in a safety-related application I suspect the only issue is one of timing; would the latch react fast enough? This could be an interesting experiment using a conventional relay (an ISR is probably more than the $5 I pay for relays) — all I need to do is come up with a project that requires it.

  2. Since I made this project I’ve upgraded it to use 4 boards, each with two rows of lights. Now they can be placed in an intersection-like layout. I also use an external power supply for the LEDs instead of powering them from the Pi. This does take up more ports on the Protect Your Pi board. I haven’t made a manual for it yet; it will become a project for another Pi class.

Leave a Reply

Your email address will not be published. Required fields are marked *