Skip to content

PID Step Response

Run the PID Step Response MicroSim Fullscreen

You can include this MicroSim on your website using the following iframe:

<iframe src="https://dmccreary.github.io/robot-arm/sims/pid-step-response/main.html"
        height="637px" width="100%" scrolling="no"></iframe>

Description

Set the gains Kp, Ki and Kd of a toy joint, switch gravity on or off, and watch the plot of its step response with the overshoot, the settling time and the final angle. Then look at five responses and choose the gain change that fixes each one. Used in Chapter 5.

The plot shows the angle of a toy joint as it moves from 0 toward a goal of 90 degrees over 8 seconds. The green band is 2 percent around the goal, and the joint has settled once it stays inside the band. The model is the toy joint from the Chapter 5 lab (armlab/joint.py): unit inertia, friction 4 and a time step of 0.01 s. Its units are made up, so the numbers are illustrative and do not describe a real servo.

Lesson Plan

Grade level: Middle school and up (age 12+). Time: 15 minutes.

  1. Predict first. The sim opens with Kp 40 and no braking, and the joint overshoots by 34.7 percent. Before you move a slider, say which gain will calm it.
  2. Explore. Change one gain at a time. Raise Kd and watch the swings die away. Switch gravity on and notice the gap below the goal. Add Ki and watch the gap close.
  3. Five scenarios. Each scenario shows a response with its gains and its three numbers. Choose the change that would fix it and press Check. You get one try for each scenario, and 4 of 5 is mastery.
  4. Read the feedback. The sim plots the response before and after the best change. If your choice was different, your change is plotted in red as well, so you can see what it would have done.
  5. Think about it. Why is "No change" sometimes the right answer?

In the scenarios, "Raise Kp" sets Kp to 40 (or doubles it), "Add Kd" adds 10, "Add Ki" adds 100, and "Lower Ki" divides Ki by 4.

Specification

The learning objective, evidence of mastery and content for this MicroSim are specified in Chapter 5: Actuators and Sensors.