PymateIO-PID-controler: Difference between revisions
| Line 15: | Line 15: | ||
'''In theoretical world''': | '''In theoretical world''': | ||
* you set the value (eg: 200°C) and | * you set the value (eg: 200°C) and | ||
* the device immediately | * the device immediately reach the target temperature (eg: the oven is at 200°C). | ||
'''In real world''': | '''In real world''': | ||
Revision as of 16:51, 12 July 2026
About PID
A PID controller is a feedback-based control loop used to manage machines and processes that require continuous control and automatic adjustment!
PID regulator can be used to regulates temperature, pressure, speed, illumination, position, ...
Let's examine the practical case of an oven set to 200°C
In theoretical world:
- you set the value (eg: 200°C) and
- the device immediately reach the target temperature (eg: the oven is at 200°C).
In real world:
- you must starts heating the resistor followed by the air in the oven then the internal walls before getting the temperature stabilized at 200°C. This is named Thermal Inertia.
- So you give a lot of power to the heating resistor to make the temperature raising fast toward 200°C
- You stop early power delivery soon enough to not overshoot too much the final temperature (otherwise you may reach 300°C... where the meal will carbonize).
- Finally, giving some transcient pulse of heating will somewhat keep the oven temperature around 200°C.
Additional ressource about PID regulation:
- PID Controler with Arduino from Andeas Spiess. A very valuable resource.
- PID controller on WikiPedia
Pymate software PID
The PymateIO includes the PID class (pid library).
The PID controler do use a Timer to perform its treatments (it is an autonomous process).
As for each PID Controller, the following parameter are required:
- Kp : Proportional constant
- Ki : Integral constant
- Kd : Derivated constant
The software controller requires additional parameters:
- dt: time (ms) between two consecutive measurement
- measure_func : the function that returns the PID input value.
- output_func : the function(value) called by the PID controler to set the output.
- output_min : minimal value for the output.
- output_max : maximal value for the output.
The PID controller starts when setting the setpoint (see setpoint(value) ) and stop when stop() is called.
Do not hesitate to read the test_pid.py of Plancha-CMS for implementation example.
- Kp, Ki, Kd : to determine
- dt = 100ms
- measurement_func : returns the measured RPM
- output_func : set the PWM duty cycle (in percent) for the motor
- output_min : 0
- output_max : 100
PymateIO all right reserved © 2026 - Written by MCHobby for PymateIO
