Phoenix code any 3DOF 18 servo hexapod

Hi everybody, <p>

After 8 long months, some trigonometry lessons and a lot of experimentation I finally was able to get my hexapod running and walking great. I tried using several different servo controllers. A torobot, one stamped with a decepticon and a pololu. The sequencer programs are pretty cool but theres lil documentation (except the pololu but no hexapod code) and most of it is too vague to get them going using a code or micro-controller and the sequencer just cant capture that creepy walk.

So it was either learn a lot of code and alot of trigonometry which i did learn from the helpful folks here at LMR and Robotshop. But i was still far from writing my own code.

Thats where lynxmotion came into it and please believe me this is the easiest way but you will still need a lil math skill.

In this tutorial i am going to hopefully explain how to apply the code to your hexapod. PLEASE read all the way through before starting.

Lets start first by going over the items you will need.

1X Lynxmotion SSC-32U USB servo controller

1X Lynxmotion Botboatduino or any arduino microcontroller

18X servos

1X frame kit of your own design or someone elses. Google 3D printable hexapod for many options. Lynxmotion also makes frames and there are generic ones on other sites.

1X 7.4v lipo 1000mah

1X 11.1v lipo 500mah to 1000mah

1X 12A 5volt voltage regulator. Pololu makes awesome voltage regulators in many amperages. Youll want one with a lil higher amperage than you need. The MG90 servos i use draw 6A total so im using a 9A which takes care of the boards power too.

1X computer

1X PS2 TX/RX

And a lil patience.

Lets start by learning how to hook the boards up to eachother and powering them. The link to that page is here....

http://www.lynxmotion.com/images/html/build99f.htm

Next we will need to download the latest version of Arduino. This program is what we will use to upload the the Phoenix code to the Botboarduino.

You can download the IDE from straight from arduino here..........

https://id.arduino.cc/auth/login/?returnurl=http%3A%2F%2Fwww.arduino.cc%2Fen%2FMain%2FSoftware

Next we will need the actual phoenix code to upload to the board you can find that here.........

https://codeload.github.com/Lynxmotion/3DOF-4DOF-Hex/legacy.zip/Botboarduino

Ok now before we begin this assumes that you have the servos wired to the Lynxmotion SSC-32u board correctly. It also assumes you have that board wired to your Botboarduino correctly. Also make sure your PS2 TX/RX pair ate connected to the Botboarduino correctly. You can double check all these by opening the program files in arduino and opening the hex_config.h file. We'll come back to that shortly.

You should have been asked to download the hexpaod calibration tool to help you calibrate the legs positions. Its legacy software and out of date so go ahead and down load Lynxterm from here.......

http://www.lynxmotion.com/p-567-free-download-lynxterm.aspx

Open the program add power to your SSC-32U and connect it to the computer using the USB cable that came with your controllers. You wil need to have changed the Baud rate to 38400 on the SSC-32U manually. See the users manual here for that info....

https://www.robotshop.com/media/files/pdf2/lynxmotion_ssc-32u_usb_user_guide.pdf

Now use the slider on the legt to move each servo and putting it into its perfect alignment.

While your doing this you will need to find the mechanical limits of your legs. The best way to do this is to align like it says in the build instructions then use this calculation to find the angles.

30* X 4160 / 360 - 1500

The 30* is how many degrees you want the servo to turn from 1500 or servo center 90*

<p€ Experiment moving the legs back and forth til you find the angles between each servo. Basically move your front and rear servos in to where you are comfortable with the angle. This will be your rearmost and front most mechanical limit angle for the front and rear legs. Next move the middle legs to the point where they meet the front and rear servos this will be your mechanical limit angles for the middle servos. Write down the the angle in degrees for each leg.

Once its calibrated click the H2 seq button on the Lynxterm then hit write. You can also read the board here to make sure your corrections saved.

If you are completely satisfied that you have done everything correctly up to this point we can now begin to Phoenix code your bot.

1 Like

Ok go ahead and power your
Ok go ahead and power your hexapod and connect your USB cable to the Botboatduino and the computer.

Move the code files to your Arduino library and open up the Arduino IDE program.

Click file then choose examples and look for Botboarduino_CH3R_PS2. Go ahead and maximize the screen then click on the file called Hex_cfg.h.

From we will start from the top and work our way down.

{Botboarduino pin numbers}

Check that these connections are correct to your PS2 RX head.

{SSC pin numbers}

