I recently repaired the traffic and walk signals at BBCM . The system had been running on a PLC ( Programmable Logic Controller ) which failed, and rather than find the proprietary programming cable and find and install the PLC Windows software, I decided to just put an Arduino and relay control board in place.
I had a Teensy++ 2.0 I had pulled from another exhibit during an upgrade, and an 8 channel relay board on hand. These relay boards come in different configurations from 1, 2, 4, 8, and even 16 relays. Since I really only needed 5 relays (and 5 pins) I could have used an ATtiny85, but I had the Teensy++ 2.0 readily available. The wiring is all done using female to female jumper wires .
I mounted everything to a piece of scrap MDF and added mounting holes to that, with the idea that we’d screw the whole thing directly into the wall. The relay board has mounting holes, but the Teensy does not. That’s probably my one complaint about the Teensy boards, is that mounting them isn’t always easy. MyTeensy BOB has mounting holes, but for mounting this Teensy++ 2.0 I just used some 3M™ VHB™ tape . (The “VHB” stands for “Very High Bond”). And yes, there are a few 3D printed parts on there. At some point I should make a 3D printed holder/mount for a Teensy++ 2.0
I try to label things clearly. If I look at this thing in 6 months, or 2 years, or someone else has to look at it, I want it to be somewhat apparent what is what, so there’s not a lot of guesswork as to what is going on. I included a label with the name of the Arduino sketch, and I always like to label power supplies. Sometimes we use 5 volts, and sometimes 12 volts, and they typically have tiny hard to read type printed on the side of the power supply that you can’t see when it’s plugged in.
The one thing I should start to add to the labels is the URL ofthe wiki page where the thing is documented. (Next time I’ll do this.)
Here’s the controller mounted. It’s not pretty. We ended up re-using the mount that the PLC was in, rather than screwing it right into the wall. In my defense, we did this repair on the floor during open hours, and it’s mounted high on a wall behind a TV. Does it work? Yes… Is it awesome, no… but again, it totally works.
The wiring for the lights was all 12 VDC, not 110 VAC, so those thin gauge wires are fine. Also, they were labeled, which was handy. (Thanks previous person who worked on this and labeled things!)
I try to create wiring diagrams for everything. I use Fritzing because it’s simple and awesome and open and free. I often don’t find the components I need, but you can always just use a note and some text.
Here’s the script/sequence for the lights:
- Green Light is ON
- Walk Light is ON
- Waiting 4 seconds…
- Walk Light is OFF
- Don’t Walk Light is BLINKING (for 5 seconds)
- Green Light is OFF
- Don’t Walk Light is ON
- Yellow Light is ON
- Waiting 4 seconds…
- Yellow Light is OFF
- Red Light is ON
- Waiting 6 seconds…
- Red Light is OFF
- Don’t Walk Light is OFF
- (Repeat sequence)
I wrote this up to figure out how to program things. I find it helpful to plan things out before I start writing the code.
At first I just talked through the light sequence with someone and we made some assumptions about how it worked. We were slightly wrong, which I discovered when I dug a bit deeper into traffic lights and walk signals. I read at least some of the (very long) Wikipedia page on Traffic Lights . I also hunted for other info, and found some on the Signals FAQ page on the Minnesota Department of Transportation web site. (As I mentioned with the911 Phone I really do aim for an accurate and realistic experience with these things.)
It’s been a few weeks and the lights have been working fine. Hopefully that will continue to be the case. If something does stop working we’ll open a ticket for it so we have a record. And yes, we do use an issue tracker for our museum exhibits… doesn’t everyone?