High School / HS-13

Self-Balancing Robot

Available Grades 9–12 Robotics & controls

Build a two-wheeled inverted-pendulum robot, fuse gyro and accelerometer data, and tune a controller that keeps it upright.

Overview & learning outcomes

Students build a two-wheeled inverted-pendulum robot (ESP32, LSM6DSOX IMU, two encoder gearmotors), measure its centre of mass and fall time, fuse gyro and accelerometer data with a complementary filter, tune a PID controller by experiment, then design an LQR state-feedback controller from a state-space model built from their own measurements.

Students will:

  • Model the robot as an inverted pendulum and explain why it is unstable without feedback
  • Fuse gyro and accelerometer data with a complementary filter and compare it with each sensor alone
  • Tune a PID controller and observe the effects of motor saturation and loop timing
  • Log tilt angle and motor command to evaluate each tuning iteration

Every high school pack includes worked math and physics, prediction-versus-measurement labs, at least two design-and-test iterations, data logging, a rubric, and documentation templates, plus printable Builder's Corner build journal pages.

Bill of materials & where to buy

Parts, specs, quantities, and estimated unit costs, with places to buy. Prices change; anything marked as an estimate is an estimate. Links were checked when the BOM was written.

Estimated kit cost

  • A. Control, sensing and drive (per robot): $173.75 typical · $152.35 low-cost path
  • B. Structure (per robot): $20.50 typical · $16.50 low-cost path
  • C. Tools and safety (once per school): $124.09 typical · $15.59 low-cost path
  • Everything from zero: $318.34 typical · $184.44 low-cost path (low-cost path uses listed substitutes and assumes a school or makerspace already owns reusable tools)

Totals are computed from the line items below. Prices were read from vendor pages on the dates shown and will change. Rows tagged estimate have no verified link and are planning numbers only.

A. Control, sensing and drive (per robot)

