RC Rate Control - fine tuning the PID for hydraulic motor

So I have an Rate Control set up and running!
I work good except I would like it could reach the target rate a little faster and not constantly vary under and above the target.

Setup:
RC 3.7.12
PCB: modified legacy v2 board for RC12

Settings:
I have set “Rate Method” to “single pulse”, it seems better than “multi-pulse” but I think I have around 3000 pulse/minutes (50 pulses/s, 20ms / pulse) so I’m not sure it the correct setting.

Motor setting I have:
P 2
I 2
D 2
Divisor 100

Motor min 70 max 255 which is the range to make the motor from almost nothing to full speed.

I think P at 0.02 (P 2 and Divisor 100) is a decent setting. But It just doesnt stabilize, well sometimes it is stable but most of the time it’s in a one or 2 second cycle where it vary from +20% to -20%.

Any Tips to make it better?

I am setting it in the yard now with an empty box.
Setting Integral and Derivative to 0 seemed to help.
I have also noticed that just it is just moving by 1 PWM when it’s near the target so it is as smooth as it can be.

I will see with a full box of fertilizer.

@SK21 what is the default PWM frequency? Can it be changed in the ino?
In my case it should be 100hz

Here are pictures of my nice control box!:sweat_smile:

1 Like

I haven’t changed the default pwm frequency for a nano. For the Teensy I did have to change the default from 4482Hz to 490Hz. A Raven fast close valve won’t work at 4482Hz. It is changed in the Begin.ino sketch.

For the PID start with P 1, I 0, D 0 and scaling at 1. If it is overshooting the rate high and low adjust the scaling to lower the P. Once it is close, increase P for quicker response. D can smooth out the response. A small amount of I may help with a quicker response time. Too much will cause overshoot.

1 Like