I've been very busy with other things just recently and so I haven't been able to spend much time on this project. Work has been busy as I'm working towards a new release of my code and my son Scott was born on 25th January. Right now I have very little spare time for my robotics but I'm sure that will change as things settle into a new routine.
Recently in General Category
Once the servo controller code was feature complete I switched to looking at the hardware side of things and thinking about the next stage, the servo sequencing.






From a hardware point of view I had several things to work on. Firstly I needed to get the servo controller and I/O multiplexor chips off of a breadboard and onto something a little more permanent. Since I still find building things with perfboard a little hard I decided to build the controller itself on one board and build separate daughter boards for the I/O multiplexing. This should mean that I can replace the parts separately as long as the connections required remain the same. I decided that each I/O daughter board could contain 2 CD74HCT238E's with some header pins for each of the 16 output channels, 3 pins for the address selection lines and 2 more for the signal lines. I deliberately left off the power and ground pins for the servos as these really didn't work well on the perfboard. The power and ground pins are connected in one direction and the IC to servo control connections are in another direction; without some fairly hairy board trace cutting and cross soldering doing both on a single perfboard would have been impossible. My solution was to build yet another separate board from a different style of perfboard for the servo power and ground connections; this was just two long strips of headers connected as two buses. The servo connectors themselves are then used to physically hold the two boards together. This has another advantage for me in that it will allow me to reuse the I/O board with a more complex power and ground supply board if I decide to investigate the servo torque feedback idea some more (this may require monitoring each of the servo power lines and so would require a different style of power supply board).
Here are some pictures of the resulting boards.




I now need to build another I/O board and I'll have 32 PWM channels for my servos.
The servo controller itself ended up being on a board which could probably be used for all manner of ATMega projects. The board contains header pins for the I/O lines that I need, a reset button, a socketed crystal, power buses and an ISP programming header. About the only thing that's been specially done for the servo controller application is the fact that the I/O multiplexor address lines have 4 banks of headers broken out so that I can connect multiple I/O boards to the servo board easily. The board is pretty much complete and works well; I'm especially pleased with the ISP header as it was quite tricky to fit onto the board due to the connections required. All that's currently missing are the caps on the clock lines, but the board works pretty well without them and they're currently on order and there's space on the board for them. Note that a slight physical design error meant that the single power and ground pins that I had intended to use were in the way of the ISP plug. I cut those off and replaces them with the longer header strips which work better as they give me somewhere else to get a power or ground connection from...

Once all of this was done I tested things and then swapped out my Max232 board for the Sparkfun regulated XBee breakout board and connected the XBee in place of the hard wired RS232 connection. This worked well and left me with a set of boards that only required a power line to tether them; the battery system is on my list of things to work out. Unfortunately I managed to brick one of my XBee's. I'm still not quite sure what happened but I think it could have been either a spike on the 5v power line or a 5v splash onto the XBee TX line. The Sparkfun board regulates the 5v supply to the 3.3v required by the XBee and uses a diode to drop some voltage on the RX line so that the 5v TTL logic line from the ATMega is dropped to be within the tolerances of the 3.3v logic required by the XBee but it leaves the TX line unprotected (the 3.3v logic levels of the XBee are enough to register as valid levels for the 5v side of the circuit but if 5v were applied to it then it would cause problems...). Ideally I'd like to put together a more robustly protected circuit with level shifting on both RX and TX lines but right now I don't quite know how to do that (even the AdaFruit XBee board only level shifts the input lines and leaves the output lines vulnerable). I expect I'll use the Sparkfun level converter board when I get a replacement XBee.
With my electronics off of my breadboard I began working on the servo sequencer. This will deal with moving the servos in sequence to create various walking gaits. Once I'd played with a simple sequencer I decided that I needed to solve the 'hip joint' problem once and for all and then build more legs; after all,sequencing a single leg isn't that much fun.
The prototype leg that I built way back at the start of this project has always been weak as far as the hip joint is concerned. The need to connect two servos at right angles using only a piece of plastic window board creates many problems. My experiments with using metal brackets made from Mecanno failed as the pieces I had were insufficient to hold the servos correctly. Unfortunately I don't currently have access to the custom machining facilities that this guy has access to, so custom aluminium parts are out of the question. In the end I spent a lot of time with a craft knife and pieces of window board and eventually came up with a design that seems to work; at the very least it's stronger and more reliable than the original leg. The design is based on the custom aluminium pieces from the A-Pod hexapod. I expect it will still change somewhat but it's enough for me to move forward...

