MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now


Hexapod Robot

by markwtech Mar 2, 2019
Download All Files

Thing Apps Enabled

Please Login to Comment

Hi! The servo port assignments are in the Arduino code:

const int COXA1_SERVO = 19; //servo port definitions
const int FEMUR1_SERVO = 21;
const int TIBIA1_SERVO = 23;
const int COXA2_SERVO = 25;
const int FEMUR2_SERVO = 27;
const int TIBIA2_SERVO = 29;
const int COXA3_SERVO = 31;
const int FEMUR3_SERVO = 33;
const int TIBIA3_SERVO = 35;
const int COXA4_SERVO = 37;
const int FEMUR4_SERVO = 39;
const int TIBIA4_SERVO = 41;
const int COXA5_SERVO = 43;
const int FEMUR5_SERVO = 45;
const int TIBIA5_SERVO = 47;
const int COXA6_SERVO = 49;
const int FEMUR6_SERVO = 51;
const int TIBIA6_SERVO = 53;

The legs are numbered 1 to 6 clockwise starting at the front right. You can see the leg assignments in the figure on my website https://markwtech.com/robots/hexapod/

Thanks for the clarification. I haven't looked at the software much yet so this is important information that isn't found in the photos and diagrams. It turns out the servos ARE numbered like a normal person would do it, unlike the Trossen/Phoenix code. This makes the servo wiring a lot easier to understand and hook up. Thanks again.

Hi markwtech,

I've almost finished building your Hexapod and am starting to wire up all the electronics. However I noticed there was no diagram of how the servos are numbered, and this is critical for the wiring. At the moment I'm assuming that the enumeration of the servos is the same as in this image, which I found on Trossen Robotic's web pages. Is this correct? It looks like something a not-normal engineering-scientist-coder type person would do, number the servos all higgledy-piggledy, left to right, front then back then middle legs, rather than one leg at a time, from center outward, in a clockwise direction like would make sense. You may want to add this image to your Thing so people don't have to dig to find it. Without this the Hexapod would not work at all.

Hi markwtech,

I've got the parts printed as per spec. I am in Australia so I had to order the metric equivalent of screws.
54 4-40 nuts (M3 x 0.5mm)
210 4-40 x 3/8" machine screws (M3 x 10mm)
96 4-40 x 1/2" machine screws (M3 x 12mm)
12 4-40 x 5/8" machine screws (M3 x 16mm)

Are M3 x 10 (4-40 x 3/8") supposed to be used for assembling Tibia ? I found the screws are bit too big for the holes and the parts are getting damaged :-(

Could you please verify if I have got the correct metric equivaleent screws ?

Hello! The actual equivalent length of 3/8" screws is 9.525mm, so what you have (10mm) is a slight bit longer, but that should be OK. The tibia sides are indeed assembled to the foot plate, base plate, and spacer tube with the 3/8" screws, and the additional length shouldn't matter for that. Is the plastic splitting when the screws are driven in? Perhaps it's because 4-40 screws are 0.112" in diameter, which converts to 2.8448mm while M3 screws are just a bit larger in diameter than that (the reference I found says they are actually 2.980mm diameter). If you find the M3 screws are splitting the PLA pieces, you may want to consider something smaller in metric, like M2.6 screws for example, if you can't get 4-40's. Good luck!

Yep the plastic did split because of diameter mismatch.

I also tried to measure the internal dia of the holes and it turned out to be 1.86mm and the screws were like 2.9, so I was thinking of getting M2 which are about 1.9mm. Interestingly its only the tibia base plate, tibia cylinder and tibia foot plate that have smaller hole size, the tibia sides, ,foot bumper holes are perfect.

Getting 4-40 in Melbourne locally is next to impossible. I tried to order from the link that you had provided and unfortunately those guys do not export to Australia.

I have printed and painted all the parts, received all the electronics already, so I am not stopping now, I will find a way to get the right screws :-)

Thanks for your quick response.


Good observation. The places where the screws go through a part (like the tibia sides) are all sized 3.00mm and the places where the screws go into a part (like the tibia spacer tube) are all sized 2.26mm in my Fusion360 CAD. The smaller size is done to give the screws some "meat" to grab onto when driving them together. I experimented with the 2.26mm dimension and found it worked well for PLA and the 4-40 screws I used. Another option for you might be to simply drill out the 2.26 holes to something slightly larger - like 2.5mm if you can find a drill bit in that size. That might work so you don't need to order new screws.

awesome! I'll try that. I think I might have some PCB drill bits. Thanks!

Thanks for information. Again, one of my favorite projects.

George S.

Comments deleted.

Is there a way to modify your code to make the gait(s) faster? Lots of positive reviews from my friends about the one I built.

Thanks Again.

George S.


Hi George! Glad you are enjoying my design.

The "duration" parameter defines the walking speeds. Find the line in the compute_strides() routine:

if(gait_speed == 0) duration = 1080;

You can change 1080 in that line to a smaller number to make the hexapod walk faster.

The duration parameter is subdivided into numTicks in the four gait engines, and numTicks in turn defines how many movement steps the individual leg movements go through for one complete cycle. For example, in the wave_gait() routine, numTicks is calculated to be 9 for a duration input of 1080 (1080/20/6 = 9). I recommend keeping duration to be a multiple of 120 so this math works out cleanly, although there is a round() function in the code, so it shouldn't really matter. If you go too small, the foot won't raise and lower properly as it goes through its movements.

Try changing the 1080 in the code to 960, 840, 720, 600, or 480 for a faster gait.

Can this be fully controlled by the PS buttons or just pre programmed motions?

The PS controller joysticks command all the movements - there are no preprogrammed motions. If the hexapod is in a walking mode, the joystick inputs makes it walk forward, backward, or sideways depending on how you press it. Similarly, if the hexapod is in a translate (stationary) mode, the joystick inputs make the body move accordingly. The PS buttons just change the modes, the joysticks control the actual movements. I included the complete arduino code source in the "Thing Files" section... take a look.

Many thanks, I've already been checking! Amazing project, I will use my Xbox One controller and buy the servo motors asap

I added a f3z file with the main roll-up assembly ("Hexapod") and the two subassemblies ("Assembly - Body" and "Assembly - Leg"). There are also individual components for the brackets, servo mounts, SBEC holder, receiver holder etc. but the body plates and riser sketches are in the "Assembly - Body" file. Hope this all makes sense to you.

Nice job on the f360 design, super organized and very helpful, thanks again! If I actually get around to making this I'll make sure to post a make.

Thanks, appreciate that I'll take a look shortly

Nice work! Don't suppose you'd mind uploading the fusion file for modifications? Thanks either way