Skip to content
Math In The Real World

image.png
Control Theory
image.png

Control theory is used for cruise control in your car, to manage the temperature in your house, to control blood sugar levels in diabetics, and for much much more.

Control theory is a part of math that deals with how systems work. It can get pretty complicated, but the simpler versions are very easy to understand. Let's start with an easy one, something everybody is familiar with, the thermostat.
Who can explain what a thermostat is? How is it different than a thermometer?
We all have a thermostat in our home to monitor and control the temperature. The simplest thermostat has one input and one output. The input is a temperature sensor. This tells you how hot the room is. The output can send a signal to your heater (lets pretend you don't have air conditioning). If the temperature is too cold, it tells the heater to turn on. Once the temperature rises to an acceptable level, it tells the heater that it can turn off again.
That's it, you now all understand control theory.
Lets make it more complicated though. Pretend you have an Air Conditioner and a Heater. If you set the thermostat to 72 and it's currently 75, the Air Conditioner will turn on. It runs until the temperature hits 72, but then guess what will happen? The cold air in the pipes will actually keep cooling the room down to a temperature just below 72, and then....any guesses? That's right, the heater will turn on. The heater will raise the temperature slightly above 72, triggering the AC. This actually happens in some systems, which is why you need fancier math. Instead of just using the output of a sensor, you can write smoothing functions that average values over time.
What else can we do with control theory?
Has anybody ever heard of diabetes? It's a disease where people have trouble managing their blood sugar levels. When you or I eat a candy bar, our blood sugar temporarily spikes. However, our bodies know how to deal with this by shooting out a bunch of a hormone called insulin. It grabs hold of sugar in the bloodstream and pulls it into the cells. People with diabetes have trouble making this insulin, so they run the risk of having high blood sugar for long periods of time. This is a bad thing, so diabetics regularly need to give themselves insulin shots. However, do you know what the only worse thing than high blood sugar is? Low blood sugar! In fact, if you inject too much insulin, your blood sugar can easily drop to such a low level that you pass out and can even possibly die. And the hard part is, it takes tens of minutes, even hours for insulin to fully work. Scary stuff! What does this have to do with control theory? Companies have just recently invented a device that manages this all for you. It constantly monitors your level of blood sugar and injects micro doses of insulin to try to keep levels as flat as possible. Later on you could even imagine it being able to inject sugar in emergencies, although it can't do that yet.
What else can we do? We can use control theory to program cars to drive by themselves. You guys have heard of this as Cruise Control. We'll start with the most basic Cruise Control rule possible, which is called a line following algorithm. All you want to do is have your car follow a line, no matter which way it twists and turns. The easiest way to do this is to have two sensors. One on each side of the line. Each sensor should detect "white". When the sensor on the left detects black, we need to turn left:
image.png
When the sensor on the right detects black, we need to turn right:
image.png
This should mostly work, but it creates a very bumpy ride with harsh turns. Any ideas on how we can improve this? Let's add more sensors. A five sensor version is common and fancy. When the middle sensor is on the line, you keep driving straight and everything is great. When you hit one of the next sensors on either side, you adjust your steering softly to get back on track. If you still hit the furthest outside sensor, you now adjust your steering strongly to get back on track. You can do a lot of work smoothing out the signals from these five sensors over time to create a much smoother experience. If you’re interested in learning more, look up PID Control.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.