Skip to content

Bootcamp Map ​

Each step adds hardware or firmware the finished robot runs, and ends with a test. The firmware is one project that grows step by step: start it from tiva-c-bare, and order the parts now, since Steps 1 and 2 need only the LaunchPad.

No.StepTopics
1Firmware SkeletonStart the robot's firmware. 80 MHz clock, the 1 kHz tick every later step hangs work on, the LEDs, debounced buttons, and the mode menu.
2Loggingprintf over the LaunchPad's USB serial port, and a cycle counter that measures how much of each 1 ms tick the tick handler uses.
3PowerRun the robot from its own 2S LiPo. Battery, switch and 5 V buck on the carrier board, a divider into ADC1, and a firmware cutoff that refuses to run on a flat battery.
4MotorsWire the TB6612 to the motors and the battery, and drive them with 20 kHz PWM from PWM0. Commands in millivolts, capped at the motors' 6 V, with a dead-man stop.
5EncodersCount both wheels in hardware with QEI0 and QEI1. Position in counts and millimetres, speed over a 10 ms window, and a phase-error count that shows noisy wiring.
6IMU and DisplayAn I2C0 driver on PB2/PB3, the MPU-6050 gyro and accelerometer, and the SSD1306 OLED on the same bus. Test mode shows the encoders, battery and IMU on the robot itself.
7Tilt AngleTurn the MPU-6050's readings into one number, the robot's tilt, with a complementary filter at 500 Hz in the tick. Calibrate the gyro offsets and the balance point, and keep them in EEPROM.
8Wheel SpeedMake each wheel turn at the speed it's told, in mm/s. Feed-forward from the motor's measured voltage per speed, plus a PI loop on the encoder, at 500 Hz in the tick.
9The FrameStack the boards on standoffs, mount the motors under the bottom one, the IMU over the axle and the battery on top. A kickstand for testing, and the measurements Step 10 needs.
10Standing UpThe balance loop. Tilt and tilt rate set a wheel acceleration, integrated into a speed for the wheel loop. Starts when held upright, cuts out past 45°, and a serial console tunes the gains live.
11Holding PositionAn outer loop on the wheels' speed and position sets the angle the balance loop holds. The robot stays where it was let go and comes back when pushed.
12DrivingSteering from the gyro's yaw rate, a moving home for the position loop, and a Bluetooth remote over an HC-05 on UART1. Each key drives for half a second, so a dropped link stops the robot.

Balance Bot Bootcamp