Project log

Hexapod

Updated October 8, 2026
Hexapod logo

Hexapod is a family of 3D-printed, six-legged robots. Nougat, Mochi and Macaroon each walk on 18 servos, carry an ESP32 and host their own WiFi network, and all three run the same firmware. Its companion, Hexapod Link, is a kinematics simulator that models whichever robot it connects to and drives it live, from a single joint up to a whole gait.

Two reposrookidroid/hexapod: hardware, ESP32 firmware and gait generator (GPL-3.0) · rookidroid/hexapod-link: simulator and desktop app (MIT)
Mochi, a white hexapod robot with a round body and six three-jointed legs
Mochi · the round-bodied, MG92B build
3robots, one firmware
18servos per robot
19built-in motions
50 Hzlive pose control

Why I Built This

A toy that turned into a platform

This project started as something simple: I wanted to build a toy for my kids. A real, walking, six-legged robot they could hold, control, and be genuinely excited about.

It grew across four generations, through underpowered servos, a hunt for real torque, a round redesign and a scaled-up build, and picked up its own software along the way: one firmware shared by every robot, a gait generator that turns each robot's dimensions into motion, and a simulator to work out a pose on screen before the robot ever moves.

The hexapods are now a platform I hope my kids will one day use to learn the skills that matter: 3D printing, electronics, coding, and the engineering habit of iterating until something actually works. Every prototype and every hard-won fix is part of that story.

The Family

Four generations · three robots you can build today

The first hexapod prototype, with a rectangular body and MG90S servos
Version 1

The Foundation

The ambitious baseline

A proof of concept for the leg geometry and multi-directional walking. Physics caught up quickly: standard MG90S micro servos were too weak for the weight and the dynamic loads of walking, and the wiring tangled.

Lesson: servo count doesn't matter if the torque can't carry the chassis.

MG90S servos18 DOFRectangular bodyRetired
Nougat, a hexapod with a rectangular body and 21G digital servos
Version 2 · Nougat

The Quest for Power

Torque, and the signal to match it

Legs redesigned around beefier 21G digital servos, with an ESP32 for WiFi. Torque alone wasn't the answer: two PCA9685 PWM drivers and a power stage sized for all 18 servos turned the extra strength into a steady gait.

Lesson: torque only pays off when signal precision keeps up with it.

21G digital servosESP322 × 18650
Mochi, a hexapod with a round body and MG92B micro servos
Version 3 · Mochi

Refinement & Redesign

Form, function and the perfect fit

The MG92B is the strongest micro servo that still fits a compact frame, with high torque in a smaller footprint than the 21G. That allowed a tighter, circular body: better symmetry, more leg clearance in every direction, and a friendlier face.

Result: the smallest of the family, with a smooth gait.

MG92B servosESP322 × 18650Round body
Macaroon, the largest hexapod, with 25 kg digital servos
Version 4 · Macaroon

Scaling Up

The biggest and strongest

Eighteen 25 kg digital servos replace the micro servos, with longer legs and a wider body to match. Four 18650 cells in 2S2P feed the servos directly at up to 8.4 V through a controller board built for the load.

Result: the same firmware and controls, with torque to spare.

25 kg servosESP324 × 18650 (2S2P)
NougatMochiMacaroon
Servos18 × 21G digital18 × MG92B micro18 × 25 kg digital
Battery2 × 18650 (2S)2 × 18650 (2S)4 × 18650 (2S2P)
Coxa / femur / tibia38 / 54 / 97 mm36 / 44 / 85 mm62 / 76 / 132 mm
Gait frame period12 ms12 ms25 ms
WiFi networkhexapod_nougathexapodhexapod_macaroon
Firmware defineROBOT_NOUGATROBOT_MOCHIROBOT_MACAROON

Each build guide covers the bill of materials, the printed parts, assembly, wiring, software setup, calibration and troubleshooting. The same guides live in the robots folder of the repo.

One Firmware for Every Robot

ESP32 · Arduino · two PCA9685 drivers

All three robots run one Arduino sketch. What differs between them is data: each robot's leg mounts, link lengths, postures, gait radii and joint limits live in one JSON file. The path tool, a small NumPy gait generator with its own inverse kinematics, turns that file into look-up tables of servo positions for every motion, and the firmware plays them back. Adding a robot is mostly a matter of writing its JSON.

