Hexapod 18 dof micro servo

by Ferretti Aug 18, 2014
Download All Files

Thing Apps Enabled

Please Login to Comment

I have now finished building this and it works but I have this little problem with it, legs keep twitching like this all the time.


How does the robot know where its legs are? ie: If i use your code how easy is it to plug in new values for its inverse kinematics. Because I'm thinking about scaling it up a bit

How much you think this build can lift additional weight? I'm thinking about building this and then something on top of it.
It is possible to run MG90s with 6V for additional torque.

Hi Ferritti!,
I do not understand how the legs of the robot will mount, I have already printed a leg and I found the size too large for the micro servants I am wanting to use. What can I do?

Is there a bill of materials ?

Comments deleted.

Hi Ferretti!
I'm also almost finished building this amazing hexapod of yours, with the same hardware, but I also have some issues with the code. Everything is working well at lower servo movement speeds, except when the speed is increased with PSB_PAD_RIGHT button, then the servo movements are not synchronized anymore with timings in the other part of the code I think and so the hexapod moves like a cat with ducktape sticked to its paws :) joke :). I also tried the delay that Shiul93 suggested, but no luck. At higher speeds movements are still far from smooth. Is there any chance to take a look at the code once again or if you maybe remember the default values that you changed in Phoenix_SSC32.h and Phoenix_input_PS2.h, or even if any of you guys figured out the solution for the smooth movement, I would really appreciate it :).

Hi Ferreri!
First of all thanks for the awesome design! Enjoyed printing things and getting things complete and together.
Question: I got some issues in uploading the code to the Nano... It is missing files ad compilation gives errors... Is the code basically plug'n'play? or do you have a source where all the code (including includes) can be found?

Comments deleted.

Just want to give a warning about MG90s servos from eBay. I got burned by buying them off eBay from China (seller x431shop).
Half of servos don't move, others make terrible noise and get stuck sometimes. I was able to get stuck ones moving again after I disassembled them and "relived pressure" by not tightening screws all the way. They still get stuck tho. So I ordered few from Amazon and these work great, so I'm now sure eBay ones were 100% fake and defective (visually you can't tell, except for horns are very tight on fake ones). So keep that in mind, and buy from reputable seller, or at least test them right away (I didn't touch them for months so it was too late to return).

Hi Ferretti!

I'm working on a laser cut hexapod and using your model as a reference. Is there a reason why two servos in femur are offset (one above other)? In your 3D model they are on the same level.

Thanks! :)


yes, to reduce the femur length so the small motors can lift the hexapod more easely.

Thanks, that makes sense!

Hi Ferretti, I currently make project hexapod,I use arduino mega, torobot 32 controller servo, ps2 wireless controller and 18 MG946R servo, I download your source code, modify suitable with my design (dimensions tibia, femur, coxa and some distance of body...) and finally compile with some waring but no error, I test with my hexapod, I use terminal and bluetooth see what's value send to torobot 32 servo, value right but all servo run very lag (I mean no smooth like you) I don't know why differently, Please help me,I really appreciate for your help man!


is your battery enough for your servos ? amp and voltage ?

you can try to add a delay like explain in the comments of Shiul93 here : http://www.thingiverse.com/thing:432829/#comment-605065

or you can try or ask to the original maker of the code : https://github.com/KurtE/Phantom_Phoenix

Hexapod 18 dof micro servo

Thank you for your reply,I'm using Lipo battery 3S 11.1V and module buck DC-DC (12A,6V) (12A and 6V Voltage for 18 servo)
I think that's too enough, I tired to try and test every thing but nothing change, all servo run lag, asynchronous and sometime not run although value send I see in terminal absolutely right? What 's wrong with my hexapod? Please let's me know,thank you so much!

i don't know, it is difficult to say, i don't know/own your build, i don't know/own your servos, etc. i can't test it to see what are the real problem....

maybee your servo are too slow, adding the delay mentionned by Shiul93 will help, i don't know.

you may also contact the ceator of the firmware: the only thing i've made is making it compatible with the torobot controller and my build. but i'm not the creator of the code.

Ok,very difficult to explain more detail here, just tell me what's different between torobot 32 controller servo and SSC-32, I already read datasheet and know frame transfer something like like this #1P1500...T100 two of them same? So I can't find it?

i don't remember well, it was a lon time ago: but the string givent to the controller was a little bit different.

but as tell you, i think you must look at the delay of Shiul93. i think the original code was made for very fast servo.

By the way, Can you tell me where I find "delay of Shiul93" you already mention? How can I find it?

in the comments here
here is the direct link to the comment i've post 3 comment before:

Hexapod 18 dof micro servo

Oh, thanks I read comments below and find it, I mean about add delay(150) in code ssc-32 pheonix when I'm run your program all servo run relatively synchronous but obviously slow and non smooth, this is real solution solve problem?

Hi Ferretti. i finish printing and building the hexapod too, but idk how you connected the servos,(how do you connect them in to the torobot board) i mean do you have the complete circuit diagram? Thanks a lot!!

yes, just some comment down ;)


Hexapod diagram
by iwfas

