Autotune PID C code microcontroller start point

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. Want to write autotuen PID for heater application. Can you point to some good starting point for c code?
2. Any reference library for this?
3. tried autotune arduino PID library, but temp is oscillating at set point.
 

Ian Rogers

Joined Dec 12, 2012
1,136
Normal hysteresis control will keep temperature under control.. PID can be used but not really designed for slow moving control.

if temperature is under by 1 degree, turn on heater.
if temperature is over by 1 degree, turn heater off.

You adjust the temperature hysteresis to suit... No PID needed..
 

crutschow

Joined Mar 14, 2008
34,280
If your heater load has a large thermal mass, it can oscillate around the set point and require some sort of compensation, depending upon how accurately you need to maintain the temperature.

How did you adjust the Autotune PID parameters?
Note that PID generates an analog (continuous) output, and you need a digital on/off output.
You could use the analog output to control the duty-cycle of a slow PWM signal to the heater switch.

You might want to consider Fuzzy Logic to control the heater, as it's generally easier to tune to the desired results as compared to PID, which is an analog compensation technique using integrators and differentiators, emulated in a digital controller.
Fuzzy Logic basically just uses a series of If-Then-Else statements for loop control, using as many as needed to get the system response you want.
Its output would modulate the duty-cycle of the PWM signal to regulate the temperature.
 
Last edited:

Reloadron

Joined Jan 15, 2015
7,501
How are you sensing the temp? Does your sensor respond fast or slowly to change? I would also, as mentioned, consider a fuzzy logic routine.

Ron
 
Top