# PID Controller

> A loop that keeps a machine at a target. It fixes the gap again and again.

**Field:** Artificial Intelligence  
**Category:** Robotics & Vision  
**Also known as:** Proportional-Integral-Derivative Controller, PID Control, PID Loop

## Think of it like

It is like steering a bike to stay on a line. You turn more when you drift far, and less as you get back.

## Definition

A PID controller keeps a machine at a target, like a speed or a heat. PID stands for proportional, integral and derivative. It checks the gap, called the error, between the target and what a sensor reads. The P part pushes in step with the error now. The I part adds up error that has lasted a while, and the D part slows the push as the gap closes. Together they reach the target without wild swings.

## Formula

```
output = Kp × error + Ki × (sum of past error) + Kd × (change in error)
```

## Example

A drone must hold a height of 10 metres. A gust pushes it down, and its PID controller spins the rotors faster, then eases off as it climbs back.

## Why it matters

PID controllers run inside drones, cars, ovens and robot joints. They turn a plan into steady, smooth motion.

## Common mistake

Setting the P part too high. The machine then shoots past the target and swings back and forth.

## Three principles

- **P: the gap now.** Push harder when the gap is big.
- **I: the gap so far.** Fix a small gap that will not close.
- **D: the change.** Ease off as the gap shrinks.

## Related terms

- [Actuator](https://learn.benibix.com/term/ai/actuator)
- [Sensor](https://learn.benibix.com/term/ai/sensor)
- [Drone](https://learn.benibix.com/term/ai/drone)
- [Path Planning](https://learn.benibix.com/term/ai/path-planning)
- [Robot](https://learn.benibix.com/term/ai/robot)

![A loop: target, then a box marked PID, then a motor, then a sensor that feeds back. To the right, a line climbs toward a dashed target line, goes a little past it and settles on it.](https://learn.benibix.com/diagrams/ai6-pid.svg)

---

Source: https://learn.benibix.com/term/ai/pid-controller
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