Here you need to comment out "//" all the Tar pins. This is for 4DOF and since we are building a 3DOF these arent needed. Remember to double check your servo connections to the SSC-32u at this point as well.

{Min/Max Angles}

Find the leg angles degrees you wrote down earlier and use them here. Just add a zero and thats your number -is the legs reverse angle while the other is the positive angle. You can experiment with these angles later and tweak your movements but for now lets go with what we have.

For the tibias and femurs angles start out small like 35 and up it to your discretion.

Dont forget to comment out any 4DOF parts here as well

{Leg Dimensions}

Enter your leg IK measurements here. Coxa length is center of the servos pivot to the center of the vertical coxa servos center pivot. Next the femur, measure from center coxa vertical servo to center servo tibia and enter this numbers. Now measure from the tibias center servo pivot to ground level. Thats it now go down the rest of the list commenting out // the 4DOF.

{Body Dimensions}

Leave the default coxa set up amgles as they are and look down. You will now see two sets of six banks asking for the body dimensions. Just remember X is left -X is right, -Z is reverse while Z is forward.

{Start Positions Feet}

You will need to change these values. Add the total length of coxa and femur. To get Cos60 multiply .5 by the number we just made. To do sin60 multiply .866 by the first number again. Start out with an inity at 30 amd move up.

Next go to the bottom and comment out // the TARS parts.

We are now done with the hex_cfig.h file.

Now choose the file called phoenix_driver _ssc32.cpp. Scroll down til you see a header marked [outputservoinfofor legs.

Some servos have different PWM which can alter movement if the pwm in the code does not match your servos. Change these two numbers only of nothing else works.

Scroll down a lil further and youl see a comment labled //update right leg with 4lines of code then another 4 lines of code. Some times some servos operate reverse from other servos. If that is the case with your bot and your servos are reversed you can change that here. Just negate the positive lines and remove the - from the negative lines.

Now click tools/board and pic arduino duemilanove or diecimila.

Next check that the port is proper. If the words are gray its not connected. Now choose the right arrow key next to the checkmark button on the top left hand corner of the IDE.

When its done uoloading remove the USB first then disconnect the power. Wait a min them power it up. From here it should walk just fine. Use the intstructions with the build manual for the functions. Or check the code in arduino under PS2_controller.cpp

And thats it. Hopefully your hexaod is now walking. But please rember there is no guatantee that the code will work for your project but it should.

If further help is needed feel free to post or send a PM.

Thanks everybody that helped me. I hope this helps some one too.

I have a LynxMotion AH3-R

I have a LynxMotion AH3-R Hexapod and have been using your guide to help me get it up and running.

My issue is that the link to the starting code is now dead and returns a 404, do you know of another location where I could find starting code?

At some point I want to write my own code to control it, but with not much experience with legs I want some code for me to see how it works.

 

Thank you,

Dan

Hexapod Source Code

Try https://github.com/Lynxmotion/3DOF-4DOF-Hex.

 

Thank you ggallant!In case

Thank you ggallant!

In case anyone else wants to try the link, just make sure you remove the period on the end of ggallant’s link.

Glad my tutorial is helping.
Glad my tutorial is helping.

Anyone needing the code can also check out the lynxmotion site that has all kinds of info and downloads.

Make sure to get your hexapod alligned properly. You can use lynxterm to push each servo to middle then save it to the SSC-32U

hexapod

My hexapod project is completely stalled. Please post some videos of yours working.

I would have no problem
I would have no problem doing so but i have no voltage regulator right now. I was using a pololu 9A but i was still having brown outs.

If you can tell me where your stuck at i might be able to help.

I would have no problem
I would have no problem doing so but i have no voltage regulator right now. I was using a pololu 9A but i was still having brown outs.

If you can tell me where your stuck at i might be able to help.

Hexapod status

I fried my voltage regulators about 3 years ago doing hexapod pushups. Designed a new circuit board that contains a 3 amp regulator and 4 servo headers, one for each leg. Built one and lost all motivation. Also think the linxmotion aluminum chassis is too heavy for the motors so any effort may be a waste of time. What I need is a hexapod challenge.

can i ask you somthing abo the code?

can i ask you somthing abo the code?

Tutorial

Excellent tutorial - keep it coming! Might really want to edit your first post to include all steps (instead of replying, which makes navigating the tutorial in its entirety a bit harder). If you have issues doing this, we’re happy to help.

1 Like