Thanx... DO i have to upload something on to the 32 channel board?? I alredady connected the servos and everything but it does nothing.. :( Help me Pleaseee

no. the controller should already have the firmware ( check with the vendor if not)

the arduino communicate the servo positions via serial. but your servo controller may use a different format for the command.

in this case, you must adapt the code for your controller (i don't remember where exactly, it is now 2 year since the project was finish)

ps: first try to communicate directly to your servo controller by connecting the usb port to your pc and use the arduino ide serial window to try it and determine if the command format is the same as the torobot.

Hi Ferretti. i finish printing and building the hexapod. im not sure thought what i need to do next. I downloaded the source code and uploaded it to arduino. Do i need to edit something in the source code that you provide. if yes, what are the files needed to edit? can you give me ang example? thanks.

As far as i remember the code is the code i was using . If you have exactly the same servo controller, servo and PS2 controller/receaver. you don't have to do anything.

ps: i've buid it 2 year ago,maybee i forgot something.

Im using different servo controller but when i check the documentation their functions are some what similar. Maybe i'll study more about this and see if i can make this compatible with my servo controller. Anyway thank you for the reply, you're awesome..

check the format of the string passed to the servo controller. if i remember well, i've modified it for my controller.

Hello Ferretti Thanks for sharing this awesome design
Im already printed the whole hexapod...but im having some issues with the bearings i cant find them here in Ecuador... so im just wondering if you could send me the 3d files so i can redisign it a little bit.
I will apprecciate it
this is my email [email protected]
Please let me know


i've uploaded the source file : you must use 123d dedign to edit it.

hi all ( ferrtti )

so i have all my parted ordered and the last one coming in 2 days so i am just finishing up on printing this monster but after looking at the design where will i be mounting my nano/torbot server controler i cant seem to work it out looking at the pictures maybe it will all make sense when i have all the parts printed also is the ps2 box just meant to hold the wireless broad out side its case

any help would be great only asking just wanted to know if i have to redesign some parts :)

thank you


the torobot is screwed under the top plate.
the nano is lock verticaly between the top and back part. (you can see the hole for the usb in the top plate.)

the box for the ps2 is not mandatory, it is only a slimmer case: the original case is hard to insert (with the ubecs and all the servo wire) inside the body.

Hi Ferretti,

I printed and mounted the hexapod. I use a SBEC Turnigy 40V input and 5V/6V-5A output from Hobbyking (http://www.hobbyking.com/hobbyking/store/__42119__Turnigy_5A_8_40v_SBEC_for_Lipo_EU_warehouse_.html).

Hexapod seems to work fine but I have two questions :

  • I have to power my Arduino Micro with USB otherwise it will reset when I press the START button on the PS2 controller.
  • When the hexapod is walking, It can not bear the weight knowing that the battery is placed directly outside the robot.

An idea about problems please ?

P.S. : My hexapod is like yours for all structure and servos.
Sorry for my English because I'm French ;)

Thank you.

it seems to me that you have power drop, try to use 2 sbec in parallel. (it is what i do)

ps: j'utilise 2 regulateurs en parallèle car un seul n'arrivait pas a supporter le pic quand tous les moteurs etait en carge. et oui je suis aussi fracophone ;)

Un francophone !!! ;)

Merci pour ce retour rapide. Je vais en commander un autre pour essayer. Mais pour le moment ils sont en rupture de stock.
Je ferais un retour une fois que tout sera OK.


J'ai reçu mon deuxième Sbec et maintenant tout fonctionne correctement, mise à part que je suis obligé d'alimenter mon Arduino Micro par USB sinon en passant par la carte SSC-32U il reboot intempestivement 8(

Pour le calibrage des pattes de l'Hexapod, j'utilise Lynxterm. Est-ce que je dois suivre certaines étapes comme dans ce tuto pour le positionnement des pattes ?

Merci ;)

tu peux alimenter l'arduino avec les bec aussi ;)

ps: pour uploader le firmware, met le bot sur off(ou debranche la batterie)

Pas de soucis je ferais comme ça une fois que j'aurais réglé les pattes et que tout fonctionnera correctement. Merci de ta réponse ;)


Alors voici un petit retour sur l'hexapod. Tout fonctionne après réglage complet des pattes et mise en place de frein filet.
Par contre, est-ce que tes régulateurs de tension chauffent beaucoup ou pas ? Car les miens sont brûlants au bout de quelques minutes. Du coup je n'ose pas le faire fonctionner trop longtemps...

je ne me souviens pas si les régulateurs chauffaient. : j'ai fait cet hexapod il y a plus de 2 ans, et il est depuis longtemps recyclé ;)

Ok pas grave, je ferais des essais pour voir s'ils ne chauffent pas plus que çà ;)

Juste une dernière petite question, au bout des pattes tu as mis quelques choses d'anti-dérapant ?
Parce qu'en brut d'impression l'Hexapode glisse sur le carrelage ou la table.
Je pensais mettre des patins de chaises en gomme pour voir. Dans l'immédiat, il est inutilisable...

oui, une goute de silicone transparent. (ou du ninja flex fondu dans ma 2ieme version)

mais le fait de bien configurer les tailles (pattes et taille du corp) fait que l'araignée glisse moins.


I want to achieve this hexapod with Arduino Mega or Nano card (I have both).

  • We must put an SSC-32 kind of controller board with the Nano but with Mega is it necessary?

What code I need to take to operate the set as there are two different codes :

  • Hexapod_code.rar of 01-09-15
  • HexaPodMega-master.zip on Github

Thanks in advance. Very good project ;)


i think it can be done with a mega board only, but my code is for a ssc32(or 24) board.

i don't know the code hexapodeMege-maset.zip. it is not my code, i didn't put any code on github for this.


Hello, Ferretti.
What UBEC you used (model)? You have the link? tks ...

Hello, I again! the bearings are tabbed F623zz or without 623zz tabs? The measures it would 3x10x4mm?
And you have the schematic?

non tabbed is fine

one question!
the bearings 623 you have any image or video showing where to place?

at the opposite side of the servo horn so it make a rotating axle

hello, dear! congratulations ...

I wish to make a hexapod as well. You used an Arduino NANO or MEGA, have a torobot 24CH. My doubt, it would work in a control PS3 with a USB host shield or only PS2 control?
Can I use a PS2 control, as soldering the wires?
Tks a lot! and sorry my poor english.

