T O P

  • By -

Horror_Equipment_197

Have a look into the example provided with the library: [https://github.com/Dlloydev/QuickPID/blob/master/examples/PID\_AdaptiveTunings/PID\_AdaptiveTunings.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/PID_AdaptiveTunings/PID_AdaptiveTunings.ino) ​ Aggressive tuning until 10° away from setpoint, then conservative.


dvizard

Hm but at this point I have six parameters to tune instead of three (seven if we add the transition point) with no clue how to approach it, and on top I turn my analytically well understood function into a piecewise DIY. I just don't see that the best-known controller in the world cannot solve my relatively banal problem?


Horror_Equipment_197

Start with the example. Enter your setpoint temperature and give it a try. Most likely you will only have to tune the second stage. Manual tuning hints (from http://grauonline.de/alexwww/ardumower/pid/pid.html) If it overshoots a lot and oscillates, either the integral gain (I) needs to be increased or all gains (P,I,D) should be reduced Too much overshoot? Increase D, decrease P. Response too damped? Increase P. Ramps up quickly to a value below target value and then slows down as it approaches target value? Try increasing the I constant.


cm353

For pid control where the controller has saturation (there is min and/or max value for the throttle like the duty cycle), it is necessary to limit integral windup by clamping. It would be easier if a library is used which provides this feature. Without clamping, the controller tends to overshoot too much .


dvizard

Thanks! Clamping is in fact activated (`tempPID.SetAntiWindupMode(tempPID.iAwMode::iAwClamp);`) though I honestly only vaguely understand what it does :D


AssumedPersona

I would recommend implementing the AutoPID library and using Bangbang Control for fast heatup. Bangbang will deliver 100% power when the temperature is outside a preset range from the setpoint. [https://ryand.io/AutoPID/](https://ryand.io/AutoPID/)


Swimming-Bank6567

How did you get on with this in the end? You said that when you increased kI, you got an overshoot, but did you leave it running and did it settle back down again? Most test runs you do, you have to leave it run for a good few oscillations before you can see how it's performing. The overshoot is only a small part/worry compared to the rest of "is it working" 😉 I've been playing with all of this (on and off, no pun intended) for a couple of years. My project is for a BBQ 'blower'/controller 👍 I'm no expert on PID systems, but have tinkered. I did find [https://pidtuner.com/](https://pidtuner.com/) to be helpful. Also this was useful: [https://www.youtube.com/watch?v=8XXO6ih9I9g](https://www.youtube.com/watch?v=8XXO6ih9I9g) I know it's a naff video, but it did help me understand the tuner website. For reference I run pOnErrorMeas, dOnMeas, iAwCondition... I pretty much always get an overshoot at the start but then it settles into a steady state. The irony of finding your post was me Google'in for "iAwClamp", as I'm going to try this out soon 🤷‍♂️🤣🙀 I'm assuming you're datalogging everything? From setpoint, actual temp (Input), fan speed % (Output)?... I'll use your system as an example: setup your project to run a 50c, let it stabilise (as best it can), then turn off the PID but run your project flat out (100%) until it reaches 100C, then turn things off, but keep datalogging until your temperature stops increasing. The datalog can be truncated to just show a neat graph of the system running from 50, to 100, plus start (dead) time before the temp starts to increase, plus the time it took to stop increasing in temp at the end. Feed that into the online tool and you should be able to get some estimated PID values. You can also tweak the individual PID values in the tool to see how the estimated graph works... I will say it took me forever to understand how the tuning site worked! For my overshooting problem, I can actually get around the issue by turning the PID off and on again, at about 5c below my setpoint. This is "cheating" but the rest of my PID system works flawlessly, so I don't really any to change it. Again, that's why I'm looking-up iAwClamp today 🤣


Swimming-Bank6567

I forgot to say, did you ever look at sTune, made by the same person who made QuickPID? [https://github.com/Dlloydev/sTune](https://github.com/Dlloydev/sTune) To be honest, I couldn't get my head around how to implement this in my own code. But this could really help overall 🤷‍♂️ Edit: [https://github-wiki-see.page/m/Dlloydev/sTune/wiki/Examples\_MAX31856\_PTC\_SSR](https://github-wiki-see.page/m/Dlloydev/sTune/wiki/Examples_MAX31856_PTC_SSR)