Arduino PID Autotune not tuning


I am building a code to control a heater with a PWM output connected to an SSR using the Arduino-PID-AutoTune-Library. There are two issues I am currently facing with the above library while using the normal mode(not simulating but using actual analog input of a thermocouple) of operation. Please find attch. for code with libraries and screenshot of output while tuning.

1> The temperature overshoots when I start the operation.

I tried several values for the constants(kp=2,ki=0.5,kd=2; kp=1,ki=0.8,kd=0.8; kp=1,ki=0.5,kd=0 etc), but still the temperature overshoots by a significant amount.

For eg, if the Setpoint is 100 C, the process value goes upto 130-140 C before coming back to stable state between 95 to 110 C.

2> When I use the Auto tuning feature, the Arduino enters the tuning mode, but the PWM output count just toggles between 50 and 150 and it never comes out of Autotune mode and the temperature goes on increasing continuously even beyond 200 C although the set point is 100 C.

Can you please help me rectify the problem?


HeaterControl.ino (4.21 KB)

PID_AutoTune_v0.cpp (3.59 KB)

PID_AutoTune_v0.h (1.64 KB)

PID_v1.h (3.9 KB)

PID_v1.cpp (7.87 KB)