A 12-servo quadruped spider robot is the pinnacle of beginner-to-intermediate Arduino robotics — four legs, three joints each, all working in coordinated gaits to produce lifelike walking motion. This project teaches inverse kinematics, servo calibration, and gait programming in a way no wheeled robot can. In this complete guide, you will learn how to design, wire, program, and tune a 12-servo quadruped using Arduino and a PCA9685 servo driver board.
Quadruped Leg Anatomy
Each leg in a quadruped robot has three degrees of freedom (DOF), controlled by three servos:
- Coxa (hip rotation): The shoulder joint. Rotates the leg forward/backward and laterally. Controls stride direction.
- Femur (hip lift): The upper leg. Lifts the leg up (swing phase) or pushes down (stance phase). Controls step height.
- Tibia (knee): The lower leg. Extends or contracts the leg reach. Controls step length and posture height.
With 4 legs × 3 servos = 12 servos total. At any moment, typically 2–3 legs are on the ground (stance) while the other 1–2 are swinging forward (swing). The transition between stance and swing across all four legs, timed in coordination, creates the walking gait.
The most common mechanical configurations are:
- Mammal-style (knees forward): Stable, natural-looking gait, good for flat terrain.
- Spider/insect-style (knees outward): Lower centre of gravity, excellent stability on rough terrain, iconic visual design.
For this project, we use the spider/insect configuration — legs spread outward from the body, giving a wide stable base.
Components and Bill of Materials
| Component | Qty | Notes |
|---|---|---|
| SG90 / MG90S servo motor | 12 | MG90S (metal gear) preferred for coxa/femur |
| Arduino Uno or Mega | 1 | Mega if adding sensor shields |
| PCA9685 16-channel servo driver | 1 | I²C, 12V tolerant, 6-port extras spare |
| 5V 5A BEC / power module | 1 | Critical — do NOT power 12 servos from Arduino 5V pin |
| 7.4V 2S LiPo battery (2200 mAh+) | 1 | Main power source |
| Servo mount / bracket kit | 12 | L-brackets or dedicated leg frames |
| Acrylic or aluminium body plate | 1 | Central chassis to mount all four legs |
Servo SG90 9g 180 Degree
Lightweight 9g servo — ideal for tibia joints where weight matters most. You need 12 units for a full quadruped build.
TowerPro SG90 180 Degree Rotation Servo Motor
Genuine TowerPro SG90 — reliable and consistent across all 12 joints for smooth, predictable quadruped leg movement.
PCA9685 Servo Driver Wiring
The Arduino Uno has only 6 hardware PWM pins — nowhere near enough for 12 servos. The PCA9685 is a dedicated 16-channel PWM driver that communicates with Arduino over I²C, freeing all Arduino pins for other uses.
I²C Wiring (PCA9685 → Arduino)
- VCC → 3.3V (logic power)
- GND → GND
- SDA → A4
- SCL → A5
- OE → GND (always enabled)
Servo Power (PCA9685 V+ pin)
Connect the PCA9685 V+ pin to the 5V output of your BEC/power module — NOT the Arduino 5V pin. Connect the BEC GND to Arduino GND (common ground). The BEC takes 7.4V from the LiPo and converts it to stable 5V at up to 5A, easily supplying all 12 servos even under full load.
Servo Channel Numbering
// Channel assignment (example for 4-leg spider)
// Front-Left: Coxa=0, Femur=1, Tibia=2
// Front-Right: Coxa=3, Femur=4, Tibia=5
// Rear-Left: Coxa=6, Femur=7, Tibia=8
// Rear-Right: Coxa=9, Femur=10, Tibia=11
Label your servo channels clearly and be consistent — mixing up channels during calibration is the most common frustration in quadruped builds.
Servo Mount Holder Bracket for SG90/MG90 (Pack of 2)
Metal servo brackets for precise joint construction — get 6 packs for all 12 servo mounting positions on your quadruped.
Servo Calibration
Before running any gait, every servo must be calibrated to its physical zero position. This process is critical — a 5° offset in the coxa joint means the robot walks in circles; a 10° offset in the femur means the robot leans dangerously to one side.
Calibration Procedure
- Write a calibration sketch that sends each servo to 90° (centre position) using the Adafruit PCA9685 library:
pwm.setPWM(channel, 0, 307)(307 ≈ 90° for standard servos at 50 Hz, 12-bit resolution). - With the servo powered at 90°, physically attach the servo horn (arm) so it is perfectly perpendicular to the joint axis.
- Attach the leg segment. The leg should now be at its mechanical neutral position.
- Repeat for all 12 servos.
- Note the PWM tick value for each servo’s 0° and 180° positions (varies slightly between servo units) — use these to create per-servo mapping functions.
After calibration, verify the standing pose: send all femurs to 90° (horizontal), all tibias to 90° (pointing down), all coxas to 90° (pointing straight). The robot should stand level with all four feet on the ground, body parallel to the surface.
Inverse Kinematics Basics
Inverse kinematics (IK) is the process of calculating what joint angles produce a desired foot position (X, Y, Z coordinates). This is the opposite of forward kinematics (which calculates foot position from joint angles).
For a 3-DOF leg (coxa, femur, tibia), the IK equations are:
// Leg segment lengths in mm
float L1 = 27; // coxa length
float L2 = 52; // femur length
float L3 = 73; // tibia length
void legIK(float x, float y, float z,
float &coxaAngle, float &femurAngle, float &tibiaAngle) {
// Coxa angle: rotation in horizontal plane
coxaAngle = atan2(y, x) * RAD_TO_DEG;
// Distance from coxa pivot to foot in XY plane minus coxa length
float L = sqrt(x*x + y*y) - L1;
// 2D IK for femur and tibia in the vertical plane
float H = sqrt(L*L + z*z);
float alpha = atan2(z, L) * RAD_TO_DEG;
float beta = acos(constrain((L2*L2 + H*H - L3*L3) / (2*L2*H), -1, 1)) * RAD_TO_DEG;
femurAngle = alpha + beta;
float gamma = acos(constrain((L2*L2 + L3*L3 - H*H) / (2*L2*L3), -1, 1)) * RAD_TO_DEG;
tibiaAngle = gamma - 90; // offset for neutral position convention
}
IK liberates you from manually programming every joint angle. You simply specify where you want the foot to go in 3D space, and the IK function calculates the three servo angles automatically. This makes gait programming much more intuitive.
Gait Patterns: Trot, Crawl, Ripple
A gait defines the sequence and timing of leg movements. Three common quadruped gaits, from slowest/most stable to fastest:
Crawl Gait (static stability, 1 leg moving at a time)
Only one leg swings at a time. The centre of gravity stays within the support polygon of the three stance legs — extremely stable, works on rough terrain, but slow. Sequence: FL → RR → FR → RL (diagonal pairs staggered).
Trot Gait (diagonal pairs, 2 legs swinging simultaneously)
Two diagonal legs swing at the same time (e.g., Front-Left + Rear-Right, then Front-Right + Rear-Left). Faster than crawl. Requires dynamic balance — the robot is momentarily supported on only two legs. This is the most commonly implemented gait for hobby quadrupeds.
// Simplified trot gait (two phases)
void trotStep(float stepX, float stepHeight) {
// Phase 1: FL and RR swing forward, FR and RL push back
swingLeg(FL, stepX, stepHeight);
swingLeg(RR, stepX, stepHeight);
stanceLeg(FR, -stepX);
stanceLeg(RL, -stepX);
delay(STEP_TIME);
// Phase 2: vice versa
stanceLeg(FL, -stepX);
stanceLeg(RR, -stepX);
swingLeg(FR, stepX, stepHeight);
swingLeg(RL, stepX, stepHeight);
delay(STEP_TIME);
}
Ripple Gait (3 legs on ground, smooth wave)
Legs lift one at a time in a wave pattern. Three legs are always on the ground, providing maximum stability. The wave travels from back to front on each side. This produces the smoothest motion but is the most complex to program.
Power Supply for 12 Servos
This is the most overlooked and most critical aspect of quadruped builds. SG90 servos draw up to 500 mA each under load. With 12 servos, peak current demand can reach 6A at 5V. The Arduino’s onboard 5V regulator is rated at 800 mA total — using it for servos will instantly damage the board or cause erratic behaviour.
Correct power architecture:
- 7.4V 2S LiPo → BEC (5V 5A) → PCA9685 V+ → all 12 servos
- 7.4V LiPo → DC-DC step-down (7.5V → 7.5V passthrough or 5V) → Arduino Vin
- All grounds connected together (Arduino GND + PCA9685 GND + BEC GND + LiPo -)
Use 16 AWG wire for the servo power bus between BEC and PCA9685. Thin wires cause voltage drop under load, causing servos to jitter or reset. Add a 470–1000 µF capacitor across the PCA9685 servo power pins for transient suppression.
ACEBOTT Biped Robot Kit – QD021
Start with this biped kit to learn servo-driven locomotion, then scale up the concepts to a full 12-servo quadruped build.
ACEBOTT ESP32 Programmable Robot Arm Kit – QD022
Multi-servo ESP32 arm kit — great for learning servo IK and coordination before applying the same principles to quadruped legs.
Frequently Asked Questions
Can I use only 8 servos (2 DOF per leg) for a simpler quadruped?
Yes. A 2-DOF per leg quadruped (hip lift + knee, no hip rotation) can produce a basic walking gait. However, it cannot turn and can only walk in a straight line without body rotation. 3-DOF per leg (12 servos total) enables turning, strafing, and much more natural movement.
Which servo is better for quadruped joints — SG90 or MG90S?
Use MG90S (metal gear) for coxa and femur joints — they carry the most load. SG90 plastic gear servos are acceptable for tibia joints where the load is lighter. All-MG90S builds are more reliable but cost more.
Does the Arduino Uno have enough processing power for IK + gait?
For basic trot and crawl gaits with pre-computed foot positions, yes. For real-time IK with sensor feedback (terrain adaptation, IMU-based body levelling), the Uno is borderline. Consider upgrading to an Arduino Mega (more RAM/Flash) or a Raspberry Pi for advanced control.
How long does a 2200 mAh LiPo last running 12 servos?
At typical walking loads (average 1A @ 5V = 5W), a 7.4V 2200 mAh battery holds ~16 Wh, giving roughly 3 hours of walking. Under heavy load (climbing obstacles, fast gaits), expect 45–90 minutes.
Can I add Bluetooth or Wi-Fi remote control to this robot?
Yes. Add an HC-05 Bluetooth module (UART to Arduino) for phone control, or replace the Arduino with an ESP32 for Wi-Fi control. Remote commands override the autonomous gait — for example, send ‘F’ for forward trot, ‘L’ for left turn, ‘S’ for stop.
Start Building Your Quadruped Spider Robot
Get servo motors, brackets, and robotics kits from Zbotic — all genuine components with fast shipping across India and dedicated support for your builds.
Add comment