Source: https://mokxi.com/teachers/plans/build-balance-bot
Updated: 2026-11-11

Lesson plan

# Build a balance bot lesson plan

Three lessons on a two-wheel self-balancing robot: read its tilt, see what the wheels do to it, and write the PID that stands it up.

2 chapters, 3 lessons, about 2 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Turn the IMU into an angle, and learn which way the wheels must go.
- A PID on three knobs, a push, and tuning it by hand.

### Materials for the whole unit

- Arduino Uno R3
- Half breadboard
- OLED display, 128x64
- Potentiometer x 3
- Self-balancing robot

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 20 min

## Sense and drive

Turn the IMU into an angle, and learn which way the wheels must go.

Lesson | Time | What students do

Balance bot 1: read the tilt Wake the robot’s MPU6050 and turn its readings into a tilt three ways: from gravity, from the gyro, and with a complementary filter that blends the two. Then watch them follow the robot as it falls. | 40 min

- Run it: wake the IMU
- Let go, and it falls
- Three angles
- Why blend them

Balance bot 2: what the wheels do Drive the wheels forward and the body tips back: the move every balancing robot is made of. Then balance on P and D alone and see why that is not quite enough. | 40 min

- Run it: the kick
- Forward wheels, backward body
- P and D alone
- Why it rolls away

### Materials

- Arduino Uno R3
- Half breadboard
- OLED display, 128x64
- Potentiometer x 3
- Self-balancing robot

### Check for understanding

Each student finishes "Balance bot 2: what the wheels do" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Why it rolls away".

Chapter 2. About 40 min

## Stand it up

A PID on three knobs, a push, and tuning it by hand.

Lesson | Time | What students do

Balance bot 3: the PID that stands it up The finished balance bot: a complementary filter, a PID with three knobs for Kp, Ki and Kd, and the angle and gains on an OLED. Push it, turn the knobs, and tune it. | 40 min

- Run it: it stands
- Push it
- Turn Ki to zero
- Tune it

### Materials

- Arduino Uno R3
- Half breadboard
- OLED display, 128x64
- Potentiometer x 3
- Self-balancing robot

### Check for understanding

Each student finishes "Balance bot 3: the PID that stands it up" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Tune it".

Your class

## Teach this unit as a class

Start a class from this course and its 3 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