Geometryrobots/<name>.json: legs, links, postures, gaits
Path toolInverse kinematics and gait paths, written out as motion.h
ESP32Plays the tables, streams poses, serves its own config
ClientsBrowser, Android app, Arcade Remote, Hexapod Link
19 built-in motionsWalking in eight directions, fast forward and back, turning in place, a climbing gait, body pitch, roll and yaw, and a twist.
Adjustable gait speed20 to 100 % of each robot's tuned rate. Below full speed the firmware blends between table frames, so slow gaits stay smooth.
Non-blocking motion engineGaits, streamed poses and every transition between them run on one tick-driven loop, so the web page and OTA stay responsive while it walks. Gaits change only at the start or middle of a cycle, by way of standby.
Browser calibrationTrim each servo's offset with + and − on the robot's own web page; offsets save to flash, with no recompiling.
Over-the-air updatesAfter the first USB upload, flash new firmware over WiFi from the Arduino IDE, with an optional password.
FailsafesThe robot returns to standby if motion commands stop for 500 ms, or if a pose stream stops for 1 s. Streamed poses are slew-limited per joint, so a big jump becomes a controlled move.

Pick the robot by leaving one #define ROBOT_* uncommented in robot.h, or skip that step: every release includes a ready-to-open sketch for each robot.

Ways to Drive It

Join the robot's WiFi · then pick a controller

Any browser

The robot serves its own controller at 192.168.4.1, so a phone, tablet or laptop drives it with nothing installed. Hold the dial to walk in eight directions, the grid for body moves and climbing, or use W A S D on a keyboard. Let go and it settles to standby.

Android app

The Hexapod app on Google Play connects to the robot's network and plays every built-in motion from on-screen buttons.

Arcade Remote

A microswitch joystick and five arcade buttons around an ESP32-C6, in a 3D-printed cabinet. It sends the gait speed with every packet.

Hexapod Link

The simulator below: pose the robot joint by joint or by its body, play a gait frame by frame, and send any of it to the real robot. It also calibrates the servos.

Your own code

Everything above speaks a small binary protocol over UDP port 1234. A gait is one 7-byte packet:

# magic, walk forward,
# sequence, 60 % speed
struct.pack("<BBIB",
  0xA5, 1, seq, 60)

The robot describes itself

GET /robot_config returns the robot's name, firmware version, servo range, speed range, command list and full leg geometry, so a client can model any robot in the family without keeping its own copy.

MagicPacketSizePurpose
0xA5Motion command6 or 7 BPlay a built-in motion, optionally at a set speed; resend to keep moving
0xA6Real-time pose44 BStream servo positions for all 18 joints, with a per-joint slew limit
0xA7Session control6 BEnter or leave real-time mode, relax the servos, keep alive
0xA8Version query5 BAsk for the firmware version; the only packet the robot answers

All packets are little-endian and unpadded. The full reference, with byte layouts and Python examples, is in the firmware README.

Hexapod Link

Kinematics simulator · real-robot remote

ForkBuilt on mithi/hexapod-robot-simulator, extended with a desktop app, real-robot control, calibration and a rebuilt test suite.
One tripod gait cycle playing in the 3D view
One tripod gait cycle in the 3D view

When it connects, the app asks the robot for its config and reshapes the simulated body to match, so what is on screen agrees with the hardware. Nougat, Mochi, Macaroon or a new robot all work without touching the app, and the last config is cached so the robot can still be modeled offline.

Every pose you set can then stream to the robot. Joint angles are clamped to the robot's mechanical limits and converted to servo ticks using each leg's mirroring from that same config, then sent at 100 Hz; the robot slews toward them on its 50 Hz servo loop.

The Kinematics page: a table of 18 joint angles beside the 3D hexapod

Kinematics

Set all 18 joint angles by hand and watch the body follow.

Streams every pose to the servos
The Inverse Kinematics page: body translation and rotation sliders beside the 3D hexapod

Inverse Kinematics

Translate and rotate the body; the solver finds the joint angles, or says why it can't.

Streams once the pose is reachable
The Leg Patterns page: one set of angles applied to all six legs

Leg Patterns

Sweep all six legs together through one set of angles.

Streams every pose to the servos
The Motion page: gait playback controls beside the 3D hexapod

Motion

Play the generated gaits frame by frame and scrub through them, then run the same motion on the robot at 20 to 100 % speed.

Runs the robot's own gait from flash

Join its WiFi

The robot is the access point, so the computer running the app joins it directly. The robot stands up when a client connects.

Connect

Open the ROBOT panel from the status button in the navigation bar and connect to 192.168.4.1. The stream and run controls light up on the pages that use them.

Drive or calibrate

Stream poses, trigger built-in gaits, or open the Calibration page to trim each servo's offset and save it to the robot's flash.

