Category Archives: Project Hexapod B.E.T.H.

Project B.E.T.H.

The Game Plan for B.E.T.H.

So at this point B.E.T.H. is a stock MkII PhantomX Hexapod with stock code. Pretty boring. The provided code is great for impressing your Mom, but if you really want the attention of your heart’s desire, you’re going to need your own code!

I think the best part of this is learning how it all works. You can stare at other people’s code all day long, but to really “get it” you have to figure it out and write it yourself. So here’s the game plan:

On to Phase 1: Driving the Servos!

Or head back to the beginning of Project B.E.T.H.

PhantomX Software and Electronics Setup

Once the MkII PhantomX Hexapod is built, it’s time to setup the software and electronics. I’d break it down into the following general steps:

1. Start charging your battery!

Connect the included Imax B6 charger to the wall with the power supply and barrel plug adapter. Connect the lipo battery using both the main deans power connector and the JST balance cable. This plugs into the 3S port on the charger. Scroll through the programs in the charger until you see “LIPO BALANCE CHARGE”. Hit enter, set the current to 1-2A, and the voltage to 11.1V 3S. When the settings look good (I’m not a battery expert, do your own research to get a feel for charge currents) hold the Enter button for a bit until it beeps and does a little test measuring your battery. It then tells you that it finds a 3S, and asks if that sounds correct. Hit Enter again to confirm and off it goes.

2. Arduino Setup for the Arbotix Robocontroller.

An “Arduino” is a family of easy-to-use microcontrollers based on Atmel AVRs. The Arduino IDE includes some handy software libraries for interfacing with a lot of the components in the hardware. The Arbotix Robocontroller uses an Arduino compatible Atmel AVR (ATMEGA644p), but some of its functions are not supported out of the box. So you need to add some libraries. This is outlined pretty well on their support wiki. Just follow the “Arduino Software Setup” section and you’ll be good to go. Don’t worry about any of the PyPose stuff, you don’t need any of that to get the hex up and running.

You should also download the latest MkII PhantomX Hexapod code from Trossen and put it into your Arduino sketchbook folder so its ready to go. If you’re feeling ambitious, give it a compile. If your libraries are setup right it should compile with no errors or warnings.

3. Pairing the Xbee radios.

The kit comes with two Xbee radios that must be paired in order to talk to each other. Basically this means that they need to talk on the same channel (ATID), at the same baud rate (ATBD), and have cooperating receive (ATMY) and send (ATDL) addresses. This forum thread is a great tutorial on how to pair the radios using the MaxStream X-CTU utility. The only variance from the guide is that the PhantomX kit comes with a UARTsBee instead of the Xbee Explorer, but they are functionally the same thing. And don’t worry about the Python Terminal stuff, you only need to use the X-CTU GUI utility. Once that’s all set, plug one of the Xbees into your Commander controller.

4. Programming the hex

The last step is to program the Robocontroller with the Trossen provided code. Break out your UARTsBee and check out how it will all go together here. Make sure that the little switch on the UARtsBee is set to 5V. Note that you don’t want an actual Xbee installed on the UARTsBee. The UARTsBee itself is the FTDI interface which we need for the programming. Its a multipurpose device. Also make sure that the power jumper on the Robocontroller board itself is set to ‘FTDI’ and  not ‘VIN’. This means that we’ll be powering the board with the UARTsBee and not your battery supply.  Also make sure that you DO NOT have the Xbee plugged into the Robocontroller. The Xbee radio and the UARTsBee serial interface share the same resources and can not be used at the same time.

Connect the UARTsBee to your PC with the USB cable. If all is well it will show up as a virtual COM port in your Windows Device Manager. In the Arduino IDE, select ‘Arbotix’ as your Board in the Tools Menu. Serial Port should be set to the virtual COM port of the UARTsBee.

Next unplug the UARTsBee from the USB Cable. Connect it now to the Robocontroller using the header cable making sure your wire colors are oriented correctly. Now connect the UARTsBee back to your USB cable and the Robocontroller should power up with a green light!

Now for the moment of truth. Click the ‘Upload’ button in the Arduino IDE. It should compile the code with no fuss and begin uploading it to the Robocontroller. You can see the Red LEDs blinking away on the UARTsBee as it transfers. When its all done the lights will go out and the Arduino IDE will report “Upload done.”

