Assembly guide for Hex
Open-source 3D-printable hexapod platform; Hex3 is the current release
License
- Hex3 CAD and PCBs: the maker's own non-commercial terms
- Hex3 code: GPL 3.0
- Hex1 and Hex2: MIT
Licensed by generation and part. Hex3's CAD and PCBs are under the Open Community License: individuals may use, copy and modify them and must share derivatives under the same licence; a business may use and modify the product for internal use, but must not copy or replicate it for any commercial purpose without a separate licence. Hex3's code is GPL-3.0. Hex1 and Hex2 are MIT. Checked 2 Nov 2026.
Assembly guide
1. Which generation this guide covers
This guide follows Hex3, the current release. Hex2 and Hex1 are older, deprecated generations and are not described here.
1.1 Confirm you are building Hex3
Hex3 is the current release; its parts, wiring, firmware and Raspberry Pi setup differ from Hex2, so do not mix documents from the two.
- Upstream's README says the current Hexapod release is Hex3 and that Hex4 is under development, with a target release date in mid- to late 2027.
- The Hex3 page describes the platform as steady-state: it is not being actively developed against, and upstream asks for pull requests (reviewed through its Discord) or a published fork for any changes.
- Hex3 highlights per upstream: 10kg (~22lb) payload capacity; drivable with an Xbox controller; fully 3D printed body and legs; 18 degrees of freedom (3 per leg); custom low-cost servos made from DC gear motors and AS5600 magnetic encoders; a spring-loaded toe with a position sensor; one Seeed Xiao RP2350 per leg; the Pi and the leg controllers talk over a shared CAN bus; ROS2 on a Raspberry Pi 5.
- Upstream gives a price point of about $2,000 USD for Hex3.
- Upstream's Hex3 pages are split into six stages: 3D printing, PCB assembly, electronics setup, mechanical assembly, real-time firmware and Raspberry Pi configuration. Start the prints first so they run while you work on the others.
1.2 If you already hold a Hex2 build
Hex2 (hobby servos and a Teensy 4.1) was deprecated in July 2025 and upstream publishes no assembly route for it.
- Upstream says Hex2 was deprecated in July 2025 and is no longer actively supported, although the repositories still hold the materials to build and control it. You are welcome to fork the repository to continue development.
- Upstream names two main Hex2 limitations: hobby-grade servos can overheat, limiting continuous runtime to only a few minutes, and maximum payload is only a few pounds.
- For Hex2 upstream publishes: an electrical and a mechanical bill of materials (both dated 2025-07-22), a heat-set insert drawing (2024-11-05), a Fusion 360 assembly (2025-07-22_assembly.f3z), electronics files for the main board and leg board, a controller mapping drawing, a Raspberry Pi 5 getting-started page, and the Teensy and Raspberry Pi code in the separate Hex2 repository.
- Upstream publishes no Hex2 assembly steps, wiring harness document or calibration procedure. The electrical bill of materials has the line 'Main to Leg Connections <TBD>'. This guide therefore does not describe Hex2 assembly, wiring or calibration; use the Hex2 documents above directly.
- The wire lengths, encoder, motor and time-of-flight cables, calibration method and CAN setup in this guide are Hex3 only. A hobby-servo Hex2 has no encoder or separate motor harness to build.
1.3 Gather tools and materials
You need two hex keys (2.00 mm and 2.5 mm), soldering and crimping tools, a multimeter and gear grease before you start.
- Upstream's full bill of materials is the HEX3 Bill-Of-Materials spreadsheet (tabs: Mechanical BOM, Electrical BOM, a printed-parts list and an example PCB order).
- Tools: a 2.00mm hex key (for the Raspberry Pi and LiDAR); a 2.5mm hex key (all other hardware uses 2.5mm hex; upstream recommends also using a 2.5mm drill bit, as manually tightening all the screws is a herculean task); soldering iron and soldering accessories; flux and solder; a heat set insert bit for the soldering iron; a multimeter for continuity and polarity checks; a PCB holder or vise (recommended for PCB assembly); wire cutter; wire stripper for the gauges in the wire length table; a clamp (not required but highly recommended for press fits); a JST crimp tool; a terminal connector crimp tool (highly recommended but not required, as you could directly solder these connections); pliers, tweezers and similar for removing supports.
- Additional material required: multipurpose synthetic grease for gears.
2. 3D Printing
Print the body and leg parts for Hex3. Upstream publishes print settings and part quantities but no per-part print orientation.
2.1 Print the body and leg parts
Print the Hex3 leg and base parts in ABS or ASA, with base_core and the toes printed at 12+ walls.
- Upstream says PETG can be used, but recommends ABS or ASA for better strength and heat resistance.
- All structural parts are sliced in PrusaSlicer with the 0.2mm STRUCTURAL print profile on a Prusa Core ONE. Default (most parts): 4 walls, 30% triangles infill, supports as needed. base_core and the toes: 12+ walls, 30% triangles infill, supports as needed.
- base_core sees the highest structural loads, so it is printed with 12+ walls to make them effectively solid rather than relying on infill. The toes are printed with these settings as they will wear down over time.
- Quantities for six legs, from the printed-parts tab of the bill of materials: s0 6, s0_gear_cover 6, s0_gear_cover_spacer 6, s1 6, s1_bearing_holder 12, s1_encoder_cover 6, s1_motor_bearing_holder 6, s1_motor_bearing_mount 6, s1_motor_cover 6, s2_bearing_screw_mount 6, s2_bearing_side 6, s2_connector_long 6, s2_connector_short 6, s2_gear_side 6, s2_magnet_mount 6, s3_bearing_side 6, s3_gear_mount 6, s3_gear_side 6, s3_magnet_mount 6, spring_aligner 6, toe 6, toe_tip 6.
- Base parts from the same tab: relay_mount_bracket 1, base_flat 12, base_lower 1, base_upper 1, fan_shield_print_wo_top_or_bottom_layers 1, base_electronics_mount 1, base_electronics_guard 1.
- Check before you print: the print page names base_core and the release folder holds base_core.3mf, but the printed-parts tab does not list it. Print base_core as the print page directs.
- Files are in Hex3_resources/cad in the repository (a full Fusion 360 assembly, a STEP file, release 3mf files for the base and leg parts, and encoder_insertion_tool in .f3d and .step) and in upstream's Hex3 Printables project. Upstream says parts might look slightly different from the images and to always use the newest version on GitHub.
- The encoder insertion tool is used in mechanical assembly. Upstream publishes its CAD but does not give print settings for it.
3. PCB Assembly
Solder six leg PCBs and one main PCB. Leg PCB version V2.0 or V3.2 changes the parts, the polarity of one capacitor and a required fix; choose before you order.
3.1 Choose the leg PCB version
Hex3 has two leg PCB versions, V2.0 and V3.2, both fully functional; the main PCB is V2.1.
- Upstream says both versions can build a complete Hex3. The main differences are assembly method, thermal management, PCB cost and whether the XIAO RP2350 can be reused.
- Leg V2.0: a through-hole diode that you solder by hand; the DRV8871 motor driver chips get no additional cooling (external heat sinks can still be applied, but the layout was not designed for heat dissipation); the XIAO RP2350 is soldered directly to the PCB, so it cannot be reused.
- Leg V3.2: a surface-mount diode (add it to your assembly part list when ordering); heavy emphasis on cooling the DRV8871 chips, with 2 oz internal copper pours (this increases the price quite a bit) and via stitching for the GND plane; a POGO pin option for the XIAO RP2350 so it can be reused, although the pogo pin spacing is sensitive and needs specific male and female header pins.
- V3.2 other changes listed in upstream's PCB readme: split termination removed from the CAN bus circuit; silk screen encoder labels zero-indexed; encoder connectors swapped so S0 is closest to the top of the board.
- Main board: V2.1 was the only version used for OpenSauce 2026. Both leg versions were used on hexapods at OpenSauce 2026.
- Files are in Hex3_resources/electronics: leg_board/V2.0, leg_board/V3.2 and main_board/V2.1. Both leg and main PCBs are designed as 4 layer PCBs. Upstream says any PCB supplier that offers assembly should work; the BOM and CPL files from its last order are in the leg_board folders for reference and were for a bulk order of 25 boards, so adjust quantities.
3.2 Solder a leg PCB
Solder the XIAO RP2350, fuse block, JST and Molex connectors and capacitors to one leg PCB, then repeat for six.
- Parts for one leg PCB: 1x Xiao RP2350 (no headers attached); 1x 3557 fuse block; 3x 4 Pin JST board connector (take a 4th if you will use the optional I2C breakout connection; current software does not need it); 1x 5 Pin JST board connector; 1x 4 Pin Molex board connector; 4x 2 Pin Molex board connector; 4x 22uF radial capacitor; 1x 470uF radial capacitor; 1x leg PCB (V2.0 or V3.2).
- V2.0 also needs 1x 1N5819 diode. V3.2 optionally needs 2x 4 Pin POGO connector, 2x 7 Pin short male header pin and 2x 7 Pin short female header pin.
- Start with the Xiao RP2350. With V3.2 you can opt for header pins; V2.0 does not support header pins.
- Surface-mounted Xiao: tack two diagonal top pins with a small amount of solder after checking that each side is evenly spaced and all pins are centred on the pads. Flip the PCB and check the bottom pads are centred in the through holes; if not, heat one corner, gently rotate the Xiao and repeat. Then solder all top pins. For the bottom, use a thin soldering iron tip, heat the hole and the Xiao pad together, fill the hole with solder, and check the hole is not overfilled and there are no shorts to neighbouring holes.
- Header pin Xiao (V3.2 only): solder the female header pins to the PCB, then solder the male header pins to the Xiao. If you use the header pins and pogo pins from the Hex3 BOM, insert the male pins through the top of the Xiao instead of resting the Xiao on top of them, so the pogo pins make solid contact with the pads on the bottom. Place the pogo pins on the PCB, plug the Xiao into the female headers, check that the pogo tips line up with the pads on the bottom of the Xiao, and if so solder the pogo pins to the PCB.
- V2.0 only: solder the diode now. The cathode of the diode should be on the side closer to the Xiao. With V3.2 skip this, because the diode is surface-mount and part of the PCB assembly order.
- Solder the 3557 fuse block. Hold the soldering iron to the pins of the block long enough for adequate heat to build up before applying solder.
- Solder the JST connectors: the 4 pin JSTs for the encoders, optionally a 4th for the I2C breakout, and the 5 pin JST for the toe sensor.
- Solder the Molex connectors: the 4 pin Molex for the main power supply and CAN bus connection with the main PCB, and the 2 pin Molex connectors for the motors.
- Solder the capacitors. Follow the correct polarity: the cathode of the 22uF capacitors should face towards the 2 pin Molex connectors. Solder the 470uF capacitor for the Xiao, also with correct polarity: for V2.0 the cathode faces towards the fuse block and 4 pin Molex connector; for V3.2 the alignment changed so all capacitors share the same orientation, and the cathode of the 470uF capacitor faces towards the Xiao USB.
- Repeat until you have six leg PCBs.
3.3 Apply the required fix for your leg PCB version
Cut the CAN split-termination traces on V2.0, or edit leg.cpp for V3.2; upstream marks this DO NOT SKIP THIS.
- V2.0: the traces for the split termination CAN bus must be cut. They are on the bottom of the PCB; upstream's PCB readme says its testing showed this feature introduced issues. Cut the traces in the location shown in upstream's V2.0 bottom-view picture.
- V3.2: a software change is required for the new connector positions. In leg.cpp (real_time/xiao_code/lib/HexapodController/src/leg.cpp in the Hex3 repository) change line 53 from axes[0].link(D8, D10, 5, mux); to axes[0].link(D17, D18, 7, mux); and line 55 from axes[2].link(D17, D18, 7, mux); to axes[2].link(D8, D10, 5, mux); before uploading to your Xiao boards.
- After the change the file should read: axes[0].link(D17, D18, 7, mux); axes[1].link(D11, D12, D15, D16, 6, mux); axes[2].link(D8, D10, 5, mux);
3.4 Check each leg PCB before use
Inspect the joints and fuse the leg PCB with a 10A mini blade fuse, then power it alone to confirm the LEDs and Xiao work.
- Check for solder bridges, cold joints and misaligned components.
- Verify connector orientation and polarity before powering the board.
- Insert a mini blade fuse into the fuse block before the power-on test. For the leg board upstream uses 10A fuses.
- Connect each leg board to a power supply, one at a time, and confirm the LEDs and the Xiao operate properly before testing the connection with the main PCB.
- Trim the extra length of the legs on the through-hole radial capacitors to prevent shorted connections.
3.5 Solder the main PCB
Solder the XT60 connector, fuse block, 2x40 Pi header, two DC-DC buck converters, connectors and capacitors to the main PCB.
- Parts: 1x 3557 fuse block; 1x 10uF radial capacitor; 1x 470uF radial capacitor; 1x XT60 board connector; 1x 2 pin male header pin; 1x 2 by 40 female header pin for the Raspberry Pi; 2x DC-DC buck converter; 6x 4 Pin Molex board connector; 2x 3 Pin JST board connectors. The board has solder positions for up to 8 four-pin Molex connectors on the shared CAN bus and power connection, so you can solder your 6 to any of them.
- Optional JST breakouts for Pi connections: 1x 3 Pin JST for the LED ring, 1x 3 Pin JST for PWM0, 1x 3 Pin JST for PWM1, 3x 4 Pin JST (UART0, UART1, I2C) and 4x 5 Pin JST (5V, 4, 27, 22, GND; 5V, 11, 6, 26, GND; 5V, 18, 23, 25, GND; SPI1). At a minimum, the required connections are the two 3 Pin JSTs for the cooling fans.
- Solder the XT60 connector. Hold the iron to the pins long enough for adequate heat to build up before applying solder.
- Solder the 3557 fuse block, holding the iron to the pins long enough for adequate heat to build up first.
- Solder the 2x40 female header with the pins protruding through the top of the PCB. The main PCB plugs into the Pi and rests on top of it.
- Solder the DC-DC buck converters with the correct polarity alignment: the block on the buck converters faces upwards, away from the PCB, and the voltage input for the converters is on the left side of the board, closest to the XT60 connector.
- Add the 1x2 male header in the slot in the centre of the board, then short its pins with a jumper shunt. Alternatively short the two pads together or solder a looped wire. This connection enables a 120 Ohm resistor on the CAN bus network.
- Solder your JSTs, then your Molex connectors.
- Solder the 10uF capacitor with correct polarity: the cathode faces towards the bottom of the board, away from the XT60 and towards the Molex connectors.
- Solder the 470uF capacitor across the input terminals of the upper DC-DC converter: the cathode faces the negative input and the anode faces the positive input.
3.6 Check the main PCB before connecting the Pi
Fit a 20A mini blade fuse and power the main PCB from a supply, before the Raspberry Pi is connected.
- Verify all connectors are installed in the correct orientation, and check for shorts around power paths and regulators.
- Insert a mini blade fuse into the fuse block before the power-on test. For the main board upstream uses a 20A fuse.
- First connect the main PCB to a power supply to confirm the proper voltage reaches the Pi's 5V input and the 24V line for the 4 Pin Molex connectors. Upstream strongly encourages doing this test BEFORE connecting your Raspberry Pi.
- Then connect the main board to a leg board and confirm the leg board receives power when you power on the main board.
- Trim the extra length of the legs on the through-hole radial capacitors to prevent shorted connections.
4. Electronics Setup
Wire the battery, relay and switch, make the wire harnesses for each leg, and wire the encoders and motors.
4.1 Wire the battery, relay and latching switch
A 5Ah Milwaukee M18 battery feeds the main PCB through a JD2914 relay that a latching switch turns on and off.
- Power comes from a 5Ah Milwaukee M18 battery and is sent to the main PCB and distributed from there. A relay handles turning the hexapod on and off through a latching power switch.
- Connections: M18 battery (+) goes to a WAGO and on to relay pin 30 and the latching switch input. M18 battery (-) goes to a WAGO and on to relay pin 85 and robot ground. The latching switch input is battery +. The latching switch output goes to relay pin 86. Hexapod power (+) is relay pin 87. Hexapod ground (-) is battery -.
- JD2914 relay pinout: pin 30 is common (COM), connected to the battery, red wire recommended, main power input from the M18 battery. Pin 87 is normally open (NO), connected to robot power +, red, connected to pin 30 when the relay is energised. Pin 87a is normally closed (NC): not connected, leave unused and insulated. Pin 85 is the coil (-), connected to battery -, black, relay coil ground. Pin 86 is the coil (+), connected to the output of the latching power switch, red, energises the relay when the switch is ON.
- Upstream's power schematic and power wiring photos accompany this section on the page.
4.2 Plan the Raspberry Pi power-on order
The Raspberry Pi 5 must be booted after the hexapod is powered on, which a momentary power button on the Pi handles.
- Due to noise from the buck converters and relay combination, the Raspberry Pi 5 needs to be booted after the hexapod is powered on.
- Upstream says this power cycling can be handled with the Pi 5's built-in power button vias. It recommends right angle headers and wiring in a momentary power button to trigger the restart; the Hex3 lid has a hole for a momentary power switch.
- Follow the Raspberry Pi documentation section on adding your own power button.
4.3 Make the wire harnesses
Cut and crimp 24 AWG four-conductor encoder and time-of-flight cables, 18 AWG two-conductor motor cables and the main-to-leg trunk cables to the listed lengths.
- S0 Encoder to Leg PCB: 120 mm, 4 Conductor 24 AWG, quantity 6. End 1 no connector; end 2 4 Pin JST XH Female Socket Housing.
- S0 Motor to Leg PCB: 130 mm, 2 Conductor 18 AWG, quantity 6. End 1 no connector; end 2 2 Pin Molex Microfit 3.0 Plug.
- S1 Encoder to Leg PCB: 250 mm, 4 Conductor 24 AWG, quantity 6. End 1 no connector; end 2 4 Pin JST XH Female Socket Housing.
- S1 Motor to Leg PCB: 265 mm, 2 Conductor 18 AWG, quantity 6. End 1 no connector; end 2 2 Pin Molex Microfit 3.0 Plug.
- S2 Encoder to Leg PCB: 405 mm, 4 Conductor 24 AWG, quantity 6. End 1 no connector; end 2 4 Pin JST XH Female Socket Housing.
- S2 Motor to Leg PCB: 365 mm, 2 Conductor 18 AWG, quantity 6. End 1 no connector; end 2 2 Pin Molex Microfit 3.0 Plug.
- Time of Flight (Toe) Sensor to Leg PCB: 450 mm, 4 Conductor 24 AWG, quantity 6. End 1 4 Pin JST XH Female Socket Housing; end 2 5 Pin JST XH Female Socket Housing. The toe sensor is optional and experimental: upstream says it is not currently implemented in software.
- Main PCB to Leg PCB: 185 mm, 2 Conductor 18 AWG plus 2 Conductor Twisted Pair 24 AWG, quantity 5. Both ends 4 Pin Molex Microfit 3.0 Plug.
- Main PCB to Leg PCB: 250 mm, same wire and connectors, quantity 1. Upstream says this one is used for the leg behind the battery connection.
- Once the electronics stage is complete you should have at least 1 power assembly, 18 encoders and 6 toe time-of-flight sensors (the sensors being an experimental feature).
4.4 Wire the encoders
Ground each encoder's DIR pin with a jumper, then wire the four-conductor harness to the encoder board and its JST connector.
- The encoder's DIR pin must be grounded. Do this directly on the encoder board with a small jumper wire between DIR and GND; it is separate from the 4 conductor harness.
- If you use upstream's 4 conductor harnesses, upstream recommends this wiring, for consistency with the connector order on the board: red is VCC on JST pin 1; black is GND on pin 2; blue is SCL on pin 3; green is SDA on pin 4.
- When soldering the encoder wires directly to the S0, S1 and S2 encoder boards, keep the solder joints close to flush with the board. Solder that sits proud can stick up higher than the nearby capacitors and stop the encoder sitting flush once mounted; encoders must be installed fully flush in mechanical assembly.
4.5 Wire the motors
Motor polarity does not matter, but keep it consistent, because it sets the axis inversion constants in config.hpp.
- The polarity of the wiring to the motors does not matter, but be consistent.
- The polarity choice affects the axis inversion constants in config.hpp (in the Hex3 firmware, in lib/HexapodController/src). If you connect the negative terminal of the motor to pin 1 of the Molex connector, you end up with the axis inversion values {true, false, false}.
4.6 Wire the leg-to-main PCB cables
Wire the four-conductor trunk cables as purple, red, black and white to Molex pins 1 to 4.
- If you use upstream's harnesses, upstream recommends: purple is GND on Molex pin 1; red is VCC on pin 2; black is CAN LOW on pin 3; white is CAN HIGH on pin 4.
5. Mechanical Assembly
Prepare the printed parts, build each leg from S0 to S3, then mount the legs, PCBs and Raspberry Pi in the base.
5.1 Install the heat-set inserts in the leg parts
Press M3 and M4 brass heat-set inserts into the S0, S1, S2 and S3 parts before assembly.
- Upstream says you can add the heatsets one part at a time, for all the parts of a leg, or for all the parts of all the legs. These instructions are per leg. Refer to the CAD if any screw, heatset or other placement is unclear; all hardware is in the Fusion360 assembly.
- M3 heatset inserts: S0 4x for the encoder mount. S1 4x for the encoder mount, 6x for the base upper and base lower connections, 2x for the motor cover. S2 3x onto the S2 gear side, 4x for the encoder mount, 2x for the encoder magnet mount. S3 2x for the encoder magnet mount.
- M4 heatset inserts: S1 4x for the hub gear connection. S2 4x for the hub gear connection and 6x for the long S2 connector. S3 4x for the hub gear connection, 4x on the S3 gear side to connect the pieces together, and 2x in the toe piece.
5.2 Press-fit the magnets and bearings
Press the encoder magnets flush, then the small 6mmx10mmx3mm and large 25x32x4mm bearings into the leg parts.
- Press fit the encoder magnets. They must be perfectly flush and not installed at an angle. S1: 1x directly on the part. S2: 1x on the removable magnet holder. S3: 1x on the removable magnet holder. Then install the S2 and S3 magnet holders onto those parts.
- Press fit the small motor bearings (6mmx10mmx3mm), which go on any parts that mate with the shaft of a motor: S0 1x on the S0 gear cover; S1 2x on the S1 motor bearing holder; S2 1x on the S2 short connector.
- Press fit the large bearings (25x32x4mm): S1 2x in S1 and 1x in the S1 motor bearing mount; S2 1x on the S2 bearing side and 1x on the S2 gear side.
5.3 Install the encoders
Seat the S0, S1 and S2 encoders flush using the encoder insertion tool, then remove their screws.
- Install the encoders with the encoder helper tool (encoder_insertion_tool in Hex3_resources/cad), making sure they are fully flush against the part. Be careful not to scrape the PCB when installing. Remove the screws from the encoder once it is mounted.
- S0: 1x encoder installed. S1: 1x encoder installed with its cover (2 screws remain through the cover). S2: 1x encoder installed on the bearing side.
5.4 Assemble S0
Fit the S0 motor with two M3x08 screws, the 15 tooth gear and the S0 gear cover with two M3x18 screws.
- The grub screw placement on the 15-tooth gear (the small one) is critical and varies per motor, so refer to the CAD for confirmation. Upstream also recommends applying some Blue Loctite to the grub screw when attaching the gear to the motor shaft.
- Attach the motor to S0 using two M3x08 screws.
- Add in the S0 gear cover spacer.
- Add the 15 tooth gear to the S0 motor shaft with the grub screw closest to the motor.
- Attach the S0 gear cover with two M3x18 screws.
- Leave the rest of the assembly to a later step.
5.5 Assemble S1
Fit two motors into S1 with three screws each, add a 15 tooth gear to each, the hub gear on four M4 screws, and the motor cover on two M3 screws.
- Install the two motors into S1, using only the 3 screws closest to the encoder on each motor. Route the wires out the back of S1.
- Route the encoder wire out the back of S1, through the two motors.
- Add in the S1 motor bearing holder.
- Add a 15 tooth gear on each S1 motor shaft with the grub screw closer to the motor base.
- Install the hub gear using four M4 screws.
- Install the S1 motor cover using two M3 screws.
- Leave the rest of the assembly to a later step.
5.6 Assemble S2
Fit the S2 motor through the S2 short and long pieces with six M3x08 screws, add the 15 tooth gear and the hub gear on four M4 screws.
- Install the S2 motor through both the S2 short and S2 long pieces. Connect them using 6 M3x08 screws.
- Add the 15 tooth gear to the S2 motor shaft with the grub screw further from the motor.
- Install the hub gear using 4x M4 screws.
- Leave the rest of the assembly to a later step.
5.7 Assemble S3
Build the spring-loaded toe with M4x60 screws and close S3 with two M4x30 and two M4x35 screws.
- Install the hub gear with the S3 gear mount.
- Combine the spring, spring aligner and toe together with M4x60 screws.
- Place the toe assembly into S3.
- Optionally add the toe distance time-of-flight sensor. This is an experimental component: upstream says the sensor has not been fully implemented in software at the time of writing.
- Close the assembly using four M4 screws (two are M4x30 and two are M4x35).
- Leave the rest of the assembly to a later step.
5.8 Join S1, S2 and S3 into a leg
Press the S1, S2 and S3 assemblies together and lock them with three M4 screws.
- Attach the S2 gear side into S1 by inserting the bearing connection piece from S2 into S1.
- Lock the S2 gear side and S1 together by adding the S2 motor bearing mount and the S1 motor gear holder.
- Connect the S2 bearing side and the S2 motor assembly using 3 M4 screws.
- Sandwich together the S1/S2 gear side assembly, the S3 assembly and the S2 plus motor assembly. These should all be press fit together and locked with 3 M4 screws.
- The leg assembly is complete. Repeat for all six legs; the legs are attached to S0 and the base in the next step.
5.9 Prepare and assemble the base
Attach the leg PCBs, S0, relay and PCB mounts, HDMI and USB connectors, base lower, legs, Raspberry Pi and base upper.
- Attach all M3 and M4 heatsets according to the Fusion360 assembly. Press fit all the bearings into the leg flats and install the S1 bearing holder into each.
- Attach each of the six leg PCBs to a side of the hexapod base.
- Attach S0 using the 2-4 M4 screws on the leg flats.
- Install the relay and the PCB mount plus PCB guard. Upstream's mechanical page points to its electronics page for these; that page does not describe them, so use the Fusion360 assembly.
- Install the HDMI connector and USB connector onto the base lower.
- Attach the base lower using M4 screws. The long M3 screws should go through the base lower and into the S0 attachment.
- Carefully insert the leg assemblies into the sides of the hexapod, meshing each leg's S1 hub gear with the S0 driven gear (refer to the CAD if gear alignment is unclear), and take care to align the 3 M3 screws on the base upper and base lower.
- Install the Raspberry Pi and wire the power switches onto the base upper. Attach the base upper in place.
- Upstream says assembly is then complete, with all six legs ready for calibration.
6. Real-Time Firmware and Calibration
Build and flash the Xiao RP2350 firmware for each leg with PlatformIO, then calibrate every leg.
6.1 Install the tools and open the firmware project
Install VS Code with the PlatformIO IDE extension and open real_time/xiao_code from the Hex3 repository.
- Requirements: VS Code with the PlatformIO IDE extension, and a Seeed Xiao RP2350 connected by USB. Upstream says library dependencies (RP2040_PWM, PID, RP2040PIO_CAN and the Adafruit VL6180X toe-sensor driver) are declared in platformio.ini and installed automatically.
- The firmware is in real_time/xiao_code in the Hex3 repository; upstream's Hex3 page links the repository from its project glossary. The firmware page does not give a download command.
- In VS Code use Open Folder and select real_time/xiao_code. PlatformIO picks up platformio.ini, which targets the seeed_xiao_rp2350 environment.
6.2 Create user_config.hpp for each leg
Copy TEMPLATE_user_config.hpp to src/user_config.hpp and set a unique LEG_NUMBER from 0 to 5 for each board.
- user_config.hpp is intentionally left out of git because it holds per-board settings, so create your own copy before the firmware will build.
- Copy lib/HexapodController/TEMPLATE_user_config.hpp to lib/HexapodController/src/user_config.hpp.
- Set LEG_NUMBER to the leg (0 to 5) this board is mounted on. It must be unique per leg. It also sets the board's CAN node ID: 0x100 + LEG_NUMBER for commands from the Pi and 0x180 + LEG_NUMBER for replies, which is how the Pi's can ROS2 node addresses each leg.
- Set LOG_LEVEL and TELEMETRY_LOGGING_SPACE for how much serial telemetry you want while debugging.
- Add or select an #ifdef <YOUR_NAME> ... #endif calibration block for this leg in lib/HexapodController/src/config.hpp, using the calibration step below to generate the ZERO_POINTS values.
- If you have V3.2 leg PCBs, make the leg.cpp change from the PCB assembly stage before uploading.
6.3 Build and upload the firmware
Build and upload with the seeed_xiao_rp2350 environment, then confirm the board boots on the serial monitor at 115200 baud.
- With the seeed_xiao_rp2350 environment selected in PlatformIO, build to compile the firmware.
- Upload while the Xiao is connected over USB.
- Open the PlatformIO Serial Monitor at 115200 baud to confirm the board boots and prints its CAN tx/rx node IDs, along with joint position, velocity and acceleration telemetry.
6.4 Calibrate each leg
Set the ZERO_POINTS to 0.0, hold the leg in the calibration pose with the hexapod off, read the joint positions from the serial monitor and enter them for that leg.
- Create a user profile in the config.hpp file (not config.cpp). It has the form: #ifdef USER, then #define STEP_THRESHOLD 40, #define FIFO_IDLE_THRESHOLD 100, then #define ZERO_POINTS as six rows (one per leg) of three values each, every value written as a number plus CALIBRATION_OFFSET_A0, CALIBRATION_OFFSET_A1 or CALIBRATION_OFFSET_A2, then #endif.
- To calibrate, set both the config values and the calibration offsets to 0.0, so every entry reads 0.0 + 0.0.
- Turn off the hexapod, move the leg to the calibration position and plug the Xiao RP2350 in on the mainboard. In the calibration position: S1 is parallel with the side panel of the hexapod; S2 is as far down as it can go, with the 3 wires going into S1 laid out flush (the distance between S1 and S2 is exactly 1 wire diameter); S3 is as far up as it can go (the distance between S2 and S3 is exactly 1 wire diameter). Upstream's calibration instructions picture shows this pose.
- Upload main.cpp and turn on the serial monitor. You should see a value like: {"Joint": {"pos": [0.547631, -0.836020, 2.787243], "vel": [0.000049, 0.006216, 0.000052], "acc": [-0.001082, 4.619407, -0.000955], "duty": [80.000000, -80.000000, -80.000000]}, "voltage": 0.730000, "toe": 0.000000}
- Add the code to the leg you are calibrating. For example, for Leg0 the first row of ZERO_POINTS becomes 0.547631 + CALIBRATION_OFFSET_A0, -0.836020 + CALIBRATION_OFFSET_A1, 2.787243 + CALIBRATION_OFFSET_A2, and the other five rows stay at 0.0 + 0.0.
- Upload the code to the leg and make sure it is in a standing position. Confirm in user_config.hpp that you set the correct LEG_NUMBER.
- Repeat for all 6 legs.
7. Raspberry Pi Setup
Flash Raspberry Pi OS, install Docker, enable the CAN interface, pair the controller and build the ROS2 container.
7.1 Flash the SD card
Flash Raspberry Pi OS (64-bit) to a 64GB+ micro SD card with Raspberry Pi Imager.
- Requirements: Raspberry Pi 5; micro SD card (64GB+ preferred); micro HDMI to HDMI cable; USB keyboard; USB mouse.
- Download the Raspberry Pi Imager. Select Raspberry Pi 5 as the board and Raspberry Pi OS (64-bit). Select your micro SD card.
- Select your configuration settings. Recommended: host name hexapod-<last_name>; user hexapod<last_name>; enable SSH via authentication.
- Click save and wait. Once flashed, plug the card into the Pi and connect the peripherals.
7.2 Install Docker
Install Docker with the get.docker.com script and add your user to the docker group.
- Update the system: sudo apt update && sudo apt full-upgrade -y
- Download the Docker install script: curl -fsSL https://get.docker.com -o get-docker.sh
- Install Docker: sudo sh get-docker.sh
- Add your user to the docker group: sudo usermod -aG docker $USER
- Log out and back in, or reboot, for the group change to take effect: sudo reboot
- Verify the installation: docker --version, docker compose version, docker run hello-world
7.3 Add the CAN config overrides
Add dtparam=spi=on and the mcp2515-can0 overlay to /boot/firmware/config.txt.
- Open the config file: sudo nano /boot/firmware/config.txt
- Add these lines to the end of the file: dtparam=spi=on and dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
7.4 Set up the CAN interface service
Install can-utils and create a canbus.service systemd unit that brings can0 up at 500000 bit/s.
- Install can-utils: sudo apt install can-utils
- Get the path to ip with: which ip. Upstream's example result is /usr/sbin/ip.
- Create /etc/systemd/system/canbus.service containing: [Unit] Description=CAN Bus Interface; [Service] ExecStart=/usr/sbin/ip link set can0 up type can bitrate 500000, Type=oneshot, RemainAfterExit=yes; [Install] WantedBy=multi-user.target. Use the path from the previous command.
- Bring the service up: sudo systemctl start canbus.service
7.5 Pair the Xbox controller
Pair an Xbox Core controller through Raspberry Pi OS's Bluetooth UI or the terminal.
- Connect the Xbox Core (Series S, X, etc) controller using Raspberry Pi OS's Bluetooth UI or the terminal.
7.6 Set the robot name and build the ROS2 nodes
Put your hexapod's name in robot_name.local.txt, give it a unique ROS_DOMAIN_ID, and run colcon build inside the dev container.
- The Pi and ROS2 code is in the non_real_time folder of the Hex3 repository, linked from upstream's Hex3 page. The Raspberry Pi page does not give a download command.
- Open non_real_time/container/src/ros2_ws/src/hexapod_manager/config/robot_name.local.txt and add your hexapod's name. This should be the only text in the file.
- Make sure the robot name is in non_real_time/container/src/ros2_ws/src/hexapod_manager/launch/hexapod.launch.py with a unique ROS_DOMAIN_ID.
- From non_real_time/container, initialise the dev container with ./init_dev.sh, get a new shell with ./new_dev_shell.sh, then build the ROS2 nodes with colcon build.
- The changes take effect the next time you restart the Pi. To test sooner you can also run: docker compose -f docker-compose-prod.yml up
7.7 Start the walking stack
With the hexapod powered on first, the Pi booted and the controller connected, launch hexapod.launch.py inside the dev container.
- Power the hexapod on before booting the Pi 5, as described in the electronics stage.
- Switch the Xbox controller on and connect it to the Pi over Bluetooth before launching.
- Inside the development container run: ros2 launch hexapod_manager hexapod.launch.py. This launches control, joy, inverse_kinematics, can_interface and tripod_gait in one go and is upstream's standard way to bring the hexapod up for Xbox-controlled walking.
- Optional: ros2 run hexapod_manager led_controller drives the LED ring on the bottom of the hexapod. ros2 run hexapod_tester hexapod_tester sweeps body pose and foot targets without a controller, with the launch file running in another shell.
- CAN debug commands, run in the Pi terminal and not in the docker container, normally not needed because a service brings CAN up: sudo ip link set can0 down; sudo ip link set can0 type can bitrate 500000; sudo ip link set can0 up; candump can0; cansend can0 123#DEADBEEF