The brain of a cruise control system is a small computer that is normally found under the hood or behind the dashboard. It connects to the throttle control seen in the previous section, as well as several sensors. The diagram below shows the inputs and outputs of a typical cruise control system.

A good cruise control system accelerates aggressively to the desired speed without overshooting, and then maintains that speed with little deviation no matter how much weight is in the car, or how steep the hill you drive up. Controlling the speed of a car is a classic application of **control system theory**. The cruise control system controls the speed of the car by adjusting the throttle position, so it needs sensors to tell it the speed and throttle position. It also needs to monitor the controls so it can tell what the desired speed is and when to disengage.

The most important input is the speed signal; the cruise control system does a lot with this signal. First, let's start with one of the most basic control systems you could have -- a **proportional control**.

In a proportional control system, the cruise control adjusts the throttle proportional to the error, the error being the difference between the desired speed and the actual speed. So, if the cruise control is set at 60 mph and the car is going 50 mph, the throttle position will be open quite far. When the car is going 55 mph, the throttle position opening will be only half of what it was before. The result is that the closer the car gets to the desired speed, the slower it accelerates. Also, if you were on a steep enough hill, the car might not accelerate at all.

Most cruise control systems use a control scheme called **proportional-integral-derivative control** (a.k.a. **PID** control). Don't worry, you don't need to know any calculus to make it through this explanation -- just remember that:

**The integral of speed is distance.****The derivative of speed is acceleration.**

A PID control system uses these three factors -- proportional, integral and derivative, calculating each individually and adding them to get the throttle position.

We've already discussed the proportional factor. The **integral** factor is based on the **time integral of the vehicle speed error**. Translation: the difference between the distance your car actually traveled and the distance it would have traveled if it were going at the desired speed, calculated over a set period of time. This factor helps the car deal with hills, and also helps it settle into the correct speed and stay there. Let's say your car starts to go up a hill and slows down. The proportional control increases the throttle a little, but you may still slow down. After a little while, the integral control will start to increase the throttle, opening it more and more, because the longer the car maintains a speed slower than the desired speed, the larger the distance error gets.

Now let's add in the final factor, the **derivative**. Remember that the derivative of speed is acceleration. This factor helps the cruise control respond quickly to changes, such as hills. If the car starts to slow down, the cruise control can see this acceleration (slowing down and speeding up are both acceleration) before the speed can actually change much, and respond by increasing the throttle position.