Now that your hex has a brain its almost go time. Disconnect the UARTsBee from the PC and from the Robocontroller. Set the Robocontroller power jumper to VIN (battery power). Plug the Xbee radio into the Robocontroller.

Power on the hexapod and power on the Commander controller. If everything went according to plan, the hex should come alive and walk, strafe, rotate, etc. Click the little black buttons above the joysticks to check out the different gaits. Victory!!!

Next: The Game Plan for B.E.T.H.’s Brain

Building B.E.T.H.

From work I saw that my MkII PhantomX hexapod kit had been delivered. I immediately raced home.

I quickly opened the box and spilled the contents onto the dining table. There was certainly a lot of stuff in there. (I wish I had a pic).

In addition to that list there is a TON of hardware. Bags and bags of screws and nuts. This is probably a boring post and I don’t have any pics, so I’ll cut to the chase. Following the assembly manual, it took a good 8 hours to build. It wasn’t hard, but it was pretty tedious. Over 350 tiny screws, each with a tiny nut. On top of that you need to locktite every nut. If you stay on track with the instructions, it goes smoothly. All the right hardware in the right places, right servos in the right locations, correct orientations, etc.

Next up was the Arbotix Commander, gotta build that too. Pretty straightforward although some of my hardware didn’t match the instructions and I had to improvise a little with a drill.

Next it was time for: PhantomX Software and Electronics Setup

Intro to Project B.E.T.H.

About five years ago I decided I wanted to build a hexapod robot. I’m really interested in legged robots because it makes you to break down and analyze what real life animals do. What is my brain doing as I walk? Why do centipedes have a ripple gait? How the heck does a mountain goat not fall off the side of the cliff?

I started by looking at Matt Denton’s hexes over at www.hexapodrobot.com. He has some great code that looks very natural. I couldn’t afford the whole hardware kit at the time, but i bought the p.Brain processor and three leg servos. With these parts and some paint stirrers i made a single leg. I got a robotics textbook (Remind me to update the title here) which explained how to use rotation matrices to calculate IK. I got through the math using Matlab and eventually was able to point my foot in 3D space! After that I did some basic trajectory planning so that i was able to make the leg step. It was very satisfying to see a leg move smoothly and naturally.  Well, by leg I mean a wooden paint stirrer.

Wooden Leg

I then got preoccupied with other things and the leg sat in a box for 5 years. A few months ago the itch returned. I went back to the old hexapodrobot.com forums and found they had dwindled down a bit. The p.Brain hardware didn’t have a huge community behind it which i knew i would need so i began researching a new platform. I wanted a platform with hardware I wouldn’t outgrow and a large community for the support I’d surely need along the way.

This led me to B.E.T.H.. B.E.T.H. (Battle Enhanced all-Terrain Hexapod, I’ll explain later) is a MarkII PhantomX Hexapod. This thing is every bit as awesome as it looks. Here’s why:

MkII PhantomX Hexapod

1. Arbotix Robocontroller – This is a great controller meant for use with the Dynamixel servos with enough speed and memory to get the job done. Arduino compatible means that its easy to code in the Arduino IDE and has a ton of community programming support.

  • Arduino compatible
  • 16MHz AVR microcontroller (ATMEGA644p).
  • 2 serial ports, 1 dedicated to driving the servo bus (with Dynamixel connectors), the other to the XBEE radio
  • 32 I/O, 8 of which can function as analog inputs
  • Hobby servo style 3-pin headers (gnd, vcc, signal) on all 8 analog inputs, and 8 of the digital IO
  • Dual 1A motor drivers, with combined motor/encoder header.

2. Dynamixel AX-12A Servos. These are “entry level” Dynamixels, but still pretty advanced robotics servos and far superior to hobby/RC servos. They communicate daisy chained along a serial bus so they’re easy to connect and command. They support commanding position, speed, torque on/off, etc and can feedback position, load, temp, voltage, and other things. Really cool!

3. Kit support. Trossen did a great job designing this hex and kit. The body looks great, allows for a ton of articulation and is physically very stout. If you buy the full kit, it includes an Arbotix Commander controller, lipo battery, charger, radios, etc, etc, etc. The Trossen online forum is also quite active and has lots of smart folks eager to help with robotics algorithms, design, etc.

So with the decision made, the trigger was pulled, and a few days later it showed up at the door.

Up next: Building B.E.T.H.