Calibration Process

System Calibration Process Estimated Time: 1-2 hours | Importance: ★★★★★ ⚠️ Why Calibration? Calibration ensures robot's actual movement matches software commands, directly affecting positioning accuracy and system reliability. 1. Mechanical Calibration 1.1 Arm Length Measurement Use digital caliper

System Calibration Process

        Estimated Time: 1-2 hours | Importance: ★★★★★

            **⚠️ Why Calibration?**
            Calibration ensures robot's actual movement matches software commands, directly affecting positioning accuracy and system reliability.

1. Mechanical Calibration

1.1 Arm Length Measurement

            Use digital calipers to precisely measure arm lengths (ball joint center distance):

                ![Arm Measurement](./images/calibration-arm-measurement.jpg)
                Measuring arm length with calipers
Parameter Standard Value Measured Value Config File
Upper Arm Length (L) 150 mm ______ mm robotGeometry.cpp
Lower Arm Length (l) 281 mm ______ mm robotGeometry.cpp
End Effector Offset 50 mm ______ mm config.h

1.2 Modify Configuration File

            Update actual measured values in `esp32/robotGeometry.cpp`:
// File: esp32/robotGeometry.cpp (line ~10)
float L = 150.0;   // Upper arm length (change to measured value)
float l = 281.0;   // Lower arm length (change to measured value)

// File: esp32/config.h (line ~15)
#define END_EFFECTOR_OFFSET 50.0  // End effector offset
                **Tip:** After modification, re-upload firmware to ESP32.

2. Homing Calibration

2.1 Limit Switch Test

            If using limit switches, ensure proper installation and testing:

                ![Homing Process](./images/calibration-homing.jpg)
                Homing position diagram
  • Manually move robot arm to limit switch position

  • Observe if limit switch indicator LED triggers

  • Send G28 via serial to test auto-homing

2.2 HOME_STEPS Adjustment

            If no limit switches, manually set homing step count:
// File: esp32/config.h
#define X_HOME_STEPS 0   // Steps from X endstop to initial position
#define Y_HOME_STEPS 0   // Steps from Y endstop to initial position
#define Z_HOME_STEPS 0   // Steps from Z endstop to initial position

// Adjustment method:
// 1. Manually move arm to highest point
// 2. Record step count at this position
// 3. Set as HOME_STEPS

2.3 Verify Homing

# Send homing command
G28

# Observe:
# - 3 motors should rotate synchronously
# - End effector rises to highest point
# - Stops upon reaching position
                **✅ Homing Success Indicators:**
  • End effector position consistent after each homing

  • After homing, sending G0 X0 Y0 Z-200 accurately reaches center

3. Vision Calibration

3.1 Camera Mounting

                **Important:** Once camera position is fixed, do not move! Moving requires recalibration.

            Recommended camera position:
  • Height: 400-500mm above robot base

  • Angle: Straight down (or slight tilt)

  • Field of view: Cover entire workspace (Ø200mm)

3.2 Checkerboard Calibration (Optional)

            Use OpenCV checkerboard calibration method to correct camera distortion:

                ![Checkerboard Calibration](./images/calibration-checkerboard.jpg)
                Checkerboard calibration process
# Run calibration program (if included in project)
python calibrate_camera.py

# Follow prompts to capture checkerboard from different angles
# Generates camera_matrix.npy and dist_coeffs.npy

3.3 Pixel-to-Millimeter Mapping

            Establish mapping between pixel coordinates and robot arm coordinates:

                ![Coordinate Mapping](./images/calibration-coordinate-mapping.jpg)
                Coordinate mapping diagram
# Mapping method:
# 1. Mark known physical coordinate points on workspace (e.g., 4 corners)
# 2. Record pixel coordinates of these points in image
# 3. Use perspective transform matrix to establish mapping

# Example code (Python):
import cv2
import numpy as np

# Image coordinates (pixels)
pts_src = np.array([[100, 100], [540, 100], [540, 380], [100, 380]])

# Physical coordinates (millimeters)
pts_dst = np.array([[-100, 100], [100, 100], [100, -100], [-100, -100]])

# Calculate perspective transform matrix
h, status = cv2.findHomography(pts_src, pts_dst)

# Save matrix
np.save('homography_matrix.npy', h)

3.4 Mapping Accuracy Verification

  • Place object at known position on workspace (e.g., X=50, Y=0)

  • Identify object coordinates via vision system

  • Compare identified vs. actual coordinates, error should be

4. Precision Testing

4.1 Repeatability Test

            Test robot arm's consistency reaching same position multiple times:
# Test script
for i in range(10):
    send_gcode("G28")          # Home
    send_gcode("G0 X0 Y0 Z-200")  # Move to test point
    time.sleep(1)
    # Manually measure actual position, record deviation

# Target accuracy: ±0.5mm

4.2 Workspace Boundary Verification

            Test if workspace boundaries match theoretical values:
# Test boundary points
G0 X100 Y0 Z-200
G0 X-100 Y0 Z-200
G0 X0 Y100 Z-200
G0 X0 Y-100 Z-200

# Check if reachable, if exceeds limits

4.3 Precision Evaluation Standards

Test Item Target Accuracy Test Result
Repeatability ±0.5 mm ______ mm
Absolute Accuracy ±1.0 mm ______ mm
Vision Coordinate Error
✅ Calibration Complete!
If all tests pass, system is ready.
                [→ Continue: Programming Tutorial](./programming.html)

Last updated 8 Aug 2026