Replies: 1 comment
-
Just in case anyone every has a similar issue, you can simply set the output range to be both negative and positive which will allow you bi-directional control like this:
If its positive, control forwards, if negative, control backwards. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a project to automate a reverse osmosis watermaker on my boat. Part of that is controlling a multi-turn, high pressure gate valve with a pressure sensor for feedback. Currently I'm using a continuous rotation servo, I'll probably switch to a simple DC motor next.
In the code below, you can see I'm using QuickPID to control the valve. It works okay, but there is some oscillation when it has to switch directions. It takes ~30s to hunt down to the proper set point. If I make that switch between forward and reverse smaller, then the oscillations get worse. Tuning the PID loop has been challenging because the control has a bigger effect when the pressure is high (near the setpoint) and a small effect in the beginning.
The QuickPID library supports forward / reverse modes, but you have to switch between them. I added some code to do that, I'm wondering if this is the right way to approach this?
Is it possible to setup QuickPID to give an output that represents both direction and magnitude? Like if it outputs +255, I rotate the valve CW, and if it outputs -255 I rotate the valve CCW?
Beta Was this translation helpful? Give feedback.
All reactions