Skip to content
Welcome to our store

Start typing to find products

Looking for something? Try searching by category, product name, or brand.

Your cart is empty

Continue shopping

How to Build a Small Humanoid Robot Prototype with Legs

roboi himanoid robot by invincible
roboi himanoid robot by invincible roboi himanoid robot by invincible
How to Build a Small Humanoid Robot — Prototype Guide | shop.roboi.ai
Advanced Build Guide

How to Build a Small
Humanoid Robot
Prototype with Legs

A complete engineering guide to building a bipedal humanoid robot from scratch — covering servo joints, degrees of freedom, balance sensing, 3D-printed frame, and gait programming. Every component ships from our store.

18 min read
Intermediate–Advanced
Height: ~35–45 cm
Budget: $250–$600
Updated June 2026
Mechanical: Moderate — 3D printing + assembly
Electronics: Intermediate — 18+ servo wiring
Programming: Advanced — gait & balance control
01

What is a small humanoid prototype?

A humanoid robot is one that resembles the human body in structure — an upright torso, two legs for locomotion, two arms, and a head. Unlike wheeled robots, a bipedal humanoid must actively manage its own balance while walking, which is what makes it one of the most challenging and rewarding projects in amateur robotics.

The goal of this guide is a tabletop-scale prototype — standing roughly 35–45 cm tall, capable of standing upright, shifting its weight, and taking slow deliberate steps. This is what roboticists call a "quasi-static" walker: it moves one limb at a time while keeping its center of mass over its support foot. It won't sprint or do gymnastics — but it will walk, and that is a genuine engineering achievement for a first build.

This scale is ideal for beginners to humanoid robotics: small servos are cheap, the 3D-printed frame is affordable, and if the robot falls over (which it will, at first) nothing expensive breaks.

Why start small? Full-size humanoid robots like Boston Dynamics Atlas use custom hydraulic actuators and sophisticated real-time control systems that cost hundreds of thousands of dollars. A 40 cm servo-driven prototype teaches you all the same fundamental concepts — kinematics, balance, gait — at a fraction of the cost and risk.


02

Degrees of freedom — how many joints do you need?

A "degree of freedom" (DoF) is one axis of rotation at a joint. More DoF means more natural movement but also more complexity, cost, and code. For a small walking prototype, the minimum viable configuration is 6 DoF per leg (12 total), with optional arms and head adding more.

Hip (each leg)

3

Pitch (forward/back), roll (side/side), yaw (rotation). Roll is the most critical for lateral balance.

Knee (each leg)

1

Pitch only. Bends to raise and lower the robot's center of mass during walking.

Ankle (each leg)

2

Pitch and roll. Ankle roll is essential — it adjusts foot contact to keep balance on each step.

Shoulder (each arm)

2

Optional. Pitch and roll for counterbalancing arm swings during walking.

Elbow (each arm)

1

Optional. Single-axis bend. Useful for gesture and demonstration purposes.

Head / neck

2

Optional. Pan and tilt. Can house a camera for vision-based tasks later.

This guide targets a 18 DoF configuration: 12 for legs, 4 for arms, 2 for the neck — a solid balance between capability and manageable complexity for a first humanoid build.


03

Full parts & components list

Every part below is available in our store. Click any card to go to its product page. For convenience, everything is also bundled in our Humanoid Robot Starter Kit.

Joints

MG996R Digital Servo (×18)

High-torque metal-gear servo. 11 kg·cm torque — strong enough for leg joints at this scale. 180° range.

View on store
Brain

Raspberry Pi 5 (4 GB)

Main computer. Handles high-level gait planning, balance algorithms, and optional vision. Runs Python or ROS2.

View on store
Co-processor

Arduino Mega 2560

Real-time servo controller. 54 digital pins handles all 18 PWM servo signals while the Pi handles logic.

View on store
Control

PCA9685 16-Channel Servo Driver (×2)

I²C PWM driver. Each board controls 16 servos, so two boards cover all 18 channels with room to spare.

View on store
Balance

MPU-6050 IMU (6-Axis)

Gyroscope + accelerometer. Measures the robot's tilt angle in real time for balance feedback control.

View on store
Power

3S LiPo Battery 11.1V 2200mAh

