PID controller pwm

hi, I need help with a problem with the Pid Controller pwm.

When the setpoint of 65% is reached, the PID controller regulates to 50% PWM. If the actual value falls, the PWM output remains at 30%, for example, and not 5% as set.

what did I set wrong?


It can only operate based on the gains you set. If you don’t provide actual error, P, I, and D values, there’s nothing more that can be said than that. Have you read the documentiation about how a PID operates and how to tune a PID?

Yes, I have read the documentation. Even if I only adjust the P component, I still have the problem. Are the controller settings correct?

Impossible to tell without actual data. You can find the P, I, and D values in the PID Dashboard Widget and the Status are of the PID Function cofig dialog.

Now it’s working. The solution was to rebuild the entire system.

I doubt there was an issue with the system. It was likely a configuration issue and some settings were entered differently the second time around. PID controllers are very basic, but they will not function properly if not configured/tuned well.

Parameters were the same, so it must have been the system.
Regardless, it works. Thank you for the fast feedback.

I haven’t seen any evidence to suggest that’s true. I have, however, seen hundreds of users over the years with misconfigured systems that begin working when configured properly.

You were probably right. Apparently it’s not the system’s fault.

As you can see from the log, the PID simply stops regulating at 12.25 and the output remains permanently at 19.1%.

Do you have an explanation or a tip?

