I am doing a project to control the temperature with PWM. I use peltier, thermistor,mcu and h-bridge mosfet.
I want to reach a temperature with an error less than 0.05 and stay at that temperature without much (at most 0.05 C) oscillation. My first aim is to reach that temperatures in room temperature (no other effects than room temperature). Lets consider cooling mechanism, in room temperature, for example 14'C requires .285 PWM (out of 1) ,13'C requires .330PWM, and 20'C requires .180PWM. There is no linearity between them, and also changing PWM does not provide linear current change, ex: 1.0 PWM provides 2.15A, 0.5PWM provides 0.6A, and 0.2 PWM provides 0.16A across the peltier in room temperature. My first cooling algoritm:Initially constant=0 Keep PWM 1.0 until temperature is close to set temperature (t_set) by 2, then lowering the PWM with, PWM=constant+ (temperature-t_set)/2, after temperature is set to a temperature constant=PWM, and then PWM=constant+ (temperature-t_set)/5 and so on. And the system reaches steady temperature after 10-15 seconds after the PWM is changed, when PWM change >0.1
First question: How the mcu can can learn the PWM value that keeps the temperature constant? ( ex: 13'C requires .330PWM)
Second question: Is it possible to use PID algorithm to stabilize PWM value at set temperature without knowing the constants at first question?
Third question: If I find a good way that mcu to learn PWM values to keep temperature constant at different environments, and If I use good PID coefficients, do the PWM coefficients works for any environment, or are the PWM coefficients environment specific, ie: heat sink medium and differnt temperatures.
Thanks in advance.
--After 6 hours, from the answers
Q1- Learning that coefficient (I think) requires some algorithm when there is no PID.
Q2-Yes, with good PID coefficients it perfectly stabilizes, error term will be 0 and the only integrator term keeps the system stable, in noiseless environment.
Q3- If good PID coefficients are used and with educated (??) guess some level of stabilization can be accomplished.
To achieve good results in different environments (I think) it is needed to develop a auto tuning PID. My design criteria are keeping the temperature error minumum and keeping the reaching time for stabilization low (if possible).
From the result if it is approprite to ask here my fourth question is: Q4: Which methods do you suggest me to find Ki, Kp and Kd coefficients in different environments (auto tuning PID coefficients when the mcu starts or restarts).