Built-in gaits or streamed framesThe Motion page can trigger the robot's own gait, played from flash so WiFi can't make it stutter, or stream the simulator's frames for paths the firmware doesn't have.
Same names as the firmwareLegs and joints are numbered the way the firmware numbers them, so a leg picked out in the 3D view is the leg the calibration page calls by that name.
No robot needed to try ittools/fake_robot.py stands in for the hardware, and the test suite covers the kinematics, the streaming protocol and config reading without a display, a browser or a robot.
SafetyPut the robot on a stand before streaming: a pose that is stable in the simulator isn't always stable on the floor. If the stream stops, the robot eases back to standby after 1 s.

Design Philosophy

Printable on a hobby printer · repairable by hand

Layer orientation

Print layers line up with the load, spreading stress along their length so walking forces don't split them apart.

Reinforced joints

Leg segments and servo mounts have strengthened connection points that spread loads and avoid stress concentrations.

Balanced frame

The body keeps weight central and wiring short, for stable walking and an even load across all six legs.

Modular assembly

Interlocking parts need little glue, so repairs and upgrades take no special tools.

PLA or PETG

The geometry holds up in standard filaments under repeated dynamic stress.

Full control stack

BOM, wiring diagrams, a gait generator, firmware, a browser controller, an Android app and a simulator, all open source.

ESP32ArduinoPCA9685WiFi UDPOTANumPyPythonPlotly DashpywebviewPyInstallerpytestGitHub Actions

Get Started

Build · flash · drive · simulate

1. Build a robot

Follow the guide for Nougat, Mochi or Macaroon: print the parts, assemble the legs and body, and wire the controller board.

2. Flash the firmware

Open software/hexapod_esp32 in the Arduino IDE, pick your robot in robot.h and upload. Or start from your robot's sketch in the latest release.

// robot.h: leave exactly one uncommented
#define ROBOT_MOCHI

3. Calibrate and drive

Join the robot's WiFi (password hexapod_1234) and open http://192.168.4.1/. Level the legs on the Calibrate tab, save, then walk it from the Drive tab.

4. Run Hexapod Link

Python 3.13+. Add --no-window --port 8050 to use a browser instead of the desktop window.

pip install -r requirements-desktop.txt
python hexapod_link.py
python tools/fake_robot.py nougat  # no robot?

Prebuilt Windows and Linux bundles of Hexapod Link (about 130 MB) come out of every build-desktop run. Questions about the robots go to hexapod issues, and about the app to hexapod-link issues.

Robots & firmware GPL-3.0 · Hexapod Link MIT hexapod · hexapod-link · Arcade Remote · rookidroid.com

Archived comments

Comments left on the previous version of this site.

Tenzin Kuenkhyab

Hello, i have read about your hexapod project and i found it quite interesting and want to build one to help myself learn. But while procuring materials i have failed to understand what type of servo motor you used. I have read it was TowerPro MG92B, but is it a continuous servo motor or standard servo motor?
Would be really grateful if you could reply

Zhengyu Peng

It is a standard servo motor

ili

Hi, I was working on building something like this and I’ve noticed the github repo has been deleted. Would you be able to provide access to the instructions perchance?

Simone

Hi Zhengyu, this is a really interesting project, and I think I got all I need to complete this hexapod! It’s a sort of puzzle to understand some part of the hardware, but this is also part of the fun! I think i’ll figure out while I build, but if you can guide me where to put the bearings, the pins, and the 6mm 2m screw it will be great! thanks again!

Zhengyu Peng

The bearings will be in the holes of “body_base” and “leg_bottom”. The pins go with “joint_bottom” and “foot_bottom”. 6mm M2 screws are used to attach servo horns to “joint_top” and “foot_top”.

Simone

Thanks a lot Zhenghy! Everything fit like a glove! I’m still waiting for the battery to arrive but in those days I’ll do the electronics!
I tried to figure out the correct calibration for the leg (part 2servos). I think at 0 it should be all retracted and at maximum all extended., is it right? (i’m using a “CCPM servo costintency master” that it’s a very cheap useful tool for servo testing)
for the body_base servos should they stay at center in neutral position? I’ll send you picture of the make on thingiverse!

Zhengyu Peng

So for the calibration position, all the servos should be at 90 deg position, and the legs should be horizontal and the feet are perpendicular to the ground. I will make a photo of this later.

James

Hi Zhengyu. I was building your hexapod project and almost done with a liitle modification. I follow your instruction but i didn’t see any diagram showing the position of each servo connecting to the PCA9685. Can u share ? Also is there a coding for the joystick controller, i can’t find it on your github location you mention. Thank you.

James

Hi . I’m building your hexapod and following your instruction. But do you include the coding for the joystick remote control ? I can’t find it on the github. Can you share it. Also there isn’t any diagram for connecting the servo’s to the PCA9685. Can anyone help ? Thank you.