Balancing Robot Lab teaching notes

For middle and high school physics, computer science and robotics teachers. These notes cover a first period, the levels, the misconceptions the app is built to confront, and what it leaves out.

Using this with a class? Make a free class and add your students yourself: each gets a username and password, with no email or Google account needed. Or give them one join code. Using Google Classroom? Post the link there; with a free class, the link also puts each student in your class, so you see their work. mytekDev is also available from the Google Workspace Marketplace, so your school's Google admin can install it for everyone.A first lesson: Open it on the projector at Level 1 and press play. The starter program does nothing, and the robot tips over in under a second. Ask the class what the program would have to do to stop it. Take the answer that sounds like "drive the wheels toward the way it is leaning" and type it in as Level 2. Then ask: how hard should it push? Level 3 lets them find out by turning one number.

Set up a free class Share to Google Classroom
Put this on your class site

Students can use Balancing Robot Lab right on your page, with no account. What they make stays on that page; to keep their work, they make a free account.

Google Sites: Insert, then Embed, then By URL, and paste this address.

https://mytekdev.com/try/balancingrobotlab?embed=1

Canvas, a blog, or any page that takes HTML: paste this code where you edit the page as HTML.

<iframe src="https://mytekdev.com/try/balancingrobotlab?embed=1" width="100%" height="640" style="border:0" allow="fullscreen" title="Balancing Robot Lab demo from mytekDev"></iframe>

About these notes

Balancing Robot Lab is a two-wheeled self-balancing robot in a workshop, programmed in Blocks or Python. The robot is sized from a published classroom balancing robot: a 0.6 kg body, 27 cm tall, with its center of mass 12 cm above the axle, on wheels 4 cm across, with that robot's motor numbers. Left alone it falls over in under a second, so it only stays up if the program keeps driving the wheels under it.

All fourteen levels are open. Each adds one idea a real balancing robot needs: how hard to push, how fast it is tipping, where the wheels have gone, a sensor that drifts, a slower loop, a push from the side, a load, a slope. A tilt graph with the motor power under it, a slow-motion replay of the last 3 seconds, and a tuning sheet let students see what their numbers did.

Driving the wheels toward the lean, and driving harder the further it leans, is proportional control. Adding how fast the robot is tipping is the D term of a PD controller, and the wheel terms keep it in place. Students find each of these because the level before it stops working, not because a lesson names it.

A first period

Levels 1 to 3 are meant to fit in a period, with time to talk about what the number does.

  1. Watch it fall (about 10 minutes) Open Level 1 and press the round play button or the space bar. The starter program does nothing, and the robot tips over in about 0.7 seconds. Ask the class what the program would have to do to stop it, and listen for an answer like drive the wheels toward the way it is leaning.
  2. Make it taller (about 5 minutes) Open Robot, then Configurator, make the body taller, press Done and run it again. A taller robot falls more slowly: about 1 second at 54 cm against 0.73 at 27 cm. That is why a broom is easier to balance on a hand than a pencil.
  3. Catch it (about 15 minutes) Level 2 asks for 3 seconds standing. The rule is if tilt is more than 0, drive forward; otherwise drive backward. It works, and the tilt graph shows it chattering. Ask why it never settles.
  4. Turn one number (about 15 minutes) Level 3 asks for 10 seconds. Students drive at tilt times a number and change the number. A very small one falls, the middle range stands, and a very large one shakes and falls again. Ask them to find the smallest and the biggest number that still pass.

The levels

Each level opens with a mission box that says what to do. The lines under it say what the robot is doing as it runs, and the result says what happened and what to try next.