i've used a nano + a torobot 32ch (you need at least 18 ch).

i've never used ps3 with usb host. so i cant say anything except "why not?"

yes you can solder the wire of a ps2 controller.

ok thanks! i´ll ask for help in the future!

Comments deleted.


Just finished assembling the hexapod :-) I did use the cheap ebay servo clones MG90S, works perfectly for a short time then the servos get hot and loose some torque.. Will try with genuine servos later :-) Servo controller is a "LOBOT" , a board from ebay with ps2 controller.
Software compiles when the missing libraries is installed, only had to comment out the stabilisator and edit the baud rate to 115200.

Nice robot !

i'm having the same problem with the MG90S... is there a better source for the servos?

thank you,

ps: stabilisator, is a feature not yet implemented/finished because, arduino nano didn't have enough memory :( it was ment to stabilize the robot to horizontal when walking on a non horizontal plane.

Ferretti, or anyone else out there, is it possible to upload the completed code without the bugs?

If i remeber well after one and a half year, the adafruit library is for the stalilisator : you can disable the stabilisator and comment (//) the include of the file

For the coding, do I simply just plug in my arduino nano, open your files, and upload?

if you are lucky yes. otherwise you find yourself problems with your configuration and you must code yourself

I've found the ps2x_lib file and created a library for it. software won't let me compile the sketch because of missing adafruit file. did you download an adafruit.h file or simply tweak the sketch by typing "//". If you see this, I really do appreciate your help.

Comments deleted.

yes, thank you clawfinger. had I seen your post earlier I would have saved a bunch of time...did you heavily tweak the programming? I can't seem to get past adafruit.h

Big step to finish. i have uncommend the softwareserial and pin diffination, and over the torobot software in the options set the baudrate. autodetect only works over usb.

When i use you code, in the terminal only comes "ps2 1 or 0 " but nothing else
original phoenix code sound a peep by pressing start. sorry 4 my bad english

ok stabilisaton was on :(
I wired like the pikture in the commends. but nothing. the torobot controller recive no commands.

didn't you inverse the tx-rx wire (tx on one rx on the other)?

tx from arduino to rx on torrobot bord.

i tryed on a mega 2560 to. i changed the pin´s from

define cSSC_OUT 1

define cSSC_IN 0


define cSSC_OUT 18

define cSSC_IN 19

to use the second hardwareserieal. but nothing. tomorow i played with the baudrate.

Hi! Did you ever solve this problem? I'm having same problem now.

could you tell me the code for it to work?


I don't know what you want me to say : the code is in the file section, it is a fork of the Phoenix source code . (Google Phoenix hexapod)

Hello, how many nuts and screws did you use ? And also what kind... I know it's m3 but I don't know the length. I'm using this model for a robot project in my school and I'm going to order every pieces needed so... ^^
Oh and what kind of battery do you recommend ?
Thanks !

16mm or 20 mm m3

6 on top 6 on bottom

i'm using 7.4v lipo battery 1300mah

hoops forget 18 M3 of 16 mm for the legs bearing.

Ferretti, thanks for the awesome design. I have finished printing all the parts and starting to assemble it. One question though, did you use the same servo horn mounting screw to attach the servos to the legs or did you need longer ones? I am using TowerPro MG90s servos (I think just like you) and I don't know the size of the horn mounting screws. Maybe M2.3 x ???? long. Thanks again.

I have a box with all junk screw i found. i think it was pc motherboard mounting screw or harddrive mounting screw. But i realy don't know the exact size..

Hi Ferretti,

Thanks for your reply but unfortunately I have some more questions if you don't mind :) How is the LED's connected? Are they connected to the Nano or the torobot? I looked at the hex_chg.h file and the Phoenix_Input Ps2 files and there's an LED_EYE_PWM_PIN defined as Pin 0. I just assumed that this is pin/channel 0 on the torobot but my 24 channel torobot doesn't have pin 0. I have a lot of RC experience and to use a servo to control an LED, we usually hack an old servo and replace the servo motor with the LED. Am i on the right track?

Also since you have the 32 channel torobot, I am assuming that I have to modify the pina ssignments on the hex_cgf.h file to match where I connect my servos on the 24 channel torobot. I probably should ask ICOBOY how he wired his and what changes he did to the files since I think he used the 24 channel serco controller himself.

Again thanks again for your patience and help.


the eyes are connected to the torobot, the LED_EYE_PWM_PIN is the pin for controling the eyes. ( 0 mean that i've desactivated the eyes at the time i've save the hex_cfg.h, surely to try the autolevel with a 3 axis compass. btw it didn't work because ive not enough memory on a nano to implement the alorithm completely)

yes, you must change the pin for your 24ch torobot. my pinout was only for the ease of wiring (ive used pin nearest to the servo ;) )

ps: i'm a noob in RC, (that was my first robot ever), i found your trix to use of a old servo for controling a led very clever, i note that in my hall of fame tips ;)

Hi Ferretti,

Thanks very much for the reply. It is clearer now. I didn't read the code too much so I didn't notice that '0' meant disabled. I will surely pay more attention now to the code since I have to change the pin assignments anyway :)

sorry... but I don't know where is the part "hexa_side" going to be used?
ps. plz forgive my poor English.

between the legs on the side. you can see it on the first picture : the part where the servo cable goes.

Oh!!!!!!! I see that! Thank you so much!! I guess something just covered on my eyes. :'(

you could help me with the code to Arduino Mega and servos MG995?

sorry but i don't own the same configuration as you.

I made a hexapod with 18 servo motors and servo MG995 with mega shield Arduino, I wonder how to modify your code to control my hexapod with Arduino Mega and control ps2.

you must reimplement the servo controller, it will not be a peace of cake.

İ have new desing but i need to connect to ardinio + servo controller +( ps2 + wifi ). İ didnt find to connecting them.just 1 photo is enough for me .Can u help me ?
thanks for everything .

if i understand well, this what you are searching :

Hexapod diagram
by iwfas

U are best , thanks bro , ı hope ı will make it without your help cuz i dont want make you bored on me
i will try and i will tell you , if i cant , can i want help from you ?
thanks for yes or no :)

