My Linux based Hexapod project

Hello everyone!

I’ve been working on a hexapod project for over six months now. It all started out by a friend showing me Zenta’s Phoenix videos on Youtube and I was like “DO WANT”.

So I got the MSR-H01 Kit (sorry, LM, shipping to Europe is pretty expensive and I like having metric parts in my metric world) with servos for one Leg in Fall 2008 and got more servos for Christmas and my birthday in January.

One of the self-set challenges was to design the whole electronics more or less from the ground up.

Originally, I planned creating a robot controller on a single FPGA board, using a MIPS compatible Soft-CPU.

This kind of worked, see youtube: youtube.com/watch?v=uINYeGkGkdE

However, as can be seen in that video, the board I used was pretty large, it was a Digilent Spartan 3 Starter Kit board I borrowed from the Uni.

That board was running a 25 MHz Soft-CPU and had a megabyte of external RAM hooked up to the CPU. PWM generation was implemented by a few counters and a register block implemented in dual ported RAM, with the simple implementation having 24 PWM channels with a resolution of about 2-3 microseconds.

Software running on the CPU was transfered via a RS232 (there’s a MAX3232 and DB9 socket on the Starter Kit board), the CPU had a simple bootloader compiled into the VHDL code. For cross-compilation, I used a gcc/binutils/newlib toolchain with soft float emulation enabled, the CPU has no FPU.

After the budget allowed it, I got some new electronics. First, a new FPGA board. The current board is a Simple Solutions Zefant LC-3E board featuring a Spartan 3E 250 FPGA, 66 MHz Oscillator, Flash for storing the FPGA configuration and some 8 bit RAM.

Porting over the existing code to the new board was pretty straightforward and the new FPGA even allowed a clock frequency increase of the on-chip CPU to 33 MHz. But since I didn’t really pay attention to the type of RAM, I later found out that the 8 bit RAM isn’t really suitable for my 32 bit CPU (the S3 Starter Kit board had 1 MB of 10ns 32 bit RAM, the new board has 70ns 8 bit RAM).

Also the on-FPGA RAM ressources are pretty limited, the current version uses 16k RAM, 8k for the bootloader, 8k for my code. The code from the demo above is ~50k.

However, I together with the new FPGA board, I ordered an Eddy 2.1 ARM9 module to tinker with. See embeddedmodule dot com for more info on this, it’s a really tiny 200 MHz Atmel AT91sam9260 based embedded Linux module with 32 MB SDRAM and 8 MB Flash.

After figuring out how to reprogram the module without the ~350 bucks Eddy development kit (the module itself is ~ 90 Euros including tax), I ported the higher level functions to Linux (since everything was C code, this again was pretty easy) and connected the SPI interface of the microcontroller to my FPGA.

The on-FPGA CPU is still there, but it got a slave SPI interface, and now is only responsible for receiving data via SPI and writing that to the PWM registers.

Here is another youtube-video showing that setup: youtube.com/watch?v=q_5nvM7TouY

Other additions are a UART HCI compliant bluetooth module and two weeks ago, I finally got a suitable battery. The bot is now powered by a 2S 7.4V 5000 mAh (woohoo!) Turnigy LiPo battery mounted below the robot’s body, a Turnigy 8-15A UBEC provides power to the servos and electronics.

Finally: Code, Pictures, random stuff:

wuselfuzz.de/hexapod/

This tarball includes the current Linux and SPI controller code, as well as a simple OpenGL hexapod model viewer currently compiling on Mac OS X.

wuselfuzz.de/hexapod/files/licks-current.tgz

Pics:

This is the FPGA board with the bluetooth module mounted to a hex spacer.

The Eddy module is hot-glued the the bottom side of the FPGA board. Cables are directly soldered to the socket pins of the Eddy module, because they’re on a 1.27mm grid and I didn’t have fitting pin headers.

Robot base. The FPGA board plugs into both 40 pin sockets. The white part is a piece of plastic as an insulator between the servo signal distribution board and the other electronics. Didn’t like to disassemble everything for a photo right now.

Last picture is a shot from behind. I built a simple battery holder from some hex spacers and some pieces of plexiglass. Just above the battery (in blue shrinking tube) inside the bot is the UBEC.

Hi Wuselfuzz, welcome!

Great work and progress!
Did you use only one UBEC for powering all servos?

:laughing: I know the feeling, I felt the same when I saw Matt Denton’s V4b for the first time.

hmm. The original Phoenix was pretty metric though :wink:

Not impressive at all… :unamused:

EDIT:

BTW, did I see a sensor on one of the tars?

As said on PM: Graet work. Seems that I will lend out your hexapod sim and will have a look at this tiny little board.

For me it was your a-pod.

Just ordered this one for me Link :wink:

Yup, and it doesn’t even get warm.

Yeah, but the overall calculation let me tend to the MSR.

More impressive than 4x old 1700mAh type A batteries that are drained after 30 minutes of idling…

Yeah, I tried to create some junkbot-style sensors from stuff I have available, but I’ll probably just order some FSRs. Nothing was reliable enough for futher pursuit.

/edit: I’ll probably add more hardware stuff in October, my gf can bring over stuff from the USA when she’s returning from Boston. That will save quite a bit of shipping cost.

I’d also be up for agreeing on a function call level API for lower level stuff in C/Linux based robots, so that IK and higher level stuff is interchangable easier. Simple, obvious example:


/** setServo: sets servo number "index" to angle value "angle"
              returns 1 on success and 0 if an error occured (angle is NaN or out of servo's range 
*/
int setServo(int index, double angle);

Then it wouldn’t matter for the higher level code if I transfer my servo values via SPI or write them to a file or send them via RS232 to an SSC32 or Dynamixel servos.

hi i read all the detail about your project and its wonderful… you are using only one usbe circuit on your spider… your hexapod project is useful to me for making a new project as guideline.thanks for sharing information.