Back to Main Page
A brief introduction
Hexapod robots (Those with 6 legs) are becoming more popular on the net, but as of yet there doesn't seem to be one made from home Rapid Prototype parts. As I now have the facilities to construct parts and with the success of the SCARA robot, I thought it was about time to investigate how one would be constructed. As usual, I am not sure I have the time to complete this project, but at least I will gain an understanding of how they work and more importantly learn how they are programmed. In addition I will learn all about how the different "Gaits" or walk cycles are generated. As I also like animation this will be of great interest.
Videos of the HF08 Robot on YouTube
Notes on how to build this robot
Download models.firmware etc. at the following location
Just search for Helium Frog to locate the robot
I have uploaded videos of the robot walking on YouTube. I am continuing to improve the firmware and host PC software and it now has keyboard control and good command buffer management so the robot doesn't go out of control. Also added in the software are sliders to easily modify step length, height and walk speed. I'll probably add body height adjustment in the near future.
Over the past few weeks I have been gradually working on the firmware and each weekend printing off more parts. The mechanical work is now done and the robot assembled. It took its first brief walk this weekend. The software enables walking in any direction and also rotating clockwise and anticlockwise.
The firmware still needs some work to sort the transition moves between linear and rotary stepping, but it is basically complete and working. I also need to sort out the buffering of serial commands, so repeated commands are not accumulated. The servo wiring needs tidying, but the project should now be considered complete. That is almost exactly 3 months from initial idea to end product. I'll try to upload a video this week of the robot in action. Then its time to document the project and upload the models.
I now have the pair of legs stepping correctly. The easiest way to get the left leg working was to mirror the x coordinate, use the same equations as the right leg then modify the servo directions to suit. This works really well and proved quite simple. I am now back on CAD design to complete the body details. I hope to be able to get at least another pair of legs printed this weekend and attached for programming next week. I now need to have a think about how the robot will do a rotate move. I will probably do this in separate routine within the program as there are subtle differences, for example I can do a linear step, but the return portion of the walk cycle must be on a radius otherwise the legs will drag across the surface.
Whilst browsing the net I have been facinated by the Boston Dynamics "Little Dog" robot. Its a quadraped robot, with a different leg configuration. Doing some doodles today, I realised that this leg form could be done with RC servos and two of the servos would be located within the body. I may even be able to get the third servo within the body if I use one bowden cable for the lower leg. I have penciled this robot in as a possible candidate for my next design HF09!
Steady Progress on the Hexapod development. I have completely redesigned the leg with two femur bones and removed the lower coxa roller bearing. This is replaced with a 6mm bolt and nyloc nut. I can now use this as a sort of friction clutch to stop the coxa servo hunting problem. The tibia is printed in two halfs complete with the end foot. The only problem with this design is it makes the legs very wide. This means I will have to extend the length of the robot so the legs don't clash. To get an idea of how large this robot is, the base board in the lower picture is about 500mm wide. Its going to be quite a big beast! In addition to the legs, I also designed a centre tub onto which the front and rear leg sections can be attached. It was the largest print I have done on my Reprap and has a little curling on the corners, but not too bad. The middle left leg is moving unpredictably at the moment as it's using the same equations as the right leg! I'll work on this during the week and perhaps print another leg pair next weekend.
The last week or so has seen gradual progress on the hexapod robot. Both the PC host software and the Dagu firmware are now at a stage where the single leg steps in any direction. I am particularly pleased with the step as I have it moving in a sine wave form as it steps and then slides back along the floor. I am storing the points and servo pulsewidth values in an array, so it shouldn't be too hard to expand these to contain all the data for the six legs. I have decided that I shall tackle a tripod gait first as this is the easiest to do, and actually looks the best in my opinion. I now need to develop the routines for the leg which will enable the robot to rotate about its centre. I have noticed that my firmware is totally different from others out there, which is a good thing as this is the only way I might stumble on something unique.
A bit of a mad rush today to complete a prototype design of a leg and to rapid prototype all the parts.
A few moves of the leg revealed that there might be an issue with the servos. Due to the inertia of the leg, the coxa (innermost) servo tends to hunt around a fixed point, constantly trying to compensate its position. OK I am moving the leg as fast as possible with no deceleration, but this will have to be sorted. Perhaps the alterative design below with the rotating inner servo might be better or I could add in some sort of damper such as a rubber leaf spring. Its early days and at least I can develop the IK routines with this leg. I have also noticed that the wiring is more flexible than I first thought so I should be able to bring the femur servo (middle) in a little closer to the coxa servo.
As the firmware side of things seems to be held up by the mechanical design I thought I would spend a good few nights on CAD to iron out a few rough edges of the design. I noticed on most Hexapods that the innermost servo rotates and is not fixed. This seems a little strange as it's best for wiring and package if you can have static motors / servos if possible. With this in mind I did a study of both variants. The left legs in the image below have fixed inner servos, the right legs have pivoting servos. The right hand leg design does mean you get a more compact Coxa design, but I actually want a longer Coxa design to give the legs a larger arc.
A major advantage of working in CAD is that I can check the leg swing for and aft to see if I get any clashes and to determine the best neutral point for the servos. The setup shown on the left legs gives a 105 degree swing forward and a -15 degree swing back for the front legs. Neutral point is at 45 degrees. This should enable the arms to swing forward and touch if needed. I have seen Hexapods manipulating objects with the front legs, so this design should allow that. Central legs swing +/- 60 degrees. I found the best angle for the servo body is 30 degrees as shown. This gives good clearance to wiring and servo body. The servos actually have the wiring coming out the wrong end for clearance, but I have checked the minimum wiring bend radius and the design should clear without issue. A further advantage is that the left hand leg assemblies will be modular, ie. There will be a flat vertical face with bolt holes mounting to the body. This means I can fix them to any body design and even transfer them between robots. I was hoping to print some parts this weekend, but I can see there is at least another weeks work in CAD refining the design, checking clearances and hole sizes before I can proceed to manufacture. Its a good job there is no deadline to meet.
Work continues on both the software and mechanical design. The robot design is gradually improving and more details are bieng added. Printing of a leg is really needed now as the firmware is at a more advanced stage.
On the software side of things, whilst developing the firmware I soon realised that using Pronterface to send commands to the Arduino was a little limited, so I bit the bullet and started developing my own host software in Visual C# 2010. I am gradually improving this in parallel to the Dagu Firmware, so whenever I need to send a specific command, a few minutes developing the host software gives me a good tool for thoroughly testing the firmware. Another additional advantage is it shouldn't be too hard to add keyboard / mouse control and also run the Hexapod from a scripted text file similar to a Reprap machine.
I am working on just one leg at the moment (The front right) and I am going to develop G code routines, for example G2 X100 Y100 Z-50 will move the Front right leg to X100 Y100 Z-50 relative to the robot datum. I can then develop G1 G3 G4 G5 and G6 to control each leg individually. These commands are always useful even when the robot is complete. I can then write another command encapsulating the walk cycle. As can be seen in the bottom window, the firmware is reporting back its calculations via the serial link. This took some time to get working properly but now it seems robust and is working at a baud rate of 115200, easily enough for my needs. I also have a good excel spreadsheet and the CAD model to verify all the calculated angles are correct.
It's a good feeling that even though I am away from home in the week this isn't stopping me from making progress. In fact not having to drive 4 hours a day to and from work means I can progress much more quickly.
The firmware has now been improved a little so it now recieves +/- angles in degrees and responds accordingly. There was little information on the Hexatronic HX5010 servos, so I had to do a little investigation of my own to establish what pulse widths the servos were capable of responding to. I taped a piece of wire to the servo horn and taped the servo down to the bench ontop of a piece of paper. I sent the servo various pulse widths and marked the angles on the paper. It seems the HX5010 responds between 400 and 1900 microseconds with 10 microseconds per degree. I will restrict the servos to work between 600 and 1800 and therefore neutral position will be 1200 microseconds. This should give a good accurate +/- 60 degrees movement at each joint. After attaching 3 servos to the Dagu board I noticed some noise and hunting of the servos. I assumed it was that insufficient power was bieng provided by the USB connection alone, so I rigged up a 5 metre usb cable complete with two power wires tie wrapped to it. The board now has a long umbilical cable bieng supplied with a 13.8v 3A supply. This should be sufficient to supply all the servos and give enough length to allow the robot freedom to roam without the need for batteries. Now I have the servos I need to spend more time finalising a leg design so next weekend I can print one off. This will help developing the IK routines.
Tonight I had the first chance to setup the Dagu board with a few spare servos. The little routine that was on the Dagu website confirmed that the board was capable of moving the two servos I had connected back and forth. Encouraged by this I had a change of tack as I was going to develop some entirely new firmware. As I have the SCARA robot firmware written, this contains all the communication routines to enable control from a PC via a serial link. I began to quickly modify this so that a command from a Terminal program (In this case Pronterface Printrun) would operate the servos. I now have some G codes which when typed into my PC move the servos to any desired position. For example a G20 A1800 B600 command moves one servo to 1800 and the next to 600. The values are pulse widths at the moment, but tomorrow I will convert this so it decodes angle values. I can then gradually develop the G code routines until eventually I can send XYZ positions and it will move the servos correctly.
On the design front I have managed to setup a "Mechanism" in Catia. This is a simplified armature which I can move about easily by changing XYZ coordinate points in the model. I can them measure any joint angle on each leg to check out my Inverse Kinematic (IK) logic before transfering the equations into code. Many of these design steps are similar to the SCARA robot development, so I am confident I am heading in the right direction.
Over the past few weeks I have been gathering information on a hexapod robot. There are many variations and programs, but there doesn't seem to be any website with free plans and free firmware. There are just little snippets here and there. As I am familiar with the Arduino microprocessor I was keen to use this as the basis for the brain of my machine. About a week ago I struck lucky and found a controller specifically designed to drive upto 48 servos and with Arduino architecture.
The Dagu Red Back Spider Controller is £35 all in and has a built in 3A switch mode power supply. This should mean I can drive it all from one power source. At first I will develop a tethered robot, but later when its house trained I will fit it with batteries and maybe wireless control.
I also managed to get a Hexapod 3D model from the GrabCAD website which was based on laser cut parts, but this gave me the basic dimensions for a robot. After a few weeks of my own design I have come up with the following.
An addition of my own are the red boots! I noticed that most current hexapods have minimal grip, so I decided to fit rubber thimbles used for counting money. These are soft and textured. I filled one with wax and measured the wax part to get an exact size for the reprapped foot. A have also made sure that two standard RC 6 cell battery packs will fit into the body. I won't buy these just yet, but may fit them later.
The next part was to source the servos. I need 18 in all and I had a bit of a shock at the price of high torque units. The preferred choice seems to be the Hitec HS-645MG, but these come in at £21.99 each. A whopping £395.82 just for servos! This is a bit steep for a project which may not be finished and to be honest will only make an object which won't serve any practical purpose. A further few nights work checking all the current designs revealed that a Hextronic HX5010 servo might work. These are only £7.49 each so £133.20 sounds much more reasonable. I have ordered 4 so I can build one leg and see if they function OK. If they don't that might be the end of the project.
Further work has been carried out getting the basics of the firware sorted. I produced an Excel worksheet to develop the Inverse Kinematics (IK). IK is where you tell a robot arm the end point in X,Y and Z and the calculations are performed to work out the arm/servo angles. I have had some experience of this when I developed my SCARA firmware, so this went a little quicker than last time. I also found some firmware on the net for another controller which gave me a clue as to the walk cycles or "Gaits" employed in a six legged robot. I am going to develop my own code so don't want to be too influenced by other work. I intend to use a method similar to my SCARA which is a little unique as far as I can tell. This method loops the main program as fast as possible and checks the leg positions to a predicted position in time. It's a sort of closed loop system and worked well on the SCARA.