[Dprglist] FYI: Using Arduino IDE Serial Plotter for analyzing PID loop
Murray Altheim
murray18 at altheim.com
Sat Oct 3 12:37:21 PDT 2020
Hi Dave,
Thanks for the graphs, that's absent the acceleration and deceleration ramps of
what I guess I should call the "motion profile" is what I'm aiming for.
I've used an Arduino compatible (an Adafruit Itsy Bitsy M4 Express) to handle
the front IR and bumper data, which I then grabbed over I2C, lately replaced
by a Pimoroni IO Expander board.
For my CPU and motor controller I'm using a Raspberry Pi 3 B+ and a ThunderBorg,
the latter connects over I2C and a Python library, which has a SetMotor() and
GetMotor() methods whose values are 0.0 to 1.0. So it's a bit abstracted, not
using PWM or anything like that. The motor encoders are Hall effect, 494 ticks
per wheel rotation, motors and encoders by OSEPP.
It's clear now that my PID still needs more tuning, but when I was more focused
on that specifically, I'd written a quick python script to grab the value of a
potentiometer connected to an analog input on the IO Expander, then used that
value to alter either the KP, KI, or KD of the PID controller. I certainly did
notice that when I cranked up the pot on either the KI or KD I'd get oscillations.
Cheers,
Murray
On 4/10/20 6:32 am, David Ackley via DPRGlist wrote:
> Hi Murray
>
> As I recall, you are using an Arduino to control your motors and run your PID loop.
>
> So I thought I’d mention that the Arduino IDE has a “Serial Plotter” capability that I’m using to tune my PID loop.
>
> I’ve attached three plots I made where I had set my loop gain to 5, 7.5, and 10 on my 20Hz PID loop.
>
> As I mentioned at this week’s RBNOV and as can be seen in the plots, the error (difference) between the motor set value and the actual motor speed is roughly proportional to the inverse of the loop gain. Also as you increase the loop gain
> you will reach the point where the motor starts to oscillate.
>
> Dave
>
>
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at lists.dprg.org
> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>
--
...........................................................................
Murray Altheim <murray18 at altheim dot com> = = ===
http://www.altheim.com/murray/ === ===
= = ===
In the evening
The rice leaves in the garden
Rustle in the autumn wind
That blows through my reed hut.
-- Minamoto no Tsunenobu
More information about the DPRGlist
mailing list