Self Balancing Bot
.
This project consists of a robot balancing on two wheels. We use the 9-axis IMU LSM9DS0 to give us Accelerometer and Gyroscope data about the current angle and angular velocity of the robot. This data is then filtered using complementary filters and PID control to drive the two motors. The motors are controlled through digital outputs in their direction and their seepd by PWM using an H-bridge
Hardware used:
Micro-controller : Mbed NXP LPC1768. [http://developer.mbed.org/platforms/mbed-LPC1768/]
IMU : LSM9DS0 https://www.sparkfun.com/products/12636
H-Bridge: Polulu md08a https://www.pololu.com/product/713
Spark Fun RedBot Kit: https://www.sparkfun.com/products/retired/12032
Software Used:
LSM9DS0 library : http://developer.mbed.org/cookbook/LMS9DS0-IMU
Mbed API
Code:
Import programbalance2
ECE 4180 Mini Project Balancing Robot Nico van Duijn Samer Mabrouk 3/6/2015 This project consists of a robot balancing on two wheels. We use the 9-axis IMU LSM9DS0 to give us Accelerometer and Gyroscope data about the current angle and angular velocity of the robot. This data is then filtered using complementary filters and PID control to drive the two motors. The motors are controlled through digital outputs in their direction and their seepd by PWM using an H-bridge
This code uses a complimentary filter to reduce the IMU's inaccuracies. For more info check : http://www.pieter-jan.com/node/11
Assembly:
To reduce the center of gravity, the motors and the IMU chip are located as close to the wheels as possible with the IMU centered between the motors for a better balance. IMU to Mbed:
IMU Pin | mbed Pin |
---|---|
SCL | p10 |
SDA | p9 |
Vdd | Vout |
GND | Gnd |
H Bridge to mbed
H Bridge Pin | mbed Pin |
---|---|
GND | Gnd |
VCC | VO |
VMOT | Vsupply |
GND | Gnd |
PWMA | p21 |
AIN2 | p23 |
AIN1 | p24 |
STBY | Vout |
BIN1 | p26 |
BIN2 | p25 |
PWMB | p22 |
GND | Gnd |
H Bridge to Motors : Left motor is to the left of the IMU chip and the right one is to the IMU's right.
H Bridge Pin | Motor Wires |
---|---|
BO1 | Left Motor Black |
BO2 | Left Motor Red |
AO2 | Right Motor Black |
AO1 | Left Motor Red |
Final Result:
This video shows the Balancing Bot in action.
Please log in to post comments.