kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.89k stars 488 forks source link

PID is not controlling output #1207

Closed BearBrew closed 1 year ago

BearBrew commented 2 years ago

New install to control a mini-fridge for beer fermentation purposes. Have a DHT22 temperature sensor that MyCodo is able to read and keep history. Using Raspberry Pi GPIO pins 23/24 to control a solid state relay, model by SainSmart. One input and 2 outputs placed in MyCodo and MyCodo is able to MANUALLY toggle the output relays. I placed a PID with a set point, however it never automatically toggles the output even when the setpoint is reached. Looking at the logs, I have this:

2022-07-03 14:40:46,478 - DEBUG - mycodo.controllers.controller_pid_415c28f1 - Latest (CH0, Unit: F): 66.74 @ 2022-07-03 14:40:36 2022-07-03 14:40:46,479 - DEBUG - mycodo.controllers.controller_pid_415c28f1 - PID: Input: 66.74, Output: P: -6.239999999999995, I: -0.0, D: 0.0, Out: -6.239999999999995 2022-07-03 14:41:07,013 - DEBUG - mycodo.controllers.controller_input_d649448b - Adding measurements to InfluxDB with ID d649448b-dfb0-448c-a218-8f18d36d662b: {0: {'measurement': None, 'unit': 'F', 'value': 66.74, 'timestamp_utc': datetime.datetime(2022, 7, 3, 18, 41, 6, 974163)}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 99.4, 'timestamp_utc': datetime.datetime(2022, 7, 3, 18, 41, 6, 974185)}} 2022-07-03 14:41:16,456 - DEBUG - mycodo.controllers.controller_pid_415c28f1 - Latest (CH0, Unit: F): 66.74 @ 2022-07-03 14:41:07 2022-07-03 14:41:16,457 - DEBUG - mycodo.controllers.controller_pid_415c28f1 - PID: Input: 66.74, Output: P: -6.239999999999995, I: -0.0, D: 0.0, Out: -6.239999999999995

Looks to me like it reads the input and compares the values but just never does anything with it. What am I missing?

kizniche commented 2 years ago

A PID is also not recommended for fridge/freezer control unless you really know what you're doing with a PID or you'll likely damage your fridge/freezer. A Bang-Bang Function is the preferred method.

BearBrew commented 2 years ago

OK,  I will try that then.   What do you use on the dashboard?  I mean how do you set the setpoint

⁣Get BlueMail for Android ​

On Jul 3, 2022, 4:02 PM, at 4:02 PM, Kyle Gabriel @.***> wrote:

A PID is also not recommended for fridge/freezer control unless you really know what you're doing with a PID or you'll likely damage your frisge/freezer. A Bang-bang Function is the preferred method.

-- Reply to this email directly or view it on GitHub: https://github.com/kizniche/Mycodo/issues/1207#issuecomment-1173162504 You are receiving this because you authored the thread.

Message ID: @.***>

kizniche commented 1 year ago

There isn't currently a widget to change a Bang-Bang setpoint, so you'll have to do that from the Function page (or create a custom Widget to do that and add a helper function in the Bang-Bang Function to receive that command and change the setpoint).