Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Ground Bot Tracker and Balancer with PID Control
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Ground Bot Tracker and Balancer with PID Control

by liam.ada on Sat Apr 24, 2010 2:20 am

Hello,

I can really use help with implementing a simple Kalman filter to clean sensor signals from my Sharp IR range sensors (GP2D12). Background...

I made a ground bot (GBOT) with a PID controller using the ZX-40A microcontroller from http://www.zbasic.net based on the ATMEGA644 chip. GBOT inputs are 2 IR range sensors (GP2D12). Outputs are 2 PWM signals to a Pololu motor driver (VNH2SP30).

The GBOT maintains a setpoint distance of 10-inches from a target and maintains that distance, no matter what. The feedback control system was originally coded with P-control only and resulted in excessive overshoot and oscillations. So then I did full PID control. See video to observe P-control vs. PID control.

http://www.youtube.com/watch?v=uTh2DBWAbPs

Had trouble with IR sensor noise. Issue mitigated with hardware and software. Hardware... added low ESR 1,000uF capacitors on VIN and VOUT of the LM2940T voltage regulator. Software includes an 8th order butterworth filter to clean IR sensor position and velocity. Now I want to add a Kalman filter. I could use a good primer.

Using the same GBOT system, I added an aluminum frame, disabled the forward looking IR range sensors and added a new GP2D120 IR sensor for tilt-angle and tilt-rate measurements. So the only input is a single IR sensor. The result is a 5-foot tall balancing bot (GBOT90) that will someday serve Martinis. IR range sensor noise is still an issue - hopefully the Kalman filter will improve performance. Your help is appreciated.

http://www.youtube.com/watch?v=bxx14Xe2iNg

Thanks.
liam.ada
 
Posts: 18
Joined: Sat Apr 24, 2010 1:56 am

Re: Ground Bot Tracker and Balancer with PID Control

by liam.ada on Tue Nov 23, 2010 5:04 pm

I finally got a chance to characterize the Tamiya-72101 motors for my gbot90 project. The gbot90 is a self balancing ground robot with PID feedback control using a Zbasic.net microcontroller:

http://www.youtube.com/watch?v=bxx14Xe2iNg

Up to this point I've deluded myself like a Bank CEO into thinking the motors respond instantaneously. Now I want to characterize the motors to make a real improvement to the feedback control system. So the goal is to measure the motor transfer function and quantify the RPM response to throttle input. The throttle is PWM duty cycle.

To characterize the motors, I input a step function (0 duty cycle to 100% duty cycle in ~0sec) and measured the RPM response vs. time. I learned the hard way that using IR encoders was not practical because the Tamiya-72101 motors were too responsive. So instead, I coupled a separate geared motor/generator (with low mechanical resistance) to the Tamiya shaft. The generator is geared to produce adequate voltage. The output was routed to a separate ZX-40N device to measure RPM time response in terms of voltage. See attached image for setup:
Image

The ZX-40N zbasic code has two basic arrays: one for time (via zbasic “GetElapsedMicroTime” function) and the other for generator voltage (via “GetADC” function). I set the array size for each variable to 400 elements and that nearly used up the RAM. It was enough to capture the step response shown in the image below. That signature was very repeatable with 5 trials.
Image

In short, the plot shows the Tamiya motor reach full RPM in about ~0.09sec. I was surprised by the oscillatory nature of the response, but I learned that it’s an artifact of the generator (DC type). I verified this by running the Tamiya motor at constant RPM (100% duty cycle) and recorded the response. See image below. Even at constant RPM, the generator response was oscillatory with a clear mean and consistent amplitude likely correlated to generator RPM.
Image

Bottom line is that enough data was gathered to fair out a decent transfer function and update the control system. I suppose some capacitors on the generator will tame those oscillations. Or I can apply some signal processing tricks.

Appreciate your comments. Thanks.

Liam
liam.ada
 
Posts: 18
Joined: Sat Apr 24, 2010 1:56 am

Please be positive and constructive with your questions and comments.