2024-05-22 12:21:55,020 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.91744869153887 @ 1970-01-20 21:46:13.311125
2024-05-22 12:21:55,022 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.91744869153887, Output: P: -2.8624399176012605, I: -0.0, D: -0.6308079652094278, Out: -3.4932478828106883
2024-05-22 12:21:55,214 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -3.4932478828106883, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 17.5%
2024-05-22 12:22:15,089 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 66.0669871061265 @ 1970-01-20 21:46:13.331034
2024-05-22 12:22:15,100 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 66.0669871061265, Output: P: -3.328999771114693, I: -0.0, D: -0.3170214389257939, Out: -3.646021210040487
2024-05-22 12:22:15,662 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -3.646021210040487, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 18.2%
2024-05-22 12:22:35,146 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.90218966964217 @ 1970-01-20 21:46:13.351069
2024-05-22 12:22:35,146 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.90218966964217, Output: P: -2.814831769283568, I: -0.0, D: 0.3493705653467902, Out: -2.4654612039367776
2024-05-22 12:22:35,339 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -2.4654612039367776, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 12.3%
2024-05-22 12:22:55,002 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.56954299229419 @ 1970-01-20 21:46:13.371353
2024-05-22 12:22:55,003 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.56954299229419, Output: P: -1.7769741359578677, I: -0.0, D: 0.7052109559777193, Out: -1.0717631799801484
2024-05-22 12:22:55,233 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -1.0717631799801484, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 5.4%
2024-05-22 12:23:15,087 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.09803921568627 @ 1970-01-20 21:46:13.391071
2024-05-22 12:23:15,094 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.09803921568627, Output: P: -0.30588235294116434, I: -0.0, D: 0.9995880064087856, Out: 0.6937056534676214
2024-05-22 12:23:35,054 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.1468680857557 @ 1970-01-20 21:46:13.411039
2024-05-22 12:23:35,055 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.1468680857557, Output: P: -0.45822842755778087, I: -0.0, D: -0.10351720454718816, Out: -0.561745632104969
2024-05-22 12:23:35,248 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -0.561745632104969, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 3.0%
2024-05-22 12:23:55,021 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.34523537041275 @ 1970-01-20 21:46:13.431353
2024-05-22 12:23:55,022 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.34523537041275, Output: P: -1.0771343556877855, I: -0.0, D: -0.4205386434729519, Out: -1.4976729991607374
2024-05-22 12:23:55,252 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -1.4976729991607374, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 7.5%
2024-05-22 12:24:15,210 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.49019607843137 @ 1970-01-20 21:46:13.450981
2024-05-22 12:24:15,215 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.49019607843137, Output: P: -1.5294117647058658, I: -0.0, D: -0.30731670099946484, Out: -1.8367284657053307
2024-05-22 12:24:15,527 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -1.8367284657053307, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 9.2%
2024-05-22 12:24:35,006 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.93423361562523 @ 1970-01-20 21:46:13.471124
2024-05-22 12:24:35,007 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.93423361562523, Output: P: -2.9148088807507224, I: -0.0, D: -0.9413595788509923, Out: -3.8561684596017147
2024-05-22 12:24:35,197 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -3.8561684596017147, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 19.3%
2024-05-22 12:24:54,990 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.3681239032578 @ 1970-01-20 21:46:13.491175
2024-05-22 12:24:54,991 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.3681239032578, Output: P: -1.1485465781643245, I: -0.0, D: 1.2001525902189627, Out: 0.05160601205463822
2024-05-22 12:25:15,135 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.87930113679712 @ 1970-01-20 21:46:13.510995
2024-05-22 12:25:15,136 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.87930113679712, Output: P: -2.743419546807029, I: -0.0, D: -1.083695735103376, Out: -3.827115281910405
2024-05-22 12:25:15,684 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Setpoint: 65.0, Control Variable: -3.827115281910405, Output: PWM output 8e5ec485-e92f-442f-ba8f-ac6820432242 CH15 to 19.1%
2024-05-22 12:25:34,971 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 65.34065766384374 @ 1970-01-20 21:46:13.531053
2024-05-22 12:25:34,973 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 65.34065766384374, Output: P: -1.0628519111924777, I: -0.0, D: 1.1419241626611694, Out: 0.07907225146869168
2024-05-22 12:25:54,961 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 64.87373159380483 @ 1970-01-20 21:46:13.551351
2024-05-22 12:25:54,962 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 64.87373159380483, Output: P: 0.3939574273289179, I: -0.0, D: 0.9898832684824868, Out: 1.3838406958114047
2024-05-22 12:26:14,968 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 64.26031891355764 @ 1970-01-20 21:46:13.571057
2024-05-22 12:26:14,969 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 64.26031891355764, Output: P: 2.307804989700163, I: -0.0, D: 1.3004348821240512, Out: 3.6082398718242144
2024-05-22 12:26:35,025 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 64.09399557488365 @ 1970-01-20 21:46:13.591032
2024-05-22 12:26:35,027 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 64.09399557488365, Output: P: 2.826733806363013, I: -0.0, D: 0.35260547798885966, Out: 3.179339284351873
2024-05-22 12:26:54,984 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 63.96276798657206 @ 1970-01-20 21:46:13.611200
2024-05-22 12:26:54,984 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 63.96276798657206, Output: P: 3.23616388189517, I: -0.0, D: 0.2782024872205682, Out: 3.5143663691157383
2024-05-22 12:27:15,162 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 62.9404135194934 @ 1970-01-20 21:46:13.631070
2024-05-22 12:27:15,179 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 62.9404135194934, Output: P: 6.4259098191806014, I: -0.0, D: 2.167391470206767, Out: 8.59330128938737
2024-05-22 12:27:35,041 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 63.08842603189136 @ 1970-01-20 21:46:13.651103
2024-05-22 12:27:35,042 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 63.08842603189136, Output: P: 5.96411078049896, I: -0.0, D: -0.3137865262836792, Out: 5.650324254215281
2024-05-22 12:27:54,970 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 62.96787975890745 @ 1970-01-20 21:46:13.671124
2024-05-22 12:27:54,971 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 62.96787975890745, Output: P: 6.340215152208755, I: -0.0, D: 0.25555809872588586, Out: 6.5957732509346405
2024-05-22 12:28:15,081 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - Latest (CH1, Unit: percent): 61.99893186846723 @ 1970-01-20 21:46:13.690979
2024-05-22 12:28:15,083 - DEBUG - mycodo.controllers.controller_pid_5f8a0763 - PID: Input: 61.99893186846723, Output: P: 9.363332570382239, I: -0.0, D: 2.054169527733265, Out: 11.417502098115504