Skip to content

The Frame ​

This step turns the bench setup into a robot. The frame is three 7×9 cm perfboards stacked on M3 standoffs: motors and driver at the bottom, the LaunchPad carrier in the middle, battery and display on top. Perfboard is stiff enough, already has the holes, and you can solder to it. If you have a printer, print plates of the same size instead.

Hardware: three 7×9 cm perfboards (or printed plates), eight M3 standoffs (four 30 mm, four 40 mm), M3 screws, two N20 metal mounting brackets with their M1.6 or M2 screws, a 50 mm M3 screw and two nuts for the kickstand, Velcro strap for the battery.

Build it ​

LevelWhat goes thereWhy
Bottom plateThe two motors under it in their brackets, shafts lined up across the 7 cm side, wheels outside the plate. The TB6612, the bulk capacitor and the 5 V buck on top. The IMU on top too, in the middle, right over the axleShort motor wires. The IMU over the axle feels the tilt but almost none of the wheels' acceleration
Middle plate, 30 mm upThe carrier board with the LaunchPad
Top plate, 40 mm above thatThe battery, strapped flat, and the display facing back. The power switch on the edgeA high centre of mass falls more slowly, which makes balancing easier, not harder
  1. Mount the IMU square to the plate edges, the way it sat in Step 6's tests. If it ends up turned or flipped, redo the axis table in tilt.h (Step 7).
  2. Line the motors up on one axis. A motor that sits a little forward of the other makes the robot turn every time it accelerates.
  3. Run the cables between the levels along one standoff and tie them down: a loose cable swings and moves the centre of mass.
  4. Screw the 50 mm M3 screw through the back of the bottom plate, pointing down and back, with a nut on each side. Set it so the robot rests at about 20° when it lies back on it. That's the kickstand: Balance mode starts from it when you lift the robot upright.

What you add ​

No firmware: the robot runs Step 8's. This step is the build and four measurements.

Notes ​

  • Where the weight goes. The robot falls like a pendulum of length L, the height of the centre of mass above the axle: the higher it is, the slower it falls. A tall robot gives the loop more time; a short, bottom-heavy one is the hardest to balance.
  • Wheels and tyres. The tyres must not slip on your floor. If they do, the encoders still count, but the robot doesn't go where the wheels think it went, and the position loop in Step 11 fights a lie.
  • Wire the switch where you can reach it while the robot is lying down. You'll turn it off a lot during tuning.

Test ​

  1. Calibrate again, now with the board in the robot. For the second press, hold the robot upright on its wheels and find the angle where it feels weightless, balanced on the axle.
  2. Test mode. With the robot resting on its kickstand, write down the angle: about −20°. Stand it up by hand: the angle passes through 0 at the balance point.
  3. Find the centre of mass. Lay the robot on its side across a pencil and roll it until it balances; mark the line. Measure from it to the axle: that's L. Somewhere between 60 and 150 mm is fine.
  4. Measure the distance between the middles of the two tyres and put it in TRACK_MM (Step 12).
  5. Wheels in the air (robot upside down on a box): run the speed lines of the motor check again. Same results as Step 8, with all the wiring in its final place.
  6. Shake the robot by hand while it's in Test: imu err and the encoder err counts stay at 0.

Balance Bot Bootcamp