I now have 6 Hitec HS-645MG servos on order along with a couple more XBee radios and a few more bits and pieces. The plan is to build two legs with the new servos and get the sequencer working. Once I get to this point I should be able to purchase more servos, carve more legs and move to a full six legs. Perhaps this hexapod project will actually have a hexapod before we reach our one year anniversary in April.
I decided to treat myself to an early christmas present and bought a 60W temperature controlled soldering station (a ZD-916 which I got from Maplin). All I can say is WOW. Suddenly I can solder neatly rather than making a smeary mess. The difference between this and my cheapo 12W soldering iron is just unbelievable. It just makes the whole process SO much easier. Where in the past when soldering something with a large heat sink or onto a large pad would be painful as both items would never seem to get up to temperature now I hear the iron click on as I touch the items to be soldered and the heat stays constant and it just works... Highly recommended.
For those of you interested in the kind of thing that this blog is about you might also find ChipHacker.com useful. It's a 'stackoverflow' for embedded programming and electronics people. Hopefully it will become a useful resource!
I now have an easy to extend PWM servo controller and the next job on my list of things to do is extend it so that it supports the functionality that I feel I need for correct control of my hexapod's legs. As I mentioned here, I'd like to be able to tell the servo controller to move a group of servos to a particular set of positions so that they all arrive at the same time and, the movement is incremental and the movement can be stopped at any point in case a leg sensor detects an obstruction.
Configuring a group of servos in one go requires several other things to be in place before it can work and so my first changes to the serial protocol will be as follows:
- Add the ability to send a move command with a 'delay' which will cause the move to take some time to complete. Sending a 'delayed move' of 127 to a servo that is currently in position 0 will cause it to step from 0 towards 127 at a rate determined by the delay specified. Once the servo reaches its final position the servo controller will send an asynchronous serial message back to the controlling computer to inform it that the move is complete.
- Add the ability to report on the current location of a servo.
- Add the ability to stop a servo in the current position, this is only really relevant to a servo that is being moved with a 'delayed move'. The idea being that if we send a command to move to 127 and the servo starts at 0 but a leg sensor detects an obstruction we can send a stop command to the servo and it will stop where it is and report the current location.
Working with servo groups then becomes a case of adding additional commands which take multiple servo number and control value pairs and which calculate the movements required so that all of the servos in the group arrive at their destinations at the same time.
The additional commands will break the current SSC compatible command structure and will also make the serial protocol more complex as we'll be dealing with commands with different byte lengths and also with the servo controller sending unsolicited responses to the controlling computer (for 'move complete' notifications).
I've already got scribbled notes on how all this will work so it's just really a case of implementing it. Hopefully the current code is a good base to develop these changes on.
Here are some links that may help once I move onto fabricating the various pieces required to build the hexapod's body.
- This is a simple 4 legged walking robot that was machined from an A4 piece of 4mm ply wood.
- This is the guy's website, with more details of how he produced the robot.
- And this is the Dutch prototyping lab that he used to laser cut the pieces.
Finally, this is an interesting link to David Buckley's walking robots page.
A collection of links that I've been using recently for research.
- Hitec HS-422 Servo. The servos I currently have; likely not suitable for use as actual leg servos due to lack of torque. Useful link as www.superdroidrobots.com has links to the spec sheet for the servo and a selection of different spec servos with corresponding prices. More useful to me than the actual Hitec website as that doesn't list relative prices. Less useful to me than a UK supplier.
- Servo power and speed. What the spec sheet figures mean. Also ServoCity has another useful list of comparative prices for various servos...
- Society of Robots, USB Servo controller. This was vaguely useful when I was trying to work out how to build the electronics I needed; in the end it wasn't really what I needed. Something that looks more useful to me are the mechanics tutorials...
- Servo Magazine - looks interesting, perhaps.
- TomboT - Tom Elnar's website - useful robotics stuff.
- Serial Wombat Servo Controller - something for ideas regarding how to control the servo controller.
AVR programming
- Dick Cappel's Project Pages - a useful collection of non-trivial AVR assembler examples.
- AVR Tutorial - another useful assembly language tutorial.
Hexapod gait, movement sequencing, sensors, mapping, etc...
- The manual for the Phoenix Excel Program for creating servo position sequences for hexapod legs using inverse kinematics.
- Some interesting stuff on mapping based on the use of a sonar sensor.
My package from Cool Components arrived this morning. My choice of prototyping equipment was quickly validated when I plugged together the Arduino and the Pololu servo controller board, plugged in the servos and servo power supply, connected the lot to the pc via a usb cable and had three servos twitching back and forth under the control of the Arduino is no time. The idea is that I can now begin fabricating a leg, connect up the servos and then experiment with leg movement without needing to get the soldering iron out. The prototype hardware also gives me a reference platform to compare to my own servo controller hardware once I get going on that side of the project.
Also in the package were my XBee modems and several AVR microprocessors to play with; more on those items later...
I saw these Dynamixel DX servos mentioned on Trossen Robotics this morning, see here. They're interesting because they have a richer interface than the normal hobby servos that I've been looking at and they provide a multidrop RS485 interface so that you can chain multiple servos together and control them individually via a single line. You can get feedback on the angular position, velocity and torque and also alerts if temperature and voltage deviate from expected (user specified) ranges. I expect that the torque feedback would be useful to help with determining if the foot is in contact with the ground and also should enable you to detect if the leg is being obstructed during movement which should make moving over uneven surfaces easier to program. All of this wonderfulness is not without a price though, these babies are around $200 each...
Hi, my name is Len Holgate and this is a blog about my new project to design and build a hexapod robot; a mechanical vehicle that walks on six legs...
By day I design and build high performance TCP and UDP servers for the Windows platform, my C++ technical blog is here: www.lenholgate.com. Up until a few weeks ago I'd never done any electronics or embedded programming; I decided that I needed a new hobby and so started tinkering with electronics, breadboarding and the like and, in what tends to be my typical approach to such things, I decided that the best way to push myself into this new hobby was to dive in to reasonably complex project. I started to put together a list of things that I wanted to include in the project and the list looked something like this:
- the end result should be an autonomous mobile robot that isn't tethered to a PC and isn't controlled by an operator.
- all electronics and control gear should be hand made from components rather than bought in (though I'm happy to use bought in things to prototype with as this will speed up the learning process, I hope...).
- all mechanical components should be hand made from components rather than bought in.
- communications between the robot and a PC and between the robot and other robots.
- some form of 'vision', most likely simple sonar or range finding.
- microprocessor controlled; programmed in C or assembler, I'm a C++ guy at heart and, for as long as I care to remember the platforms that I've targeted have been powerful and complex. I quite fancy learning about how to work on more limited platforms and perhaps even learning a decent amount of assembly language...
So here we are. I'm currently gathering components for the project. So far I have decided to use an Arduino as my simple prototyping platform along with some AVR micro controllers for the main robot control gear. Of course my choice of AVRs may change once I have played around with programming them but they seem like a reasonable choice at this point. I've got three servo motors on order (HS-422's) so that I can start work on a simple leg. I have a couple of XBee radio modules on the way as these look to take the pain out of the communications side of things but I may drop back to using simple RF transmitters and receivers if the XBee's are too heavy or power hungry.
So, off to build a robot then...
