Position PID with Speed Limit

142 views
Skip to first unread message

David Partridge

unread,
Oct 24, 2021, 6:43:25 AM10/24/21
to DIY PID Control
I have an existing PID for controlling the position of pointer through a gear train driven by a small DC servo motor which is fitted with a 256 tick encoder wheel.   The PIC QEI interface counts using quadrature mode giving a resolution of 1024 ticks per revolution.

The position is controlled by sending "STEP" (INT0) commands to the PIC which increments the set point of the position PID (with Ki set to zero ATM).   If I want to move the pointer faster I send the STEP signals at a higher frequency.

So far so good.  This works well.

Now I want to hand off the positioning completely to the PIC. Just passing a set point the tells the PIC code where I want it to move the motor to, and speed value for the maximum motor speed to use for this movement (in ticks/second - where 1024 ticks/sec = 1rev/sec = 60RPM).

My thought is to implement a speed PID calculation such that if the PID value from the position PID exceeds the value from the speed PID, then the speed PID value would be used to control the PWM.   This maybe too simplistic - if so please warn me!

The problem I'm having is coming up with some initial PID coefficients for a PonM speed PID which will be at least "close enough" ... I can tune them from there.

If you've been there/done that your experience will help a lot.  I you do have suggestions please say whether the PID input is revs/sec or ticks/sec or ???? so I can scale the numbers  for ticks/sec.

Thank you
David






David Partridge

unread,
Oct 24, 2021, 12:11:59 PM10/24/21
to DIY PID Control
Rakesh proposed the autotune algorithm approach.  I assume he was referring to the Arduino autotune code - is that so? I'd have to port the arduino autotune code to my environment and see what it does.

Any other thoughts welcome
D.
Reply all
Reply to author
Forward
0 new messages