Coordinate a three-servo gripper sequence
Command home, grab, release, and pick-and-place motion while checking each servo's angle and the shared power boundary.

Motor Max: I want you to verify the power boundary and every commanded angle before trusting the gripper under load.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolCommand home, grab, release, and pick-and-place motion while checking each servo's angle and the shared power boundary.
Open the ESP32 editor, paste diagram.json, then paste sketch.ino.
Open Wokwi to paste in the files (new tab)Get the files
Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
Step 1
- Do
- Paste diagram.json and sketch.ino into a new Wokwi ESP32 project, then inspect the three signal paths and common ground before starting.
- You will see
- Base, arm, and gripper signals connect to GPIO18, GPIO19, and GPIO21; all three servo grounds join the ESP32 ground.
- Why it matters
- The host chapter treats the command, electrical supply, and mechanics as separate servo-loop responsibilities.

Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- Inspect moveToPosition and identify how the duration becomes 20 ms interpolation steps.
- You will see
- The function calculates at least one step, advances p from 0 to 1, and writes all three servo angles on every pass.
- Why it matters
- Gradual coordinated commands reduce abrupt motion and make angle limits easier to review than a single jump.

Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Start the simulation and open Serial Monitor at 115200 baud.
- You will see
- Position base=90 arm=90 gripper=90 appears, followed by the h, g, r, and s command menu.
- Why it matters
- A known home position gives every later sequence a reproducible starting state.

Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Send g followed by Enter and wait for the grab sequence to finish.
- You will see
- The arm lowers to 45 degrees, the gripper closes to 45 degrees, and the arm returns to 90 degrees while holding that grip.
- Why it matters
- The sequence separates approach, grip, and lift so each mechanical action has an observable command.

Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- Send r followed by Enter and wait for the release sequence.
- You will see
- The arm lowers with the gripper at 45 degrees, opens the gripper to 90 degrees, and returns all axes home.
- Why it matters
- Reversing the grip action confirms that interpolation reaches the intended endpoints in a safe order.

Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- Send s followed by Enter and watch the base angles through the complete pick-and-place sequence.
- You will see
- The base moves from 45 degrees at pickup to 135 degrees at placement, then all three servos return to 90 degrees.
- Why it matters
- A coordinated multi-axis path demonstrates why timing, travel limits, and power margin must be reviewed together.

Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- Send h and confirm the final reported position before stopping the simulation.
- You will see
- Position base=90 arm=90 gripper=90 confirms the explicit home command.
- Why it matters
- Returning to a documented neutral state makes the lab repeatable and gives a clear recovery action after an interrupted sequence.

Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A standard hobby servo receives a 1.5ms pulse at 50 Hz. What position will the servo move to?
Return to the chapter’s knowledge checkWhy does the smooth motion interpolation function use an ease-in-out curve rather than moving at constant speed?
Return to the chapter’s knowledge checkA high-torque servo has a stall current of 2.5A. If you are building a 3-servo robotic arm, what minimum power supply current rating do you need?
Return to the chapter’s knowledge check
Return to Servo Motors: Calibration and Applications · Browse Labs