all the informations for the mounthing and coding, and configuration are already in the comments ;)

Cool looks like we are making some progress , I have my nano in today so I am going to rebuild my bot the right way finally.
I still really want to know why

Hi Ferretti , seems like your bot still moves much more naturally stil looking at the original video based on the code discovery iwfas and Shiul93 , and I have been making it seems the delay was part of the issue. You mentioned earlier that
you had to modify the ssc32 driver protocol to match the torobot protocol . and that there where little differences, Baudrate fix,
end of line and the Time parameter.

1.torobot protocol - check seems right.

  1. Baudrate fix - check I think its currently taking the baudrate right.
  2. end of line - not checked this yet. Maybe
  3. the Time parameter - servo time or the delay fix.

Hi Ferretti , thanks for the clues any other possible things we can check ?


Hi. edmen1, Ferretti.

My servo controller is broken yesterday because short-circuit.

So i can't try anymore without the servo controller.

I ordered same thing with Ferretti's. (torobot)

Maybe delivery is expected to take two weeks or more.

I hope that there is no issue such as below with the new one.

But i wonder why that this issue happens still.

I want to applaud you for the passion.

Good luck !!!

Thank you.

Ha Thanks iwfas, sorry to hear your servo controller fired. dont give up we are going to make this damn thing work. : )

well i am into robotics I set a goal to build a robotic spider it has always been a personal challenge to see if I could do it , I been facinitated by I.K and control systems like these. And one major reason is because I believe In pushing my limits in order to grow and learn.
no mater how crazy the idea is. the measure of ones success is going to be determined by how well you execute on those personal challenges how ever small or large! .

I just feel lucky I found a group of guys that are as crazy and passionate about robotics improving their skills by building something as crazy complex and awesome and interesting as a robotic spider. a great way to keep you sharp.

we are going to crack this thing : ) in the spirit of exploration and learning.

and one day one of you guys better build a robotic military spider or one that explores mars!

I am currently reprinting the parts again, I started designing a modular harness to hold all the electronics and allow for more easy unloading of the nano and battery too.

Hi Shiul93, cool so for sure 150ms makes it work best, I am thinking further mapping of the timing is needed to understand how execution time and synchronization between the controller and the control algorithm is responding.

for sure I know now that the delay causes the controller to "keep up" with the control algorithm , I wonder if it comes down to simply tuning the algorithm timing constants to handle the rate at which each move takes to execute.

I think your on the right track , adding the move time is definitely related. I am going to do some measuring see if we can understand at least what kind of time response would be required to have true synchronization for crazy awesome fluid movement.
/////code snip////
//Send SSCSerial.print("T");
SSCSerial.println(wMoveTime + wMoveTime/2, DEC);

/////code snip////


except the fact that i don't use the same tx-rx pins and i power the nano from the controller pin (with diode, to avoid to power the controller, when the robot is plug in usb).

I don't see any other difference.

ok so I decided i am going to attempt to understand this really complex code.

One way to understand a complex machine is to dismantlement it
and then put it back together. : ) the engineer way haha

First step is ripping out chunks of code that appear to not do anything : ) haha seems there is alot of junk dna in here. for the purposes of learning how this thing ticks I tried to remove code that has nothing to do with key motor functions.

I boiled the main control loop down to the key parts that control motor function, and started looking at the section that feeds the IK adjustments and timing.

-I removed all the sound related stuff , I think I'll move it to a separate module eventually something that can be enabled and disabled from a higher level in the code.

-removing the audio stuff appeared to help with latency believe it or not. I am using a arduino UNO which is something like 8 Mhz
, nano is coming in mail soon. by the way ferretti are you using a arduino nano still its worth asking i guess.

  • I am currently treating the IK calculations like a black box. but I think Iwfas made a great discovery yesterday in terms of troubleshooting
    by adding a delay we learned that, the motor controller is being blasted by commands faster than it can process them apparently
    the next step is to understand why exactly that is why the delay makes it work better I still don't understand how that plays with the IK engine time servo processing caculation that appears to account for the moment the leg through.

it seems like Ferretti's code doesnt have it through..., now It might be that we are sending commands that are not understood by the controllers parser its self too~.

for this I think we need to double check the protocol we are using is not getting mal-folded ,
I took a look at this by transmitting on the hardware serial , pins 0 and 1, and I can see the string of chars that is sent to the controller.
it appears fine but I have not cross checked it with this document.

I think we need to make some minor modifications.

Control multiple servos ignore the . ( thing verse has issues display # )

Data 1, 2, and 8 refer to the servo’s channels
Data 600, 900, and 2500 refer to the locations of the
servos that correspond to three channels
Data 100 refers to the time of execution and <----------------------------NOTE this T is the time of execution : )
represents the speed of three servos.
Regardless of the number of servos, there is only one time, or one T.
The command is executed at the same time; that is,all servos operate simultaneously.

/// output to controller is below: ignore the // thing verse has a bug

// a break down