Powers the servo system. 11.1V nominal voltage, stepped down to 6V for servos via the BEC regulator.

View on store
Power

5A BEC Voltage Regulator (×2)

Converts 11.1V LiPo to stable 6V for servos and 5V for the Pi/Arduino. Separate regulators avoid noise.

View on store
Frame

PLA+ Filament 1kg (Black)

For 3D printing the robot's structural skeleton, brackets, and foot platforms. PLA+ is stronger than standard PLA.

View on store
Frame

Servo Horn & Bracket Set (M3)

Aluminium multi-purpose servo horns and U-brackets. Essential for creating rigid joint connections between segments.

View on store
Hardware

M3 Screw & Nut Kit (300 pcs)

Assorted M3 hex screws, nuts, and standoffs. You'll use a lot of these — a full kit prevents mid-build trips to the hardware store.

View on store
Wiring

Servo Extension Cables (×20)

30 cm 3-pin servo extensions. Routes cables cleanly from joints through the torso to the driver boards.

View on store
Sensing

HC-SR04 Ultrasonic Sensor

Optional but useful. Mount in the head to detect obstacles ahead and trigger stop-and-avoid behaviour.

View on store
Spec Target value Notes
Total height 35–45 cm Depends on leg segment lengths you print
Total weight 800g – 1.2 kg Including battery; keep as light as possible
Degrees of freedom 18 DoF 12 leg + 4 arm + 2 neck
Servo torque 11 kg·cm @ 6V MG996R — minimum for knee joints
Battery runtime 45–90 min Depends heavily on walking frequency
Servo supply voltage 6V regulated Never run MG996R above 7.2V
Microcontroller Arduino Mega + RPi 5 Mega for real-time servo; Pi for logic
Balance sensor MPU-6050 Mounted at torso center of mass

Power warning: Never power 18 servos directly from the Arduino's 5V pin. The Arduino can only supply ~500mA. At full load, 18 MG996R servos can draw up to 18A. Always use a dedicated BEC regulator fed directly from the LiPo for servo power.


04

Frame & structure — 3D printing your skeleton

The structural frame is what connects all your servo joints into a coherent body. At this scale, 3D-printed PLA+ is the ideal material — it's light, strong enough for the loads involved, easy to redesign, and cheap to reprint if something breaks.

You have two options for frame design. The fastest is to use a proven open-source design. Poppy Humanoid and Lynxmotion SES-V2 both have freely downloadable STL files optimised for MG996R-class servos. Download, slice in Cura or PrusaSlicer, and print at 30–40% infill with 3 perimeter walls for joint sections and 20% for the torso shell.

If you want a fully custom design, use Fusion 360 (free for personal use) or FreeCAD. The key constraint is that each joint housing must seat the servo body firmly with the output shaft centred on the rotation axis. Design the servo pocket first, then build the link around it.

Critical printed parts: foot platforms (flat, wide — stability is everything at first), shin and thigh segments, hip block, torso shell with internal mounting rails, and head housing. Use the aluminium U-brackets for knee and hip connections rather than printing those — printed bracket hinge points wear out quickly under load.

Print tip: Print all structural leg parts with the layer lines running parallel to the expected stress direction. A shin segment printed vertically (layers along the length) is far stronger in bending than one printed flat. Orientation is more important than infill percentage for structural parts.


05

Electronics wiring & power system

The power system is the most critical part of a humanoid build to get right. Two separate power rails are essential: one for the servos (6V, high-current) and one for the logic boards (5V, clean). Mixing them causes voltage drops and resets when servos fire.

Connect the 3S LiPo (11.1V) to two BEC regulators in parallel. BEC 1 outputs 6V and feeds all 18 servo signal boards via the two PCA9685 driver boards. BEC 2 outputs 5V and feeds the Raspberry Pi 5 via its USB-C port and the Arduino Mega via its barrel jack. GND rails must be common between both BECs and all boards.

The two PCA9685 boards share an I²C bus with the Raspberry Pi. Set one board to address 0x40 (default) and the other to 0x41 by bridging the A0 solder jumper. The Raspberry Pi sends high-level joint angle commands over I²C to the PCA9685 boards, which output the PWM signals that the servos respond to. For time-critical balance corrections, the Arduino Mega can take over servo control directly via its own PWM pins, communicating with the Pi over UART.

