Skip to content

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., your practice guide

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 Tool

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

Tier 1 · Web · No account

Version tested: Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09. Date: 2026-09-09.

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.

diagram.json

1,440 bytes · Circuit connections

Download

sketch.ino

2,429 bytes · ESP32 program

Download

  1. Use the launch button above to open the ESP32 editor in Wokwi.
  2. Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
  3. Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.

Steps

Screens captured against Wokwi ESP32 Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09 on 2026-09-09; the tool may have moved on — the text steps are the contract.

  1. 1 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: Three servo signal paths and the shared 5 V and ground rails are visible. The ring marks the three servos and their common power boundary.
    Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  2. 2 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: The interpolation loop writes all three target angles in 20 ms steps. The ring marks moveToPosition.
    Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  3. 3 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: Position base=90 arm=90 gripper=90 Commands: h=home, g=grab, r=release, s=sequence The ring marks the home position and command menu.
    Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  4. 4 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: Sequence: grab Position base=90 arm=45 gripper=90 Position base=90 arm=45 gripper=45 Position base=90 arm=90 gripper=45 The ring marks the ordered grab positions.
    Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  5. 5 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: Sequence: release Position base=90 arm=45 gripper=45 Position base=90 arm=45 gripper=90 Position base=90 arm=90 gripper=90 The ring marks the ordered release positions.
    Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  6. 6 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: Sequence: pick-and-place Position base=45 arm=45 gripper=90 Position base=45 arm=45 gripper=45 Position base=135 arm=45 gripper=45 Position base=135 arm=45 gripper=90 Position base=90 arm=90 gripper=90 The ring marks the pickup, placement, and return positions.
    Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  7. 7 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: Position base=90 arm=90 gripper=90 The ring marks the final explicit home position.
    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.

  1. 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 check
  2. Why does the smooth motion interpolation function use an ease-in-out curve rather than moving at constant speed?

    Return to the chapter’s knowledge check
  3. A 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

Caution

The Wokwi 5 V symbol represents the legacy lab's separate regulated servo supply. On hardware, never power three servos from the ESP32 rail; size the external supply for stall current, join grounds, centre each servo before attaching linkages, and enforce mechanical travel limits.

Return to Servo Motors: Calibration and Applications · Browse Labs