and P is position. //#27P1412 //#28P2307 //#29P2307 //#21P1652 //#22P1894 //#23P1660 //#18P1431 //#19P2307 //#20P1795 //#4P1406 //#5P1773 //#6P1446 //#10P1610 //#11P2307 //#12P1999 //#13P1373 //#14P2001 //#15P1895 T1 <---------------------- 1 wow could this be the reason : ) , maybe , iwfas maybe you can take a look , I am in USA I suspect you are someone on the other side of the globe maybe you can check it out while I sleep 2:44am now. lol . Thanks everyone for the effort and hope this helps someone get their bot working too: by the way one condition we need to post photos of our bots you guys are awesome I have had a ton of fun working on this stuff with you guys. sorry the formatting got screwed up in this message for some reason. Hopes this pushes the progress forward a bit more. Best Regards edmen1

Wow, that was some interesting research! Yesterday I played around a little with the code and changing the old delay patch with this



SSCSerial.println(wMoveTime + wMoveTime/2, DEC);



makes it to walk better and more smooth in the normal walk mode, hope it helps!

Best regards

pd: Sorry about my english, I know is painful to read, but im trying to do my best :P

if you trace the time variable passed to the torobot string,

you can see that it dependent on a variable modifiable by ps2 button associated with speed. you can try to reduce speed this way to see if it's help.

i've change the ssc32 driver protocol to match the torobot protocol . there where little difference, but i don't remember well witch ones. Baudrate fix, end of line and the Time parameter, but i don't remember well, sorry it was a long time ago.

one difference from the wiring diagram posted here :
i don't think this is the resolution of this problem but i don't use the same TX RX pins on the servo controller : i use the one next to "servo 1"
and i take the 5v/gnd for the arduino vin/gnd (with a little diode) there too, this way i can plug to usb and see what are send to the servo controller.

many code are not used, but generaly they are in #ifdef statment, like stabilisation, ledbar and GP player ( preprogrammed movements in phoenix code).

the sound is interesting only to know in what state your robot is (it's help a lot in the beguining ;) ).

ps: i use a 4$ chinese clone of arduino nano ( how have you put a uno in the body? you are a magician or have verry litle fingers ;) )

Hi iwfas and Shiul93,

Yes! , I can confirm that adding a small delay definitely helps mine is moving like your video moves now. but not smooth yet.

I am starting to suspect configuration issue with interrupt from ps2 controller maybe ? that would explain the command not having enough time to execute ?
anyway big thanks I am starting to make progress again!
what do you think

OMG! yes thats a good Idea good job! I am going try this right now to see if it works for me as well.

Ill be back ill try this out.


Hi Ferretti, firstly thank you for your response.

Hi. edmen1~

Do you have same controller with mine ??? (there is picture below)

It's work in only 9600 Baudrate. (I think auto detection is not working)..

I found soume solution for this issue. But this solution is not perfect yet~~~.

I just added some delay after tx command end of line .


SSCSerial.println(wMoveTime, DEC);

delay(150); // <<====================== add delay.......

After add the delay code, the working is much better. but it's too late. ( because of the delay, so it's not perfect solution.)

But I can't understand... why?????

I'm trying to find the perfect solution still.

If i find the solution for this issue, I'll tell you~

Please let me know, if you find the solution.

Have a good luck..~~~

Thank you.

The delay(150) worked for me! It does not walk as smooth as the ferreti, but is pretty good! :D
You can se it here:

Thanks a lot!

Oh. Good~~

But I think it is not real solution.

The movement is not smooth. Also too late,

So I'll try to find the other solution.

If i find better solution, I'll post here......

Have a nice day !!!

Thank you.

Hi iwfas, seem we have same problem, you find better solution to solve it? Please let's me know,tks :))

OK I went back and tried a fresh copy of the source again this time only commenting out the header references to the stabilizer sensor and sensor define the enables all the stabilizer algorithm related stuff.
thats all i changed.

I compiled and tried to run again, on the bot and used the ps2 controller to attempt to make the bot walk.
it worked a bit better but still cant seem to get the bot to move smoothly like your video.

any other ideas?

whats the button combinations to make it walk ?

there is no combinaison.

you have just the left front 2 button to select, walk, translate or rotate mode.

that seems when I put it in walk mode nothing moves, maybe your right about the baud rate. Ill play around with baud rates and see if I get better results. thanks.

