Skip to content

Class 6 · Showcase

The robot balances, stays put and drives. Today it cuts the tether and runs on its own battery, then faces the tests: a push, and a load on top. If there's time, you'll drive it from a phone.

By the end of class

Running on the power bank, the robot recovers from a push and balances while carrying a load, and your group can explain how it works in a minute.

New parts today

Part What it's for
12 V PD trigger board Gets 12 V out of the power bank for the motor driver
Stretch: HC-05 Bluetooth module Commands from a phone

Build it: cut the tether

  1. Check the trigger board first. Plug it into the power bank's USB-C port, with nothing connected to its output. Measure the output with the multimeter: it should read about 12 V, and never more than 13.5 V (the TB6612's limit). If it reads anything else, stop and ask Dr. Alvear.
  2. Switch off and unplug the wall adapter. Connect the trigger board's output to the same place the wall adapter went: + through the toggle switch to the TB6612's VM, − to the 12 V ground rail. Check the polarity.
  3. Power the Uno from the bank's second port with its USB cable.
  4. Tie the cables down on the top deck, clear of the wheels. Some power banks switch themselves off when very little current is drawn; if the Uno goes dark while the motors are off, that's why.

Battery on board

The power bank now rides on the robot, so a fall lands on it. Strap it down firmly. If the bank gets dented or hot, stop using it and tell Dr. Alvear. The power switch still cuts the motors; unplug the Uno's cable to turn off the brain.

Mission 1 · On its own

Stand the robot up on the battery. The weight on top hasn't changed since Class 3, so your gains should still work. If it's twitchier or softer than before, touch up Kp and Kd, and write down any changes. The bank may give a slightly different voltage than the wall adapter, and the motors' speed and dead zone follow the voltage. The outer loop measures real wheel speed, so it adjusts by itself.

Done when

It stands for 60 s, untethered and untouched, within about 30 cm of where you let it go.

Mission 2 · The tests

  • Push test. Give the top deck a firm poke with one finger. It should roll a little, catch itself, and come back to standing. Try harder pushes, front and back. What's the biggest push it survives?
  • Carry a load. Set something on the top deck: a full water bottle, a book. Tape it on. Does the outer loop find the new balance point? Try heavier.

Done when

It recovers from a firm one-finger push, front and back, and balances for 30 s carrying a load. Film both.

Mission 3 · Get ready to show it

Prepare a one-minute explanation for someone who's never heard of PID. Use your build log. Make sure you can answer:

  • Why can't the accelerometer or the gyro do the job alone, and what does the complementary filter do about it?
  • What does each of P, I and D do? Show the videos from Classes 3 and 4.
  • Why is the battery on top?
  • How does the robot know how fast its wheels turn, and how does it use that to stay in one place?

Done when

Your group gives the one-minute explanation to Dr. Alvear, with the robot balancing next to you.

Stretch: drive it from a phone

Tool: an HC-05 Bluetooth module

The HC-05 is a wireless serial cable. Whatever a phone sends to it comes out of its TX pin as Serial characters, and the Uno reads them with the same Serial.read() as your keyboard commands. Your f, b and s code doesn't change.

HC-05 pin → To
VCC 5V
GND GND
TXD Uno pin 0 (RX)
RXD through a voltage divider from Uno pin 1 (TX): 1 kΩ from pin 1 to RXD, 2 kΩ (or 2.2 kΩ) from RXD to GND

The divider is there because the HC-05's RXD expects about 3.3 V, and the Uno's TX puts out 5 V. You've built this divider before: 5 V × 2 ÷ (1 + 2) ≈ 3.3 V.

  • The HC-05 talks at 9600 baud out of the box, so change Serial.begin to 9600, and print less (9600 is slow).
  • Pins 0 and 1 are the same Serial the USB cable uses. Unplug the HC-05's TXD wire before you upload, or the upload will fail. Plug it back in after.
  • Pair the phone with the module (it shows up as HC-05; the PIN is usually 1234 or 0000), then send characters from a Bluetooth serial terminal app. The HC-05 uses classic Bluetooth, which Android phones can do from an app and iPhones can't. If your group only has iPhones, stick with the keyboard or the knob.

Mission 4 (stretch) · Phone remote

Wire the HC-05, pair a phone, and drive the robot forward, back and (if you did turning) left and right. Many terminal apps let you set up buttons that send one character each.

Done when

You drive the robot across the room and back from the phone, untethered.

If you finish early

  • Mount the three knobs on the top deck and give a visitor the robot to tune. Reset to your gains after.
  • Make it stand up from the floor by itself? (It can't. Why not? What would it need?)
  • Write the poster's "how it works" diagram: sensor → filter → PID → driver → motors, with the encoders feeding the outer loop.

Sign-off with Dr. Alvear

  • Untethered on the power bank, 12 V checked first
  • Push test and load test (videos)
  • One-minute explanation given
  • Credits for any code or designs you used, on your poster
  • Build log updated (photo + two sentences)