pid temperature control

Status
Not open for further replies.
Thanks Les, the link I found for microchip was forbidden! Looks like they move stuff around.

Ahmed, can you give details on what your using as a heater? What kind of power is it? PID will be difficult with a underpowered heater, what kind of leeway you got on the set temperature? Most temp sensors have a margin of error, with water being a good heat sink, I dont think PID is a must for this. If you are happy with say 0.1C each way, then maybe PID in full isnt needed.
Anyway hopefully that should get you on your way.
 
Just for grins, you might also consider Fuzzy Logic Control which is designed for digital execution and can readily handle non-linear conditions, whereas PID is an linear analog approach adapted to digital control.
Here's a short thread where a poster found that he had better results using Fuzzy Logic as compared to PID for pressure/flow control in an Espresso Machine.
 
If you look on the wikipedia page for PID control they even have this nice sudo code, if you aren't sure how to make equations from block diagrams. If you were to translate this to C and put it on a microcontroller it would pretty much do the job as is.

Code:
previous_error = 0
integral = 0
loop:
  error = setpoint - measured_value
  integral = integral + error*dt
  derivative = (error - previous_error)/dt
  output = Kp*error + Ki*integral + Kd*derivative
  previous_error = error
  wait(dt)
  goto loop
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…