Understand PID Controller logic and tuning
masterThe thermostat uses a PID (Proportional-Integral-Derivative) controller to manage temperature via Pulse Width Modulation (PWM). The PID output determines how long the heater stays ON during a PWM period.
Tuning the Gains:
- Kp (Proportional): Adjusts reaction to the current error. Higher values increase the rise time (faster response).
- Ki (Integral): Compensates for residual error over time. If the temperature settles below the set point, increase
Ki. If it settles above, decreaseKi. - Kd (Derivative): Compensates for system inertia. It limits overshoot by decreasing PWM if the temperature rises too quickly.
Outdoor Temperature Compensation
If an outdoor temperature sensor is provided and ke (external gain) is set, the system adds an external component E to the output:
E = Ke * (target_temp - outdoor_temp)
For well-insulated buildings, a Ke of 0.6 is recommended.