A PID controller works by measuring the difference between the desired setpoint and the current process variable, called the error. It calculates three parts: proportional (P) which reacts to current error, integral (I) which sums past errors to fix steady-state issues, and derivative (D) which predicts future error based on its rate of change. These three parts add up to create the control signal that adjusts the process. The execution table shows how error, P, I, D, and output change step-by-step. The integral term accumulates over time, the derivative can be negative if error decreases, and the output can be negative if the sum of terms is negative. This combination makes PID controllers widely used because they balance quick response, steady accuracy, and smooth control.