sheen.bot logo

Insights

Teaching PID Control to High School Robotics Teams Without Using Calculus

Sep 5, 2026·Sheen Robotics
Teaching PID Control to High School Robotics Teams Without Using Calculus

You do not need differential equations to teach PID control; you only need three intuitive ideas: how far you are from the target, how long you have been missing it, and how fast you are approaching it.

You do not need calculus to teach PID control to high schoolers. A PID controller is simply a formula that decides how hard a motor should push based on three intuitive questions: How far off are we right now? How long have we been stuck off-target? And how fast are we closing in?

When FIRST Tech Challenge (FTC) teams or high school robotics students encounter PID control in documentation, they are often confronted with integral and derivative symbols that alienate anyone who has not completed high school advanced mathematics. In practice, code running on a robot does not solve continuous differential equations. It performs basic arithmetic once every few milliseconds. Once students understand the physical jobs of P, I, and D, they can write, tune, and debug control loops reliably.

The Core Idea: Error

Every control loop exists to minimise one number: error.

Error is simply Target - Current Position. If a robot arm is at 20 degrees and needs to be at 90 degrees, the error is +70. If a flywheel needs to spin at 2,000 RPM but is spinning at 2,100 RPM, the error is -100. Every term in PID takes this error value and converts it into motor power.

1. Proportional (P): The Present

The Proportional term acts like a simple rubber band. The further you are from your target, the harder it pulls.

If you are driving a car and drift five metres left of your lane centre, you make a large steering correction right. If you are only two centimetres off, you make a tiny twitch. Mathematically in code, this is simply kP * error.

Where P fails on its own:

  • Overshoot and oscillation: If kP is too high, the robot accelerates so aggressively toward the target that momentum carries it past the mark. It then pulls hard in reverse, overshoots again, and oscillates violently.
  • Steady-state error: If kP is too low, the motor power becomes so small as the error shrinks that it cannot overcome physical friction or gravity. An elevator mechanism lifting a 500-gram claw will simply stop a few centimetres below the target because the motor power matches gravity and stalls there.

2. Derivative (D): The Future (The Brakes)

The Derivative term looks at how fast the error is changing from one loop cycle to the next. Its job is to act like a shock absorber or brake.

Consider parking a car in a garage. If the wall is ten metres away, you press the accelerator. But if you see the wall approaching rapidly, you do not wait until the bumper is one centimetre from the brick to hit the brakes—you brake based on your approach speed.

In code, derivative = (current_error - previous_error) / time_elapsed. When the robot is rushing toward its target, the error is decreasing rapidly, which makes the derivative term negative, subtracting power from the motor before it overshoots. D dampens oscillations and allows you to use a higher P gain without shaking the robot apart.

3. Integral (I): The Past (The Memory)

The Integral term tallies up persistent error over time. If a robot has been sitting slightly off target for several seconds, the integral sum grows until it gives the motors enough extra shove to overcome friction or gravity.

Imagine pushing a trolley up an incline. You push (P), but gravity stops you just short of the crest. If you stand there for five seconds unable to reach the top, the Integral term essentially says, "We have been stuck here too long; add more power until we clear the ridge."

The catch: Integral is dangerous if mismanaged. If an arm gets physically jammed, the integral sum will blow up to infinity (a phenomenon called "integral windup"). When the jam clears, the motor will violently slam into the hard stops. In FTC and school robotics, Integral should be capped with an accumulator limit, or used only within a tight error window.

A 4-Step Tuning Routine for the Workshop

Do not guess all three numbers at once. Have your students follow a repeatable tuning sequence on a fully charged battery (voltage changes alter motor response):

StepActionTarget BehaviourSigns It Is Wrong
1. Set all gains to 0kP = 0, kI = 0, kD = 0Motors do nothing.
2. Increase kPRaise kP incrementally until the mechanism reaches the target quickly.Reaches target with a small, consistent bounce or oscillation around the setpoint.Violent shaking means kP is too high; failing to move means it is too low.
3. Add kDGradually increase kD until the bounce is eliminated.Mechanism snaps quickly into position and stops cleanly without oscillating.High-frequency chattering or buzzing means kD is too high (amplifying sensor noise).
4. Add kI (Only if needed)Add a very small kI if the mechanism stops 1–2 mm short of the target due to friction.Final steady-state resting error drops to zero.Slow, wave-like oscillation (hunting) means kI is too high.

Common Gotchas in Student Robots

  • Sensor Noise: Optical encoders on FTC drivetrains are generally clean, but loose mechanical backlash will confuse the derivative term. If the gearbox has play, D will react to mechanical slop rather than real motion.
  • Loop Time Variability: If your team's code is running background vision processing on a single thread, the loop time may jump from 10ms to 80ms unpredictably, ruining standard PID calculations. Keep control loops isolated and lean.
  • Flywheels vs Arms: Velocity control (flywheels) behaves differently from position control (arms). Velocity loops rarely need D because the system momentum already acts as a low-pass filter; they thrive on a baseline feedforward term (kV) plus a modest P and I.

For teams building toward regional competitions, mastering closed-loop control is what separates erratic mechanisms from autonomous routines that score consistently every match. If your team is preparing for the local competition circuit and wants structured technical guidance on drivetrain kinematics and sensor integration, explore our FTC robotics programmes for hands-on coaching frameworks.

#robotics#ftc#stem education#coding#control systems

More Insights