Mount the MPU-6050 IMU at the torso, as close to the robot's center of mass as possible. Connect it via I²C (SDA/SCL) to the Arduino Mega which handles the balance feedback loop at high frequency.

Always add a main power switch between the LiPo and the rest of the circuit, plus a LiPo voltage alarm. A 3S LiPo that discharges below 3V per cell suffers permanent damage. The alarm beeps when any cell drops below 3.5V.


06

Step-by-step assembly

Assemble from the ground up — feet first, then legs, then torso. This lets you test each leg independently before combining them.

1

Print and prepare all structural parts

Print all skeletal parts in PLA+. Clean up support material with a craft knife. Test-fit each servo in its pocket before assembly — servos should sit snug without force. Label all 18 servos with tape and a marker (L_HIP_PITCH, R_KNEE, etc.) before installation. Tracing which servo is which after wiring is a nightmare.

2

Centre all servos before fitting

This is critical. Connect each servo individually to an Arduino running a simple centre sketch (write 90° to each servo one at a time). With the servo at its centre position, attach the horn so the output arm is aligned with the neutral joint angle of that segment. A servo installed off-centre will hit its travel limit at the wrong point in the gait and snap a printed bracket.

3

Assemble each leg independently

Build the right leg first: ankle roll servo → ankle pitch servo → shin segment → knee servo → thigh segment → hip pitch servo → hip roll servo → hip yaw servo. Secure each servo to its bracket using M3 screws. Route the servo extension cables through the segment channels as you go — threading cables after assembly is extremely difficult. Test the leg's full range of motion manually before moving on.

4

Mount legs to the torso hip block

The hip block is the structural heart of the robot. It connects both legs and carries the torso weight. Use aluminium U-brackets here rather than printed parts — this joint experiences the highest stress in the entire robot. Double-check that both legs are at the same height and both feet are flat on the surface before tightening fasteners.

5

Install electronics in the torso

Mount the Raspberry Pi 5 and Arduino Mega on printed mounting rails inside the torso shell. Mount both PCA9685 boards close to the cable entry points. Mount the MPU-6050 at the torso centre, oriented flat. Mount the LiPo battery as low as possible in the torso — a lower centre of mass improves balance significantly.

6

Connect all servo cables to PCA9685 boards

Following your pre-labelled servo map, plug each extension cable into its assigned channel on the PCA9685 boards. Keep a written log: channels 0–7 on board 0x40 = left leg; channels 8–15 = right leg; board 0x41 channels 0–3 = left arm, 4–7 = right arm, 8–9 = neck. This mapping becomes your servo index in code.

7

Assemble arms and head

Arms are mechanically simpler — shoulder pitch, shoulder roll, and elbow pitch per arm. Mount the head with two servos (pan and tilt) and optionally a HC-SR04 sensor facing forward. Attach arms to the torso shoulder mounts and head to the neck column. Run cables internally wherever possible.

8

Power-on test — no gait yet

Before writing any gait code, upload a simple test sketch that commands every servo to 90° (neutral) and holds. Power on, watch for any servo fighting against its bracket or buzzing loudly — this means a centre calibration is off. Confirm all 18 servos respond. Confirm the MPU-6050 returns sensible accelerometer readings over I²C. Only proceed once all servos are quiet and centred.


07

Balance sensing with the IMU

The MPU-6050 gives you raw accelerometer and gyroscope data on 6 axes. Raw data is noisy. For balance control you need the robot's actual tilt angle, which requires combining both sensors through a complementary filter or a Kalman filter.

The complementary filter is the right starting point: it takes the gyroscope's short-term precision and the accelerometer's long-term accuracy, blends them with a simple formula, and outputs a stable tilt angle. A typical coefficient is 0.98 for the gyroscope and 0.02 for the accelerometer, updated at 100Hz or faster on the Arduino.

Once you have a reliable tilt angle, use it as the feedback signal for a PID controller that adjusts the ankle roll servos in real time. When the robot tilts left, the ankle rolls right to compensate, keeping the foot flat. This is the foundation of all bipedal balance, from this prototype all the way up to Boston Dynamics Atlas.