IDPart & specQtyUnit (typical)Line (typical)Where to buyCheaper substituteAdult handling / safety gear
E1ESP32 Feather V2 (controller)
Adafruit PID 5400 · 200 Hz control loop; Wi-Fi/Bluetooth off in firmware
1$19.95$19.95adafruit.com
Adafruit
$19.95 · checked 2026-10-09 · In stock
Adafruit HUZZAH32 Feather (PID 3405); re-map pinsHeader soldering: adult supervision, Z87+ glasses, ventilation
E2LSM6DSOX 6-DoF accelerometer + gyroscope
Adafruit PID 4438 · STEMMA QT, I²C 0x6A; firmware ±4 g, ±500 dps, 416 Hz
1$11.95$11.95adafruit.com
Adafruit
$11.95 · checked 2026-10-09 · In stock
——
E3STEMMA QT / Qwiic cable 100 mm
Adafruit PID 4210
1$0.95$0.95adafruit.com
Adafruit
$0.95 · checked 2026-10-09 · In stock
——
E4TB6612 dual motor driver breakout
Adafruit PID 2448 · 1.2 A average / 3.2 A peak per channel (Toshiba datasheet); motor stall is 1.5 A at 6 V, so the firmware limits current to 1.0 A and disarms on a 1 s stall
1$6.95$6.95adafruit.com
Adafruit
$6.95 · checked 2026-10-09 · In stock
— (a DRV8833 is also 1.2 A continuous: no gain; keep the TB6612)—
E5Micro metal gearmotor 30:1 HPCB 6 V, extended motor shaft
Pololu #3072 · page: 6 V: 1100 RPM, 150 mA free; 0.45 kg⋅cm, 1.5 A stall; 3 mm D output shaft
2$27.45$54.90pololu.com
Pololu
$27.45 (qty 1) · checked 2026-10-09 · In stock
Without encoders (#3061-type, no extended shaft) only with the PID controller and no position hold—
E6Magnetic encoder pair kit, 12 CPR, 2.7–18 V
Pololu #3081 · solder-pad version (no cables needed); needs the extended shaft
1$9.95$9.95pololu.com
Pololu
$9.95 · checked 2026-10-09 · In stock
Side-entry kit #4761 ($8.95) + two #4762 JST cables ($2.10 each)Fine soldering: adult supervision
E7Micro metal gearmotor bracket pair
Pololu #989
1$2.95$2.95pololu.com
Pololu
$2.95 · checked 2026-10-09 · In stock
——
E8Wheels 80 × 10 mm, pair
Pololu #1430 · page: 80 mm diameter, press-fit on 3 mm D shafts
1$8.75$8.75pololu.com
Pololu
$8.75 · checked 2026-10-09 · In stock
——
E95 V 500 mA step-down regulator D24V5F5
Pololu #2843 · battery → Schottky (E9a) → Feather USB pin
1$8.95$8.95pololu.com
Pololu
$8.95 · checked 2026-10-09 · In stock
——
E9aSchottky diode 1N5819 (1 A, 40 V)
SparkFun COM-10926 · between the D24V5F5 VOUT and the Feather USB pin, band toward the Feather: stops laptop USB back-feeding the regulator and the motor rail, and stops the regulator driving the laptop's VBUS
1$0.30$0.30sparkfun.com
SparkFun
$0.30 · checked 2026-10-09 · Stock not confirmed on page
1N5817 (same footprint, lower drop)—
E106 × AA battery holder with 2.1 mm plug
Adafruit PID 248
1$2.50$2.50adafruit.com
Adafruit
$2.50 · checked 2026-10-09 · In stock
——
E11In-line power switch for 2.1 mm barrel jack
Adafruit PID 1125 · the robot's main switch
1$2.50$2.50adafruit.com
Adafruit
$2.50 · checked 2026-10-09 · In stock
——
E122.1 mm DC jack to screw terminal
Adafruit PID 368
1$2.00$2.00adafruit.com
Adafruit
$2.00 · checked 2026-10-09 · In stock
——
E13AA NiMH rechargeable cells (6 + 2 spare)
7.2 V nominal pack; low internal resistance for motor current
1$18.00 estimate$18.00Retail (no link)
—
6 × alkaline AA (≈ 9 V fresh: the firmware's 6 V cap still protects the motors; shorter run time)Charge only in the matching NiMH charger
E14Electrolytic capacitor 1000 µF 25 V
SparkFun COM-08982 · across the TB6612 motor supply (VM–GND)
1$0.50$0.50sparkfun.com
SparkFun
$0.50 · checked 2026-10-09 · In stock
470–2200 µF, ≥ 16 VObserve polarity
E15Resistors 33 kΩ + 10 kΩ (battery divider)
Any 1/4 W
1$0.50 estimate$0.50School stock (no link)
—
——
E16Stacking headers for Feather
Adafruit PID 2830
1$1.25$1.25adafruit.com
Adafruit
$1.25 · checked 2026-10-09 · In stock
Plain headers—
E17Hook-up wire 22 AWG solid (6 × 25 ft)
Adafruit PID 1311
1$15.95$15.95adafruit.com
Adafruit
$15.95 · checked 2026-10-09 · In stock
Classroom stock—
E18USB-A to USB-C data cable
Adafruit PID 4474
1$4.95$4.95adafruit.com
Adafruit
$4.95 · checked 2026-10-09 · In stock
Classroom cable—
Subtotal$173.75Low-cost path: $152.35

B. Structure (per robot)

IDPart & specQtyUnit (typical)Line (typical)Where to buyCheaper substituteAdult handling / safety gear
S1Baltic birch plywood 3 mm, 12 × 20 in
Wood Vault, 1/8" Laser/CNC grade variant; 1 sheet (4 decks, 2 skids, 2 chocks, tilt gauge)
1$3.50$3.50woodvault.com
The Wood Vault
$3.50 per sheet (1/8" Laser/CNC grade variant) · checked 2026-10-09 · Not confirmed (variant availability not in page HTML)
Any 3 mm laser plywood (slots are 3.2 mm)—
S2M3 threaded rod 4 × 300 mm (cut from 1 m), 32 M3 nuts, 16 washers; M2 screws for the brackets; M3 bolt + nuts as top-deck ballast, 2 zip ties ≥ 200 × 3.6 mm (battery holder)
Deck spacing is adjustable on the rods (Labs 1 and 4)
1$12.00 estimate$12.00Hardware store (no link)
—
M3 nylon standoffs (fixed heights)—
S3Laser cutter access or cutting service
1 sheet (estimate)
1$5.00 estimate$5.00Makerspace / cut service (no link)
—
—Trained adult operates the laser cutter
Subtotal$20.50Low-cost path: $16.50

C. Tools and safety (once per school)

IDPart & specQtyUnit (typical)Line (typical)Where to buyCheaper substituteAdult handling / safety gear
T1Temperature-controlled soldering iron
Pinecil
1$68.50$68.50sparkfun.com
SparkFun
$68.50 · checked 2026-10-09 · Not recorded
Assumed owned in the low totalAdult supervision
T2Lead-free solder 15 g
SparkFun
1$4.95$4.95sparkfun.com
SparkFun
$4.95 (single-unit price) · checked 2026-10-09 · Not recorded
—Wash hands after soldering
T3Safety glasses, ANSI Z87.1 (Z87+) impact-rated, clear
3M SecureFit SF201AF · clear anti-fog polycarbonate lens marked Z87+ (ANSI Z87.1 impact-rated; 3M spec table on strobelssupply.com and safetycompany.com, read 2026-10-09); soldering, laser cutting, and first motor tests (spinning wheels)
2$5.32$10.64platt.com
Platt Electric Supply
$5.32 EA · checked 2026-10-09 · 40 in stock (company-wide)
Any glasses marked Z87+ (ANSI Z87.1 high-impact). Not SparkFun SWG-11046: it lists only CE/EN 1836, a sunglass standard, not impact-ratedCheck the Z87+ marking on arrival
T4NiMH smart charger (AA)
Matched to NiMH cells; charge on a non-flammable surface
1$20.00 estimate$20.00Retail (no link)
—
Assumed owned in the low totalAdult supervises charging
T5Digital multimeter
Polarity, battery voltage, divider check
1$20.00 estimate$20.00Retail (no link)
—
Assumed owned—
T6Laptop with Arduino IDE and Python 3 + numpy (+ matplotlib)
Tuning over USB serial; balance.py
1$0.00 estimate$0.00School (no link)
—
——
Subtotal$124.09Low-cost path: $15.59

The pack is digital files only. Hardware is bought separately.

Standards map

These are standards the pack's activities are mapped to by Laue Labs. They are not a certification or endorsement by any standards body or state.

Activity NGSS (HS) Practices / crosscutting Common Core Math
Lab 1 pendulum, COM, fall test HS-PS2-1 (Newton's 2nd law, rotation analogue) Developing and using models; Stability and change HSF-LE.A.1 (exponential growth), HSF-LE.B.5
Lab 2 sensor fusion HS-ETS1-2 (break a problem into smaller problems) Analyzing and interpreting data HSS-ID.A.4 (normal distribution, noise)
Lab 3 PID HS-ETS1-3 (trade-offs), HS-PS2-1 Planning and carrying out investigations HSA-CED.A.4
Lab 4 state space, LQR HS-ETS1-4 (computer simulation of a designed system) Using mathematics and computational thinking; Systems and system models HSN-VM.C.6–C.8 (matrices, enrichment)
Lab 5 limits HS-PS3-3 (energy conversion devices), HS-ETS1-3 Constructing explanations HSS-ID.B.6

Mapping is a draft for teacher review.

License options

$17 Individual

One student or one household.

You may:

  • Use, print, and modify the files for your own builds and experiments
  • Share photos and videos of your finished project

You may not:

  • Use the pack as curriculum for a class, club, camp, or co-op (see Homeschool / Co-op and Classroom)
  • Redistribute, resell, or publish the pack files
$39 Homeschool / Co-op

One homeschool family, or one co-op group of up to 10 learners with its facilitator(s).

You may:

  • Print guides and lab sheets for the learners in that family or co-op group
  • Use the facilitator notes, rubric, and pacing guide with that group

You may not:

  • Use it for a co-op group larger than 10 learners, or for a school class (see Classroom)
  • Redistribute, resell, or publish the pack files
$59 Classroom

One teacher with up to 30 students in a single class or cohort.

You may:

  • Print or project materials for those students
  • Copy code and cut files to student machines for that class

You may not:

  • Share files with other teachers or schools, or post them publicly
  • Use it as a whole-school or multi-year site license, or for more than 30 students, without contacting us

All licenses: digital files only (hardware not included). Keep Laue Labs attribution on printed handouts. After checkout you get an instant download on the thanks page. License questions, more learners, or site licenses: lance.haney@gmail.com.

Safety & legal notes

  • LiPo batteries: supervised charging on a fire-safe surface.
  • Keep fingers clear of wheels; test on the floor, not a tabletop.
  • Students should work with adult supervision for tools, soldering, batteries, and anything flagged in the BOM.