Anyone with even a passing familiarity with the classic animated shorts of the 1940s will recognize the traffic signal in the image above. Yes, such things actually existed in the real world, not just in the Looney world of [Bugs Bunny] et al. As sturdy as such devices were, they don’t last forever, though, which is why a restoration of this classic Acme traffic signal was necessary for a California museum. Yes, that Acme.
When you see a traffic signal from the early days of the automotive age like this one, it becomes quickly apparent how good the modern equivalent has become. Back in the day, with a mix of lights distributed all over the body of the signal, arms that extend out, and bells that ring when the state changes, it’s easy to see how things could get out of hand at an intersection. That complexity made the restoration project by [am1034481] and colleagues at the Southern California Traffic Museum all the more difficult. Each signal has three lights, a motor for the flag, and an annunciator bell, each requiring a relay. What’s more, the motor needs to run in both directions, so a reversing relay is needed, and the arm has a mechanism to keep it in position when motor power is removed, which needs yet another relay. With two signals, everything was doubled, so the new controller used a 16-channel relay board and a Raspberry Pi to run through various demos. To keep induced currents from wreaking havoc, zero-crossing solid state relays were used on the big AC motors and coils in the signal. It looks like a lot of work, but the end results are worth it.
When working on software development in a team environment, it’s important to know the status of your build at all times. Jenkins can display build automation info on a screen but where’s the fun in that? A popular office project is to build some kind of visual display of a project’s status, and [dkt01] has done just that with this stack light build monitor.
In this day and age of online shopping, random bits of industrial hardware are just an eBay away, so it’s easy to find some cool lamps or indicators for any project. [dkt01] sourced a standard 24V stack light off the shelf. With its green, red, and yellow indicators, its perfect for showing the current status of their build server.
The project uses an Arduino Pro Micro combined with an ENC28J60 Ethernet adapter. We used to see that chip all the time but in 2017 it’s somewhat of a classic setup with the great unwashed masses largely migrating to the ESP8266. However, for the purposes of this project, it was perfect for connecting to the wired office network (after all, you want to know the status of your build and not of your WiFi). [dkt01] even managed to get a web configuration to work despite the relatively meager resources of the ATmega32u4.
The build is cleanly executed, with the microcontroller and Ethernet hardware tucked into a 3D printed base for the stack light’s enclosure. It’s far more likely to become a permanent office fixture if it’s a tidy build without wires hanging out everywhere so a custom PCB ties everything together neatly. In another nice touch, the stack lights flash on initialization to indicate if the DHCP lease was successful, which makes troubleshooting easier. There’s an overview of all different light combinations and meanings in the video after the break.
In a bout of frustration I recently realized that the roads have all updated — most people have no idea how — and this sometimes hurts the flow of traffic. This realization happened when an unfortunate person stopped in a left turn lane well before the stop line. The vehicle didn’t trigger the sensor, so cycle after cycle went by and the traffic system never gave the left turn lane a green light, thinking the lane was unoccupied. Had the driver known about this the world would have been a better place. The first step in intelligent automation is sensing, and there are a variety of methods used to sense traffic’s flow.
Traffic lights are so ubiquitous that we hardly give them a second thought, except to curse their existence when they impede us on our daily drive. But no matter how much it seems like traffic lights have the ability to read our minds and tell when we’re running late, they’re really not much more than a set of lights and a programmable controller. Simple in practice, but as usual, the devil is in the details, and for a system that needs to work as close to 100% of the time as possible, the details are important. Let’s explore the inner workings of traffic signals.
The traffic lights and crosswalk signals at an intersection are only the public user interface, of course. The interesting stuff is going on in the control box. There’s at least one at every intersection, usually a plain metal cabinet set back from the road, sometimes camouflaged with public bills or graffiti. But inside are the guts of what makes an intersection work and keeps vehicle and foot traffic moving smoothly and safely.
Unsurprisingly, most traffic signal controls started out as purely electromechanical devices. Cabinets were chock full of synchronous motors turning timing wheels with cams to cycle the intersection’s lights through the proper sequence. One old time controller that was common up until recently was made by Econolite, and the insides are a paragon of sturdy design.
Today on Hackaday Dictionary, we’re going to talk about the two basic types of control systems: open-loop and closed-loop. We’ll describe the differences between them and explore the various advantages and disadvantages of each. And finally, we’ll talk about what happens when you try to draw a line between the two.
Control systems are literally all around us. They’re illuminating our rooms, laundering our unmentionables, and conspiring to make us late for work. Most of us probably use or interact with at least five control systems before we’re even out the door in the morning. Odds are you’re using a control system to read this article.
When we say ‘control system’, we’re speaking broadly. A control system is defined as any system that exhibits control over a function. It doesn’t matter how big or small the function is. A standard light switch is a simple type of control system. Flip it back and forth and the light is either on or off with no in between. Too bright? Too bad. There is no way to account for light intensity preference, use duration, energy output, or anything else.
Another common example in discussing control system theory is the clothing dryer. Set the timer on the dryer and it will run until time expires. Will it run long enough to dry everything without shrinking anything? The only way to know is to open the door and check.
Both the light switch and the clothes dryer are open-loop systems. The process is a straight line from start to finish, and they operate without concern for their output. Once the light switch is flipped to the on position, current will flow until the switch is reversed. The switch doesn’t know if the bulb is burned out or even screwed into the socket to begin with. And the clothes dryer doesn’t care if your clothes are damp or dry or totally shrunken when time runs out.
Stay in the Loop
In a closed-loop system, the process begins the same way it does in an open-loop system. But a closed-loop system has one or more feedback loops in place that can adjust the process. Sometimes the feedback will simply cause the process to repeat until the desired result is achieved.
Both of our open-loop control system examples above could easily be converted to closed-loop systems. A more advanced light switch might take input from a photo cell, or it could poll a motion detector and turn the lights off after a period of no detectable activity in the room. The clothes dryer could be improved with the addition of a moisture sensor. Since the humidity level in the dryer will change during the cycle, why not poll a DHT22 and re-run the process until a predetermined humidity level is reached? Then the dryer becomes a closed-loop system. No more reaching in and fondling the towels and shirt collars to make sure everything is dry. Well, at least in theory.
Some control systems exist in both forms. Traffic lights are a good example of this phenomenon. Some lights are open-loop and simply run on a schedule. Many more of them are closed-loop and will cycle differently depending on traffic flow or information received from other traffic lights. The really smart ones have Emergency Vehicle Preemption (EVP) receivers. This is the system that allows fire trucks and some other emergency vehicles to change the lights in their favor. A device in the vehicle strobes a specific pattern at the receiver module on the light post, and the light changes as soon as possible.
Advantages and Disadvantages
The main advantage of closed-loop systems is fairly obvious: using feedback means more and better control. But there are trade-offs. It’s almost impossible to deal with all the what-ifs in creating any system, and this generates unforeseen issues. They aren’t all bad, though. Maybe you’re sitting peacefully in the corner engrossed in a book, and the motion detector-driven lights shut off because you aren’t moving around enough. That isn’t ideal, but it’s easy enough to turn the lights back on and keep reading.
The unforeseen issues can be so much worse than sudden darkness. Case in point: robotic vacuum cleaners. Here you have a complexly closed-loop system to take care of one of life’s drudgeries. Should be awesome, right? Yes, but because it is blind to everything but its pre-programmed boundaries, it doesn’t know not to spread messes around.
A lot of closed-loop control systems look great on paper, but their imperfections become clear in execution. Take cruise control for example. Here is a system that’s better at its job than humans are. It will maintain the set speed until you hit the brakes or run out of gas. It will perform as intended whether there is a headwind or a tailwind or you’re towing a boat or transporting rowdy children. But cruise control isn’t aware of cliffs or guard rails or deer darting out in front of the car. Cruise control keeps its head down and does its job until it can’t go on.
Open-loop systems may not be as smart as closed-loop systems, but they often shine in their simplicity. For the most part, they do what you expect them to do. Light goes on, light goes off. And they are arguably more dependable since there are fewer things that can go wrong. Of course, a “simple” open-loop control system can mean a steeper learning curve. It’s not easy to learn to drive a manual transmission. But if you don’t know how to drive one, you’re missing out on some nice advantages, like the ability to push start the thing if you have to, and the option to downshift instead of pumping the brakes in icy conditions. So the question is this: is an open-loop system more valuable than a closed-loop system if it means having more control over the process? Does it depend entirely on the process in question?
Open-Loop vs. Closed-Loop
So where exactly does open-loop end and closed-loop begin? The line seems clear for some systems, but muddy for others. How much feedback is enough to qualify? Add just about anything to a light switch and it seems safe to say that you took it from open- to closed-loop.
More often than not, the line between the two is blurry. Think of a motorized garage door. You push the button and the door either opens or closes. Push it again and the door moves in the opposite direction. Most modern garage doors have a fail-safe in place to stop the garage door in the event of an emergency. If the door encounters any resistance, it will stop and reverse direction.
The break beam detector is supposed to keep people and their tricycles from being crushed if they happen to be in the way while the door is closing. But it only works if the person or thing breaks the IR beam. There’s only one beam, and it sits about six inches off the floor. The motorized garage door system is actually quite limited because it has no positional awareness. It doesn’t know where it is on the track, it’s just going up and down blindly, waiting for input or resistance.
Not all doors can be counted on to stop if they feel resistance—I tested mine and it kept on going. So if I don’t pull far enough into the garage and then put the door back down, it might hit the protruding rear end of my hatchback. It’s in the way of the door closing, but it sits way too high to break the beam. So is the garage door really, truly a closed-loop system?
Some of us are not blessed with an always on, high availability internet connection. Sick of answering the constant “Is the internet up?” questions, go-to IT support dude [PatH] took matters into his own hands and developed an unmistakable traffic light display of internet status for his apparently low-reliability connection.
A toy traffic light from Amazon forms the core of the UI, and the lights are driven by a Raspberry Pi that pings a suite of 10 sites in round robin fashion. If a site is found to be unavailable, the Pi goes into “deep probe” mode to determine the extent of the outage, and lights up accordingly. If the light is green, the connection’s clean; if it lights up red, best go to bed. As a bonus, logs are kept of all deep probes, which may prove useful for diagnosing ISP issues.
A display like this could go a long way toward making sure you stay connected, and can reduce the workload for you as de facto IT support. Of course for a little more information about the connection speed with retro styling, you might want to throw a Dekatron at the job.
Remember that episode of Leverage (season 5, episode 3),where Alec uses Marvin to wirelessly change all the street lights green so they can catch up to an SUV? And you scoffed and said “that’s so not real!”… well actually they got it right. A new study out of the University of Michigan (PDF warning), shows just how easy it is to make your morning commute green lights all the way.
The study points out that a large portion of traffic lights in the United States communicate with each other wirelessly over the 900Mhz and 5.8Ghz ISM band with absolutely no encryption. In order to connect to the 5.8Ghz traffic signals, you simply need the SSID (which is set to broadcast) and the proper protocol. In the study the researchers used a wireless card that is not available to the public, but they do point out that with a bit of social engineering you could probably get one. Another route is the HackRF SDR, which could be used to both sniff and transmit the required protocol. Once connected to the network you will need the default username and password, which can be found on the traffic light manufacturer’s website. To gain access to the 900Mhz networks you need all of the above and a 16-bit slave ID. This can be brute forced, and as the study shows, no ID was greater than 100. Now you have full access, not to just one traffic signal, but EVERY signal connected to the network.
Once on the network you have two options. The completely open debug port in the VxWorks OS which allows you to read-modify-write any memory register. Or by sending a(n) UDP packet where the last byte encodes the button pressed on the controller’s keypad. Using the remote keypad you can freeze the current intersection state, modify the signal timing, or change the state of any light. However the hardware Malfunction Management Unit (MMU) will still detect any illegal states (conflicting green or yellow lights), and take over with the familiar 4-way red flashing. Since a technician will have to come out and manually reset the traffic signal to recover from an illegal state, you could turn every intersection on the network into a 4-way stop.
So the next time you stop at a red light, and it seems to take forever to change, keep an eye out for the hacker who just green lit their commute.