Free IMU library: The MPU6050_tockn Arduino library handles the DMP (Digital Motion Processor) on the chip and outputs stable quaternion data out of the box, removing the need to implement your own filter from scratch.


08

Programming basic gait (walking)

A gait is the sequence of joint angle positions that moves the robot forward. For a quasi-static walker, the gait is broken into discrete phases that execute one at a time. The simplest walking gait has four phases per step cycle:

A

Weight shift

Before lifting a foot, shift the robot's entire torso laterally over the stance foot using the hip roll joints. The IMU confirms the weight has transferred before the next phase begins. This is the step most beginners skip — and why their robot falls.

B

Swing leg lift

Bend the swing leg's knee upward and raise the hip pitch to clear the foot from the floor. The ankle pitch lifts the toe. Move slowly — fast movements introduce momentum that throws off balance.

C

Swing leg extension

Extend the swing hip pitch forward, then lower the knee to plant the foot ahead of the stance foot. The ankle pitch adjusts to land heel-first (or flat-footed for simplicity at first).

D

Weight transfer & repeat

Shift weight onto the newly planted foot, confirm with the IMU, then repeat phases A–C for the other leg. One full ABCD + ABCD cycle = one full step forward.

Encode each phase as a Python dictionary of servo channel → angle pairs on the Raspberry Pi. Interpolate smoothly between positions using linear or cubic interpolation over 300–500ms per phase. Our free starter code package includes a working gait engine, PCA9685 driver, IMU reader, and balance PID controller — all in Python, ready to run on the Raspberry Pi 5.

Use ROS2 for serious development. If you plan to go beyond basic walking, Robot Operating System 2 (ROS2 Jazzy) runs natively on the Raspberry Pi 5 and gives you a full framework for sensor fusion, navigation, and simulation. Our ROS2 setup guide covers installation and the first nodes specific to this robot.


09

Troubleshooting & common issues

Robot falls immediately when power-on: One or more servos is fighting against its mounting bracket due to incorrect centring. Go back to Step 2 — re-centre every servo individually before reinstalling.

Servos buzz loudly at rest: This is the servo hunting around its set point due to a loose mechanical connection or excessive load. Check that the servo horn is firmly locked on the output shaft. If the servo is overloaded (e.g. the knee holding the full robot weight), consider adding a physical support or using a higher-torque servo for that joint.

One leg's servos don't respond: Most likely a bad I²C connection to that PCA9685 board, or a wrong I²C address. Run an I²C scanner sketch on the Arduino to confirm both boards at 0x40 and 0x41 are visible on the bus.

Robot walks but tips sideways: The IMU-to-ankle feedback loop isn't acting fast enough, or the ankle roll servo has too little torque for the speed of the tip. Increase the PID proportional gain carefully (small increments), or slow down the gait phases to give the balance controller more time to react.

Raspberry Pi resets during movement: Power supply noise from the servos is spiking into the Pi's supply. Add a 470µF capacitor across the Pi's 5V input and make sure the servo and logic GND rails are only connected at one common point (star grounding).


10

Upgrades & what to build next

Once your robot walks reliably, the next milestones open up a genuinely exciting range of projects. Add a Raspberry Pi Camera v3 to the head and run a face-tracking algorithm — the neck servos will keep it centred automatically. Add FSR (force-sensitive resistor) foot sensors for precise ground contact detection, enabling dynamic rather than quasi-static walking.

For higher performance, replace the MG996R servos in the knees and hips with Dynamixel AX-12A smart servos, which provide position feedback, temperature monitoring, and load sensing over a daisy-chained serial bus — dramatically simplifying the wiring and giving your code real-time joint state data.

Longer term, the same mechanical platform can host a voice interface (ReSpeaker mic array), an onboard LLM for conversational AI, or vision-based object grasping with a printable two-finger gripper on each arm. Every part you'll need is in our store.

Humanoid Bundle: All 12 core components in this guide — servos, Pi 5, Arduino Mega, PCA9685 boards, IMU, LiPo, BECs, brackets, screws and cables — are available as the Humanoid Robot Starter Kit at a 12% bundle discount, shipped together.

Ready to build your humanoid?

All 12 components in stock. Ships within 24 hours.

Shop the Humanoid Kit
Back to blog

Leave a comment