Robot using IMU for Control
Purpose
Use the IMU to correct steering on the Sparkfun magician robot. Moreover, IR sensors will be used to avoid and navigate around obstacles.
Components
- Sparkfun magician robot kit
- Solderless breadboard
- Mbed LPC1768 chip
- Pololu MD08A H-Bridge breakout
- Sparkfun LSM9DS0 9-axis IMU breakout
- IR distance sensor with filters (3x)
- AA battery (4x)
Background
PID (proportional-integral-derivative) control can be used to correct error in a system. It uses feedback by measuring a current value and comparing it to a setpoint value. The difference between these values is known as the error. The controller attempts to minimize the error by inputting a correction term to the actuator. The controller uses three constant constant parameters known as P, I, and D. The P (or proportional) term corresponds to the present error. The I (or integral term) corresponds to the accumulation of past errors. The D (or derivative) term corresponds to the prediction of future errors based on the current rate of change. By tuning these three parameters based on the system at hand, the PID controller can minimize the error in the system.
Tuning these parameters can be quite involved and tedious. The naive approach of trial and error may be used. However, this usually leads to many hours of painstaking and tedious work and may not even lead to a desirable outcome. Mathematical modeling is usually used to compute the terms for the controller. This wiki page here (http://developer.mbed.org/cookbook/PID) explains a method of calculating P, I, and D. A simple Google search can also yield a plethora of information on PID control theory.
Pictures
Sparkfun Magician Bot Front View
Sparkfun Magician Bot Top View
Pinouts
Mbed | H-Bridge | Motor |
---|---|---|
p21 | PWMB | |
p22 | BIN2 | |
p23 | BIN1 | |
p24 | AIN1 | |
p25 | AIN2 | |
p26 | PWMA | |
VOUT | VCC, STBY | |
VIN | VMOT | |
GND | GND | |
AO1 | Right Motor + | |
AO2 | Right Motor - | |
BO1 | Left Motor + | |
BO2 | Left Motor - |
Mbed | IMU |
---|---|
p9 | SCL |
p10 | SDA |
VOUT | VDD |
GND | GND |
Mbed | IR Filter/Sensor |
---|---|
p18 | Left IR AIN |
p19 | Right IR AIN |
p20 | Center IR AIN |
VIN | +5V |
GND | GND |
Code
Import programRobot_feedback_ir
Use the IMU to correct steering on the Sparkfun magician robot. Moreover, IR sensors will be used to avoid and navigate around obstacles.
Video Demo
Please log in to post comments.