nope changing baud rates causes it to not work : ( , makes sense actually . I am using 9600 baud and it appears to semi work. seems the electronics side is correct. I enabled terminal mode, and added a printf to inside the walkmode portion of the code,
to know when I am in walk mode with serial connected.
seems I can get into walk mode in the code by pressing select on ps2, but then the bot doesnt move.

starting to run out of ideas, I feel tempted to mess the code now but fear the risk of breaking something.
is there a easy way to override the code to do a walk mode test?

tomorrow Ill trace deeper into the code to see if I can start getting my head around the overal state machine of this system.

Best Regards.

Comments deleted.

I tried changing the baud rate, and the only on that works is 9600, in the description of the controller said that has baud rate autodetect, but it doesn't... Maybe the problem is with the protocol, but I dont know

yours works right? so there is something special about your setup still. I am going to start again with a fresh copy of the source in a few minutes and simply try to run it out of the box with the minimal adjustments , like commenting out stabilizer and binary mode.

maybe something is broken in my code now.

be back in a few minutes.
best regards.

No, mine dont work well, im with the same problem as you

sorry guys, i can't help you.

maybee your controller is compatible with the ssc32 controller and you can start from the original code from tossenrobotics.


Oh, I didn't know that you had modified the controller besides the rotation direction and the stabilizer. I'll try with the original ssc32 controller, thanks for the advice!
What did you change in the controller file?

Thanks again for the help!

i honestly didn't remember well, i made the modification 1 year earlier.

i think it was little difference in the protocol string, baudrate and the fact that all my legs are in the same direction ( i don't have left or right left, all the legs are the same, but that i think it was in the phoenix.h code)

fyi :

the initial code come from there

maybee the community of tossenribotix have drivers for your controller.

I think I am having the same issue as iwfas now.

Hey Ferretti, thanks again, you mentioned you adapted the ssc32 protocol to match the torrobot's controller?
I looked into the docs for both and the protocol appears similar but maybe not the same.

I am using the same blue colored 32 USB servo controller. Does the code posted on this page , have that adaptation ?

I would be extremely grateful if you update the code sketch or share what header files should be updated.
to make it work with the same controller as iwfas. I have the same exact wiring setup now too~ : )

Hey iwfas, does your servos just twitch or not move at all not move? you may also have to look into power connections make sure you are supplying enough current.

i don't own this controller, so i can't adapt the code.

your on your own, sorry.

ps: you can plug your robot to usb to see (via the serial monitor) what the code is sending to the controller.

Hi Ferretti, thanks for the info just to confirm so which controller are you using ?

this one http://randym.name/blog/47.html

ps: some possibilities if the protocol is the same :

pay attention to the baud (they says that auto detetion of baudrate work, but it don't for my controller, i need to fix it)
pay also attention to the "end of line" '\n" or \r" or both

Hi Ferretti, thank you for your response, turns out I have this controller too actually I am going to check those suggestions.

Thank you for your help I really appreciate it :)

Hello Ferretti.

I love this hexapod. Thanks your effort!!

I finished assembling the circuit yesterday.

I download the firmware code in here.

PS2 controller is working well. (I can hear beep sound, When i use to the PS2 controller)

But the servos is not working.

Can you check the electric diagram ???

Also I bought 32 channel controller in this site.

When i use this controller, should i modify the firmware code. ("Phoenix_Driver_SSC32.h")

I'd like to make this hexapod fastly.

Please, help me~~

Have a nice day.

Thank you.

Hexapod diagram
by iwfas

it seems ok to me.

when you plug tour exapod to the usb, did you see the command send to the servo controller?
are they in the correct format for your controller ?

i've modified the original phoenix driver ssc32 to match my torobot controller protocol. maybee you must adapt for yours.

I was able to run the code after disabling the binary mode and the stabilizer mode but something strange is happening.
The bot is not moving smoothly it is interrupted every half second. and only 2 of the legs are moving and not correctly .
any Ideas ?

see the comments with icoboy : it is surely due powerloss/ regulator (18 servos is a lot for ubec regulators)

good suggestion I'll look into that.

Ill be back after I trouble shoot the power.
i thought i saw a connection diagram in one of the threads. the power connections would be very helpful,

Thanks again.

I believe you have the same issue as me, try to push the square button while you give it an order, I dont know why, but that trick made mine "walk"...
Look at my last video (https://www.youtube.com/watch?v=S_trTmtb2Jk) you can hear me pushing the button as it walks...

Yes, I also discovered that pushing the square button repeatedly makes the bot twitch but not move smoothly.

I am going to do some experimentation this weekend I ordered a fresh controller just in case to try out.

Does your bot walk smoothly like ferretti's?

Best Regards

No, I tried changing some code, but my theory is that the controller is the problem, and im looking forward to buy a new one.
This is the controller i'm using: http://www.ebay.com/itm/32-Channel-Servo-motor-USB-UART-Controller-wireless-PS2-controller-ROBOT-Arduino-/151604236857?pt=LH_DefaultDomain_0&hash=item234c511239

I am using the exact same thing. mine moves simular to yours now but I cant seem to get it to walk .

HI Shilu93, I think you and I have the same issue now for sure I also thought maybe the firmware on the controller needs to be updated ?

Maybee it is somthing with the speed

i remember (sorry almost a year now) similar problem with the speed set too high : the servo didn't go fast enough to match the command

try to play with the left pad up and down. ( g_InControlState.SpeedControl in phoenix_imput_ps2, if i remeber well)

Hi Ferretti , I adjusted the speed control variable I made it larger seems now I can get exact same behavior as iwfas, I was looking through code to see what the controls where seems I can only get in place movements but no walking motion just in place moving.

how do you normally control your bot to walk?

Hi Ferretti. Finally after 2 month waiting for servo replacements, in my first try a few servos were broken or not working properly, my hexapod is complete and working well.


Thanks a lot for your help and your patience.

Hexapod 18 dof micro servo
by icoboy

Nice! Did you change anything at the code? What servo controller are you using? My hexapod don't want to walk yet...

Hi Shiul93, I don't change anything in the code I'm use a Torobot 24 channel controller.

the two ubec are going from the battery to the servo controller.
One is directly connected to the servo VCC, and the other share the servo VCC and the chip VCC
like this : http://uppix.com/f-Untitled54c9cd3200184458.png

the arduino is powered by a 5v pin on the servo controller.
i use one of the 5V pin from the uart ( http://www.elechouse.com/elechouse/images/product/32-Channel%20Servo%20Controller%20V2/mini_USB_motor_C.jpg )

i added some some diode, because if i plug the arduino nano in the usb, the servo controller was powered by the vin pin from the arduino oO. As a result, communication arduino-controller was interfering with the usb communication. i was unable to upload sketch when the servo controller was connected.

the ps2 receaver is powered by the arduino.

I read in the Servo Controller Documentation that needs between 6.5V and 12V for direct powering in VCC ( VSS in documentation )


I thought to powering with the following schematic:


What do you think ?

your switch will only cut the power to VS :your arduino and tour servo controler chip will always be on as long as the battery is plug.
=> move your switch 1cm higher ;), on the -(or+) of your battery: before anything in your schema.

if your arduino is like my cheap chinese one, you will power the servo controler chip from the vin of the arduino when the arduino is plug on usb. As a result you not be able to upload your sketch whitout disconnecting your RX/TX pins.
=> add a diode to only allow "incoming" current to the vin (just before your vin pin)

Hi Ferretti . How do you connect the Servo Controller Chip to power supply, at 7.4V directly from the battery in the VSS blue connector, or at 5V in the pin that are above TX, from the UBEC or Arduino ?

I'm not sure if my Question is a little bit confusing.

Thanks for your patience .

I completed mine yesterday! Although I have trouble to move well ... But I think it is the fault of the electronics I put inside, that does not provide the necessary power.
Thank you very much for the design, Ferretti!

good job.!

i've put 2 ubec regulator (3amp and 5A peek) in paralel to handle the pic of Amp of the start. (RC battery also help, they can handle High amp discharge)

I have 20C 1000mAh LiPo batteries and one UBEC regulator like this one http://www.ebay.com/itm/151387847413?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT , this may be the problem I guess...
I made a video (https://www.youtube.com/watch?v=m8ZmKdnD2WM), but as you can see it does some strange movements and does not walk at all... (minute 2:30, the rest of the video remains static)

I can't see your ebay link due to location restriction.
i use 2 like this one (but without buzzer) http://www.hobbyking.com/hobbyking/store/__22494__Turnigy_3A_UBEC_with_Low_Voltage_Buzzer.html

@ 3:30 i see the problem i had with only one ubec ! (the legs moving all in the same direction, it was the arduino and/or the controller resetting)

for the erratic movement when trying to move, i don't know exactly : try to change the speed in the code (if i remember well it is in the ps2 controller code), maybee it is the servo moving to slow to follow the code speed. maybee due to the power problem. but 'im not sure.

I've changed the old UBEC with two 3A, 5A peak new ones and the problem is still there :S

However I discovered that if I hit the square button on the controller while giving it an order (walk, go up and down or rotate) it apparently works!


Ferretti Hello, I have finished assembling the hexapod but now I have lots of problems with the phoenix code configuration. Maybe you could share your phoenix code ? or if that is not possible maybe you know any guide about this topic. Thanks a lot for your help and excuse me for all these requests but I'm a total newbie in the hexapods building.

Hello, I've added my modified version of the phoenix source code to the files of these page.

there are modifications to reduce the size of the memory on the arduino, but to make the exapod working, only 3 files realy mather

Hexa_cfg.h => physical dimention of the Hexapod
Poenix_input_PS2.h => change some default value to match my hexapod size and speed
Phoenix_SSC32.h => changing some differencre from the original SSC32 protocol to match the chinese clone

But beware, there a some part of my code that does not work/ is not finish.
I was working on a Stabilisator with a 3 axis compas (HMC5883), but the arduino nano didn't have enough space/cpu power to properly compute the stabilisation.

Comment the line "#define STABILISATOR" (line 29) in the hex_Cfg.H to disable the stabilisator.

Nice! Im almost done with the assembly of my hexapod too, do you mind sharing a photo of it in its base position? I mean, with all the servos at 90 degrees, im afraid of assembling wrong the legs.
Thank you for all your work!

To adjust the servo : i set them at 90° with a servo tester (you can do it with a arduino by setting it @ 1500pwm)

=> for the "shoulder servo":
the arm must be in the axe of the servo (the axe of the arm pass by the 2 screws of the servo).

=> for the 2 others,
i install them in the "femur" and the 2 arms must be align (ie the axe of the arm pass by the 2 servo gear).

and that's it.

I don't have like other hexapod different configuration for left/right legs :

the difference is done in the code :
i test on the index ( < 3 )of the legs to know if it is a right or left leg and adjust the angles there.

(precisely in the file phoenix_Driver_SSC32.h in fonction ServoDriver::OutputServoInfoForLeg @ line 317)

Thank you soooooo much.

no problem, i'm impatient to see other person building it ;)

for mounting the body, M3x16 or M3x20 will do. (M3x20 mandatory if you use the battery holder update)

m3x16 +whasers for the bearing side
and i'm not sure for the other side (gear side fo the servos) : it's spare HDD screws ( m2.5x1 ?)

Same HDD screws for mounting the Servo controller and the door to the body.

no screw needed for the arduino nano.

Hello Ferretti,

What length are the screws that you used in the hexapod? I am in the process of buying all the parts and I don't know what should I buy...




I use a 2 cell 2000mah lipo battery (7.2V ) with 2 basic RC Ubec 5v 3A in parralelle connected to the servo controler. the arduino nano is powered by it's vin from a pin from the controler. the ps2 receaver is normaly connected to the nano.


Hi Ferretti,

My attempt at building a hexapod has taken much longer to start building than I anticipated - two tries at printing have caused our printer to give up on me...

However, it would be really helpful to know what did you use to power your original hexapod?




the biggest problem is not realy the torque, it's the solidity of the gears:

i've used the generic 9g with plastic gear, but i got 3 broken during developpement.

so this exapod use mg90s : the cheapest chinese servo with metal gear. (for exemple here @ 4$ http://www.befr.ebay.be/itm/MG90S-Metal-Geared-Micro-Tower-Pro-Servo-For-RC-Helicopter-Boat-Car-/351185483911?pt=Radio_Control_Parts_Accessories&hash=item51c4493887 but you get even better price when buying 20 of them)

ps: the first version has torque problem, so i reduce the length of the 'femur' : no more torque isue so far.

These 9g servo hexapods, are people generally using the higher-end metal gear servos, or do you guys think the cheaper generic ones would have enough toque?

I've try the adafruit controller, it's a great product but for these exapod i prefere the chinese (or scc32) for some reasons:

  • you don't use the i2c pin, i only use tx/rx pins.
  • you can easely use the pins of the controller to power other thinks in your robot : you got pins with 3v, 5v and other at the same as your servo voltage. it make your circuit realy simple. in my hexapod, it's a controller pin that power the arduino, the ps2 receaver and the magneto compass, and the leds.
  • communication is realy simple : just do a Serial.print to move all your servos at once.
  • with the adafruit controller you must control the time yourself : the chinese allow you to make command like " i want servo 5 at 67° in 237ms". much much simpler and you don't use processing power/time to do that.
  • the adafruit library use precious Kb of sketch place.
  • the chinese controller allow you store command group (for pre-recorded movements, you event got a program to record then on your desktop)

on the downside : the chinese controller don't let you play so easely with the pwm because it only allow range between 500 and 2500 pwm.

BTW : it is not cheaper. i got my 32 controller plus a wireless ps2 controller on ebay for about 30$.

I used one of these you can double them up if you need more than 16 channels.... https://www.adafruit.com/products/815 it is somewhat cheaper, even if you get two.

yep 18 servos for the legs.

you can use the rest for dimming leds, add a claw, a sonnar or whatever you want. the only limiting factor is the arduino nano memory (phoenix code left only 4k )

Thank you very much for the info . I ordered a 24-channel version of the controller you used. I think I won't need more than 18 channels, right?


the servo controller is a torobot 32 servo ( search on ebay, it's the cheapest chinese 32 ch controler, rarely branded as torobot) and the 'brain' is a Arduino nano.

I used a modified version of the phoenix code (phantomX) . and is far as i see in the code the controler is almost the same as the ssc32 (except 2-3 command not compatible like, the disable of the servos or resert of the card for exemple)

here is a exemple link for the controller :


Hi, awesome project. Can you tell me which servo controller has been used ?

this one is the smaller version, the bigger version is here http://www.thingiverse.com/thing:448619

but as you already have problem to print this one, i don't recommend you to use the taller vesion as it is also much thinner on the side.

Update Hexapod 18 dof micro servo

here we go for the quadruped version : http://www.thingiverse.com/thing:483806

18DOF Hexapod To 12DOF Quadruped modifications

Thank you very much :) Did yo use the smaller version of the leg from this one? tibia-v2.stl

yes, i've cut it. (first i was using plastic gear servos, and the horn was smaller)

to secure the horn in time, you can glue it with standart glue or melted pla (i use a 3d pen to weld the pla parts)

here is a early video of my quadruped, as you can see there a lot to do in the coding part ;)
and you can see that the servos have a hard time to lift the quadruped.

as soon as i have time i will post a new thing with the other customising element i have. (quadruped version of the body, legs, etc)

no problem all i ask is not to sell the design.

Fyi: it was printed in 0.25 layer height with 0.4 nose,3 perimeter and 20% infills on a k8200/3drag.

if you want, i can post the 123D design file, so you don't have to redraw all the parts.

I've try 12 servos, but standard 9g servos with plastic gears are too weak to support the weight of the battery. you must use metal gears, plastic gear can easely break (i used the cheapest mg90s).

if your quadruped has problem to stand up, a solution is to use shorter "Tibias" and "Femur" to reduce the lever.

if you want i can give the files for my 12dof quadruped too. all is the same except for the upper an bottom plate. (and some side wall with holes to pass the servo cable, but it's not necessary)

ps:if you have problem printing the legs, i got also 2-3 design for the 'Tibias'

Hi, the leg came out ok but was not great so if you have other versions I can try that would be great I used the version from your updated thingi hexa_leg.stl. Part of the problem is the rounded bottom and rounded edges really do not print well on a bigger nozzle. I have another printer with a 0.35 nozzle I can try that and see if it comes out better.

I am using the same servos MG90S as you, so should be ok, if the quadruped doesn't work out I'll order more servos and try the hexapod.

did you cut the horn short for the epaule_v2.stl? Because my horn does not fit in the slot, it is short by about 2-3mm.
The rest seems ok, but i need to drill out the servo attachment screw holes. I have the bearings on order.

I don't need the 123D files as I don't know how to use that program, I only use openscad, but it wouldn't hurt to add those files for others to play with.

I'd love to see your quadruped version :) Thank you.

Thank you that makes more sense now.

I'm going to print up a leg and see how it comes out. Does not slice too well at 0.7 wall width.
I'm going to lose the front and back legs and make a quadruped as I only have 12 servos :)
With your permission I may remake these in openscad so I can adjust for different bearings and make some of the walls thicker.

Thanks for the great design.

the bearing is used to get a axe of rotation for the servo. (to avoid torsion on servo horn: you get better movement, stronger articulation, and less force needed to move)

you don't need glue, it's far more simple :
there is a hole in all the servo bracket to clamp a m3 nut under the servo.
just push the m3 nut in the hole, screw the servo in place, and voila. you can screw the bearing with a M3 bolt and 2 washer to the clamp.

from left to right you have : servo => nut => servo clamp => washer => bearing => m3 bolt

for the ease of assembling i mount the bearing at the end :
-first i mount the servo in the bracket with the m3 nut clamped.
-then i mount the horn to the servo and clamp it to the other part of the articulation.
-and finaly i screw the bearing with a m3 bolt to finish the articulation.

ps: i apply the same principle for all the hexapod, you get also hole for the nuts in the side/front/back part of the central part of the body.

Any chance of getting some more details of how to construct the legs? Like how are the bearing used? are they attached to the servo or is there like an M3 glued to the back of the servo that goes through the bearing? -- Thanks

Great to hear that.

the heaxpod is simple so i thing it will be good for teaching. But i suggest you use nuke code instead of the phoenix code for the programation part.

Phoenix code beautifull but he is realy too advanced and complex for beginners.
Nuke is more simple. He don't use interrupt, servo movement speed interpolation , he is less dependent of controler protocol or input method etc.

I am looking at using the hexapod to start teaching robotics and programming to a group of students who start their studies in September.