Axe Avoider

Axe Avoider is a Hexavoider robot with its original microcontroller replaced by a custom Picaxe module.

The Hexavoider was an interesting six-legged, three-servo walker marketed a while back. It came with feelers and IR object detection, controlled by an 89C51 microcontroller, and there was an optional wireless module. It wasn't cheap, but I was fortunate enough to pick one up recently on eBay at a very reasonable price.

The original rubric said that the robot was programmed in C and that the user could "program on his PC and download the program to the robot using FLASH memory." That was true as far as it went: what it didn't mention was that the 89C51 (the big chip on the circuit board) had to be removed from the robot and programmed in a stand-alone programmer, which was not supplied, and that writing programs for it would require a compiler with support for the device, also not supplied.

The device does not seem to be supported by the popular, free, GCC compiler that I use for programming AVR microcontrollers, so I would be faced with finding, and possibly paying for, a compiler/linker with the appropriate support. Not to mention buying or building a programmer - not usually a trivial exercise. Also, I already have no less than seven different systems for programming a variety of robots and microcontrollers, not to mention the Lego tower, and I really don't want another.

At one point I thought I had a neat solution: plug in a small board with a Picaxe-08 where the wireless module is supposed to go. It could communicate using the data channel that the wireless would use and the host controller wouldn't know the difference. The 89C51 would continue to manage the hardware but the easily programmable Picaxe would be in control. Unfortunately the default program in the 89C51 does not include support for the wireless device, so to make this work you are back to needing programmer, compiler, linker...

The Requirement

What needs to be done is to replace the Hexavoider's 89C51 with something more conveniently programmed, such as an AVR controller or a PICaxe, preferably without doing anything destructive to the original circuit board and without sacrificing any of its functionality.

I toyed with several chip replacement strategies. The 89C51 is a 40-pin controller and you might think that a 40-pin chip would be needed to replace it. Only about twenty of the available I/O ports are actually used, however, so a smaller controller would suffice.

The on-board devices are: three servos to move the legs; two feelers which operate microswitches, with an LED; two IR LEDs and an IR sensor, with two indicator LEDs; a piezo sounder; two uncommitted DIP switches; a bank of 4 uncommitted LEDs; a reset switch; provision for a plug-in wireless module (to link to a PC).

I decided to build a board that would plug into the 40-pin socket in place of the 89C51, carrying a controller that I could program in situ. After investigating several possibilities I settled on a Picaxe-28X2. This has twenty I/O ports, each of which can function as either an input or an output - that is enough to connect up everything except the wireless link. Picaxe Basic is adequate for the task, and most of the necessary low-level functions, such as timing, generating servo control waveforms and creating sounds, are already done for you.

There will be one 28X2 I/O port left over, which could be used for IR remote control.


I started out with one of the excellent and convenient 28X2 modules - if you haven't seen one of these, they consist of a complete 28X2 circuit built on a 28-pin pcb, with the download circuit built in, and they are great for bread-boarding. This would have worked nicely, but the 0.6in pitch of the pcb pins (the same as the 40-pin socket) led to a somewhat large and clunky design for the adapter board. The ordinary DIP 28X2, however, is a standard 0.3in chip which will fit onto a board in between the two rows of pins that mate with the 40-pin socket. This allows a smaller, neater board and is what I used.

This is the circuit, including the standard Picaxe download and IR receiver:

There was no easy way to work a reset button and its track into the available space, so there isn't one - the reset line is tied to Vcc by a resistor. The 28X2 has power-on reset and there is an on/off switch right next to the board, so it's easy enough to reset by switching off and on again.

(There is a reset button on the main board for the original controller, but it is active high whereas the Picaxe requires an active-low reset. Rather than waste this resource, it is connected to an I/O port for use as a general purpose push-button.)

Any 28X2 I/O pin can either an input or an output, which simplifies matters greatly: each of the I/O connections on the main board can be connected to the nearest available I/O on the 28X2, and the mapping looked after in software. Note, however, that this is only true with the X2 version - older Picaxe-28s will not do, no matter how many of them you might have in your parts drawer.


The board is designed around the 40-pin connection to the main board. The Picaxe chip sits between the two rows of pins and there is room at one end, with a small extension, for the download circuit and the standard Picaxe 3.5mm jack. The other end of the board has been extended to accommodate the remote control IR receiver.

In an ideal world I would let the auto-routing pcb design program work its magic, upload the result and wait for my professionally finished, through-plated, double-sided board to drop through the letterbox. Back in the real world, I can't do through plating and try to avoid double-sided layouts when making boards by hand. As it turns out, this design can be accommodated, just, on a single-sided board without wire links.

This is the pcb layout:

Although the components at the left-hand side seem crowded together, the two capacitors are actually rather smaller than the outlines would suggest and there is sufficient room.

Note that, with respect to the 40-pin socket, the Picaxe is the opposite way round. In the image above, pin 1 of the 40-pin socket is at bottom left while pin 1 of the Picaxe chip is at top right.

Making sure it fits:

I used the free DesignSpark software to lay out the board and incorporated bits from the Picaxe module library for the download and IR circuits. I made the tracks as broad as was practicable to allow for the vagaries of hand etching (and the fact that my Laserjet tends to narrow them a bit when they're printed), and kept the lands large to reduce the risk of damaging the board during drilling or soldering. Where it was necessary to make lands narrower so that tracks could pass between them I chose lands that do not connect to anything and whose function is purely mechanical.

(Still to come: making the pcb; testing; programming.)