Hackaday Dictionary: Open- And Closed-Loop Systems

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.

 

light-switch-ok
And there was much rejoicing. Image via Racoon Valley Electric Cooperative

Control Systems

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.

speed-queen
A humble clothes dryer. Image via Showplace Rents

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.

xkcd_traffic_lights
What are they telling you? xkcd #1116

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.

 

cruise-control
Cruise control via Wikipedia

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?

tricycle-door-stopper
This tricycle is simultaneously safe and unsafe. Image via Apple Door

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?

Traffic Light Tells You If The Internet Is Up

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.

Green Lights Forever

Green Light Your Commute With America’s Unsecured Traffic Lights

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.

Thanks for the tip [Matt]

Hackaday Links: January 17th, 2013

Free-formed VFD clock

links-free-formed-vfd-clock [James] doesn’t need a circuit board or even some protoboard to get the job done. He free-formed all the circuits for his VFD clock. Right now this is the only project hosted on his blog so click around to see how he got to this point.

DIY LED traffic light

links-diy-traffic-light

Here’s a scratch-build traffic light which [Jarle] uses to display information about his server. If you’re unable to find your own storm damaged original this is a pretty easy way to build one.

FPGA space attack game

links-classic-shooter-running-on-fpga

This game is running on an FPGA, but it’s not written in HDL. Instead, [Johan] wrote the game in C to run on a soft processor loaded on the gate array.

Hourglass entropy

links-hour-glass-entropy

This is a fascinating idea for generating random numbers. [Gijs] is shining a laser onto a light dependent transistor. The beam of the laser is broken by the falling sand of an hourglass. This technique could be use as an entropy source for random number generation.

GPS clock source for a digital timepiece

links-gps-clock

It seems like massive overkill, but you can’t beat the time accuracy of using a GPS module as a clock source. We don’t expect that [Jay] kept the clock in one piece after finishing the project. It’s just a good way to practice decoding the GPS data.

Traffic Light Cufflinks

[Brendan Sleight] has been hard at work on this wearable piece of tech. He doesn’t wear much jewelry, but a wedding ring and some cufflinks are part of his look. To add some geek he designed a set of cufflinks that function like traffic lights. Since he still had some program space left he also rolled in extra features to compliment the traffic light display.

That link goes to his working prototype post, but you’ll want to look around a bit as his posts are peppered with info from every part of the development process. The coin-sized PCB hiding inside the case plays host to a red, amber, and green surface mount LED. To either side of them you’ll find an ATtiny45 and a RV-8564-C2. The latter is a surface mount RTC with integrated crystal oscillator, perfect for a project where space is very tight.

The design uses the case as a touch sensor. Every few seconds the ATtiny wakes up to see if the link is being touched. This ensures that the coin cell isn’t drained by constantly driving the LEDs. The touch-based menu system lets you run the links like a stop light, or display the time, date, or current temperature. See a quick demo clip after the break.

Continue reading “Traffic Light Cufflinks”

Traffic Lights Tell You When Your Xbox Live Friends Are Gaming

It sounds like [Andrew] is trying to build a Pavlovian response into his behavior when it comes to online gaming. He wants to make sure he doesn’t miss out when all his friends are online, so he built this traffic signal to monitor Xbox Live activity. It will illuminate the lights, and drive the meters differently based on which of his friends are currently online. When the light’s green, he drops everything a grabs a controller.

The base of the light is a black project box. Inside you’ll find the Arduino compatible chip which drives the device mounted on a piece of protoboard. A WIZnet W5100 adds network connectivity at the low price of around $25. There is one problem with the setup. The API which [Andrew] found doesn’t use any authentication. This means that he can only see the public status of his friends; anyone who has set their online status set to private will always register as ‘online’. If you know of an existing Xbox Live API that would solve this issue we’d love to hear from you in the comments.

Checking Network Status With A Traffic Light

If you’ve ever dealt with a buggy Internet connection, you know how frustrating it can be. This project takes the guesswork out of mashing F5 over and over, or simply walking over to your router and ‘turning it on and off again.’

Necessity is the mother of invention, and when the folks at the Bitlair hackerspace in Amersfoort, Netherlands got tired of opening up a terminal to see if their network connection was down at this weekend’s Haxogreen camp they did what any self-respecting hackerspace would do: make a traffic light monitor the Internet.

The traffic light is controlled by a Raspberry Pi the Bitlair folks had lying around attached to a spare traffic light they somehow obtained with a relay. Green means the Raspi can reach 8.8.8.8, red means there is no connection, and flashing lights means there is packet loss.

Not bad for a project put together in a few hours. Now if we only knew how they obtained a traffic light, ‘just lying around.’

Video after the break.

Continue reading “Checking Network Status With A Traffic Light”