LevelThe jobWhat it is built to show
1. Watch it fallRun the starter at two heights and compareUnstable on its own; a taller robot falls more slowly
2. Drive toward the fallStand for 3 secondsAn if and else in a loop works, and it chatters
3. As hard as it leansStand for 10 secondsProportional control: too small falls, a big number holds, too big falls again
4. Tilt speedCaught from 8 degrees, stand 15 seconds, calmlyThe tilt speed (the D term) calms what the tilt alone cannot
5. Stay on the matStand 30 seconds within 10 cm of the crossThe wheel speed and distance hold it in place
6. The gyro gives speedStand 30 seconds, no perfect tilt sensorA gyro gives a rate with an error; adding it up drifts unless it is calibrated
7. How oftenStand 15 seconds with a loop every 50 msA slower loop needs gentler numbers
8. Lean to goDrive to a line 1 m ahead and stop on itTo go, it must lean; to lean, it rolls back first
9. TurnTurn a quarter turn left and holdSteering on top of balancing
10. The push testCatch three of five taps, each harderSaturation: the biggest lean the motors can catch
11. Carry a loadA 400 g box, 3 cm forward, 30 seconds calmlyThe balance point moves with the load
12. Ramps and a slippery floorUp, down and across a slippery patch to a finish lineLeaning into a slope; grip caps the push
13. The deliveryA cup of water over a ramp and a bump and round a corner, under 40 secondsAll of it, with a spill limit
14. Your courseA course the student buildsTesting a controller on a course of their own

In Python a program starts with from balancer import Robot and robot = Robot(). It reads robot.tilt() in Levels 1 to 5, robot.tilt_speed() in Levels 4 and 5, robot.gyro() and robot.accel_tilt() from Level 6, and robot.distance(), robot.wheel_speed() and, from Level 8, robot.speed(). It acts with robot.drive(percent), robot.steer(percent) from Level 9, robot.stop() and robot.wait(seconds). Blocks make the same calls, and Start from my blocks turns them into the Python.

What students get wrong, and where the app answers it

What students thinkWhere the app answers it
A balancing robot holds stillLevel 2: it never settles. Its tilt graph chatters back and forth, and even a good controller is making constant small corrections.
A taller robot is harder to balanceLevel 1: it falls more slowly, so it is easier to catch. The configurator shows it with numbers.
A bigger gain is always betterLevel 3: tilt times 10 falls in about 1.5 seconds, numbers from 80 to 200 stand, and a very large one such as 250 or 400 falls again after about 8 seconds.
The lean is all the program needsLevel 4: from 8 degrees the lean alone can only just stand, rocking over a degree. Adding the tilt speed calms it to a few hundredths.
If the robot is upright it stays where it isLevel 5: catching a lean rolls the robot away. The wheel terms bring it back, and to roll back it must first lean back.
A sensor that reads zero means uprightLevel 6: a gyro is wrong by a few degrees a second even at rest. Added up for a minute, 5 degrees a second is 300 degrees. Level 11: a load moves the balance point, so zero is no longer upright.
A faster loop never mattersLevel 7: with a pass every 50 ms each push lasts five times as long, and the numbers that worked now overshoot.
Motors that are strong enough can catch anythingLevel 10: the first taps are caught. At the fourth the power graph sits at 100 percent and the lean keeps growing.
Motor power is wattsIn the app it is the share of the battery's voltage the motor gets, as robot kits say it, so mostly it sets how fast the wheel turns.

Students' own 3D models

In a saved project, Robot, then Models, lets a student put a 3D model from their Files (a .glb file, or one from the platform library) in the room, up to three, or on the robot. On the robot at 0 grams it is a decoration.

Give it a weight and it is a real load: it moves the balance point, and the program may need new numbers, as in Level 11. In Levels 11 and 13 the level's own load is the weight, and the model takes the place of the box or the cup. A model has to be light enough to draw quickly, under 40,000 triangles, and other people see it only if the file is shared.

What the app simplifies, on purpose

Setting it up for a class

No setup is needed. With free accounts, each student's levels, best runs, build, programs and models save as one project. Typed words in a shared project, its name, the robot's name and the program, pass the platform's filter.

Big screen takes the app full screen for a projector. Slower and Speed up change how fast time runs; a program's wait is robot time at any speed. The Slow-motion replay button, or the R key, shows the last 3 seconds at an eighth of the speed, and Tuning sheet under File keeps the build and each level's result in one place.

Standards

Middle school keeps the formulas out: the story is the graph and the number. High school can add the pendulum model, the motor equation and the role of each term of a PD controller.

More help

Is something on this page wrong or not clear? Write to us.

Page last reviewed November 2026.
Google, Google Classroom and Chromebook are trademarks of Google LLC.