๐Ÿงฑ BrickBot Regression Lab

The companion tool for your Small / Medium / Large robot build โ€” works fully offline, no internet needed.

1How to use this page

  1. Build your Small, Medium, and Large robots first. Count the bricks in each.
  2. Enter your brick counts and times/loads in Step 2 โ€” optionally connect a LEGO hub over Bluetooth there to auto-record motor time with Start/Stop buttons, or just use a regular stopwatch.
  3. In Step 3, write down your own guess for an Extra-Large robot โ€” before you build it and before you press any buttons.
  4. Press "Let the computer find the line" in Step 4 to see the real regression line calculated from your data. Compare it to your guess.
  5. Build your Extra-Large robot for real, enter its actual numbers, and see who was closer โ€” you or the computer.
  6. Then build the Trick Bot (same height as Medium, but hidden extra bricks inside). Turn it on in Step 5 and watch the line move.
Your data stays only on this device โ€” nothing is sent anywhere. It's saved automatically so you can close and reopen the page without losing your work.

2Log your robots

What does "motor time for 5 spins" mean? (click to see how to measure it)

It's how many seconds it takes your robot's motorized arm to spin all the way around 5 times. Bigger robots usually have heavier arms, so the same motor takes longer to push them around โ€” this gives you a second number (besides brick count) that should also change with robot size.

But this only works with certain motors โ€” check yours first. There are two kinds:

  • Simple power motors (basic Technic or WeDo motors): you set a power percentage, not a speed. A heavier arm resists more, so the same power setting spins it slower. Spin time genuinely reflects the robot's size.
  • Smart speed-controlled motors (SPIKE Prime, Mindstorms Robot Inventor): these have a built-in sensor that automatically adds more power to fight resistance and hold a steady target speed. Spin time will stay nearly the same on every robot no matter how heavy the arm is โ€” the motor is compensating, and the number stops meaning anything.
60-second pre-check: spin the same motor at the same setting once with an empty arm, then once with a heavy load on the arm. If the time changes noticeably, you have a simple motor โ€” spin time will work great. If the time barely changes, you have a smart motor โ€” switch to the alternative metric below instead.

Alternative metric โ€” "load until stall": if your motor compensates for speed, instead measure how many extra bricks you can hang on the arm before the motor can't hold the target speed anymore and stalls out. That forces the motor past its compensation limit, so the number reflects the robot's real strength/weight again. Pick which metric you're using below โ€” it changes the labels for you.

Optional: connect over Bluetooth to auto-record the time

Connect directly to a LEGO Education Single Motor (from the Computer Science & AI kits) over Bluetooth, then use Start/Stop below to time a motor run automatically โ€” no stopwatch needed. This also works great for the pre-check test above, and it can even auto-detect the exact moment the motor stalls.

Before you try it: this needs Chrome or Edge on a laptop or desktop (not a phone, not Safari), Bluetooth turned on, and this page loaded over https:// or from localhost โ€” opening the file directly (file://) will usually block Bluetooth for security reasons. If the button below does nothing, try running a simple local server (ask a teacher/adult, or search "how to open a local file with a local server") and open the page that way instead. Make sure your Single Motor is charged, powered on, and broadcasting. This connects using the same open protocol as LEGO's own LEGO Education Python API.

Auto-record a run

Elapsed time
0.0 sec

3Your guess for the Extra-Large robot

Before pressing any buttons โ€” look at your three dots and guess. What do you think the brick count and motor time will be?

Your guess
Actual (after you build it)

4Plot it and let the computer find the line

Your robots Extra-Large (actual) Trick Bot

5Break the line with the Trick Bot

Build a robot the exact same height as your Medium robot, but hide extra bricks inside it (or make it hollow). Log it here, then flip the switch below and press "Let the computer find the line" again.

Trick Bot
What just happened? (read after your class discussion)

The computer used regression โ€” the same thing you did by eye, but calculated precisely โ€” to draw the line that best fits all your data points. That's what "training" an AI often means: finding the line (or curve) that makes the smallest total error across every example it's shown.

When you added the Trick Bot, the line shifted โ€” sometimes a lot from just one weird example. That's exactly how real AI models can get fooled: they assume new cases will follow the same pattern as their training examples. When something breaks that assumption โ€” like a house that doesn't look like the houses a pricing model was trained on โ€” the prediction can be way off with total confidence.