Hexapod queries

Hi everyone,

I have been thinking of building a remote controlled hexapod from scratch including the code. However having never built anything like it and having basically no experience with arduino, I have a number of querys I would like your opinions on.


1 - Basically I already have an arduino mega and xbee series 1 modules so I will be using those for sure and was thinking of using some sort of plastic or maybe even aluminium for the body and legs and hence have no idea what the weight will be. However I am not sure about which servos would be good since I would not want them too weak but also not too expensive or current drawing. Are there some standard one everyone uses? And is it important that they have metal gears and such things?

2 - I was thinking of keeping it simple and use only 2 servos per leg, however I am still wondering if it is much harder to  use 3 per leg and what would be the advantage to having 3 servos? Turning while going forward?

3 - Power source? Obviously the size depends on the servo demand but would it be better to use li-ion or NiMh? And normal alkaline for the controller?

4 - Programming movement - I have read some articles about this and one went into reverse kinetics and such, but would it suffice to just tell the servos to move at certain angles in a cycle to make it go forward for example and have the pod balance on three legs at a time?  

Any help would be appriciated.

Thanks
    Lanfear

I’m building quadrupeds now,

I’m building quadrupeds now, but I still have some very fresh experiences that I can share with you.

1. The servos will depend a lot on the size of your robot. Remember, that the servo torque is given in kgcm (should be newton metre, properly, but this is a simplification). That means, that your servo can lift and hold a 1kg weight on a 1cm long arm. However, if you make the arm 2cm long, it will only be able to hold 0.5kg on it. So if your robot’s leg is 20cm in total, a 10kgcm servo will be able to lift/hold 0.5kg of the robot. Fortunately, you will probably have three legs on the ground at any time (for statically stable gaits), so your robot can weight up to 1.5kg then, at least in theory (you have to leave some margin for inertia). On the other hand, the servos and the battery are probably the heaviest parts of your robot. That means that using smaller servos and smaller battery will let you… use smaller servos and smaller battery. The dependencies are nonlinear, though, and it’s not clear where the sweet spot is.

There are several other things to consider when choosing the servo. Price is obviously important, as is the quality. You can have plastic gears, partial metal gears or full metal gears (often they will just write “metal gears” and not tell you that only the last gear in the gearbox is metal). The servos can have bearings (single or double) which can be important if you are going to apply side force on them. The servos that are specially for robotics often have a nub on the back of them, so that you can mount them properly on both sides – but you can glue something or make a proper mount for them with it too. They also have speed (which I think is not so important for you, unless you want to make a jumping spider) and accuracy – so called “dead angle” – basically how large the movement has to be to not be ignored by the servo as noise and actually performed. Lastly, there are things that the manufacturers don’t tell you, like the actual range of your servo, or the fact that the shaft on it is really wobbly, etc.

One more thing, you can use weaker servos at a cost of smaller range of movements if you make them move the legs through a lever, like this hexapod does, but that complicates the inverse kinematics calculations.

2. Two servos per leg are enough to have a simple walker (but then again, look at Penny, a hexapod build with three servos total, or the crawlies with a single engine that you can see in toy shops), but it would be very hard to have precise control over the posture and where each leg goes. You will also most likely have the legs slip a little on the floor – possibly scratching it. With 3 degrees of freedom per leg, you have full control over the position of the end of each leg. Some robots even go as far as adding a fourth degree of freedom – to be able to control the position and orientation of the foot! But that’s 24 servos we are talking about here – a considerable weight, power drain and amount of money. Since a hexapod can walk without having to balance with its body (unlike a quadruped), you should be fine with two servos per leg.

3. Power is a big problem with walking robots. Not only they have to carry their own weight, but also the weight of the battery, if you insert a larger one. And they have to expend power just to stand still, unless you come with some smart mechanical solution, like springs, counterweights or latches. When buying the batteries, pay attention not only to their voltage and capacity, but also to their rating – make sure they can really give you enough ampers. I had to change batteries twice in my robot because of that (the second time when I upgraded the servos). You will want to have a voltage regulator at least for the electronics, possibly also for the servos. Powering the servos with higher voltage than they are made for will make them move faster, but also more jittery, they can start to oscilate and overheat. They will also drain the battery faster this way. Personally I went with a 3S (~12V) LiPo battery, and an UBEC giving me steady 5V. Plus a large capacitor for any spikes. Going down from higher voltage also means that you are drawing less ampers from the battery, at least if you use a switching regulator, not a linear one. With LiPos the regulator is important, because they change their voltage a lot dependnig on how full they are.

4. There are many approaches. I even saw that people add an additional cable to the servo’s pot, so that they are able to tell the position of the leg – then they can record postures. But I think that inverse kinematics is the most interesting approach, giving you a lot of things you can do with it. But yeah, 3 degrees of freedom. It’s less expensive with quadrupeds, I guess. Whatever you choose, be prepared to spend countless hours debugging and fine-tuning your gaits.

Hi everyone,Thanks for the

Hi everyone,

Thanks for the replys. I’m completely blown away by how much info you gave me and how quickly you responded. Having read your responses and reading up on kinematics, I have changed my mind about doing a 2dof and going for a 3dof with IK. I understand the theory but it still seems a daunting task to code it.

I have also read about servo jittering when using the arduino mega. Some managed to solve most of it through coding, but is there maybe a hardware configuration to avoid it, while still using the mega?

Edit: Maybe a mbed + ssc-32/parallax quickstart?

Thanks again
              Lanfear

Dynamixel servos
If you want some nice robot servos, the Dynamixel servos (available from http://www.trossenrobotics.com are great. They use a totally different protocol than standard hobby servos, and are a bit more expensive. That is, until you get into the upper ranges, in which case they cost more than most robots here.

Also, the Trossen Robotics forums talk a lot about Hexapods and other walking robots.,

I was thinking of using the

I was thinking of using the same frame and servos as bajdi used actually. The frame looks wicked and is quite cheap on ebay, esecially compared to what I could have made locally and still have it look great, sturdy and light. The servos fit the frame and are also well priced and are quite used.

As for jittering, I have read that it can be caused by the code used in the servo libary and that one could get round it using another libary or that maybe the arduino cannot handle the amount for processing from the maths and PWM.

As far as the hardware goes, I think I have a pretty good idea on what I am going for. However I still have some questions as far as the software goes.

From what I have seen in videos, people always make sure that the legs stop where they stated in the begining. Is this because the servos always reset to their default position? which can then end up damaging the servos if it happens too often?

I intend to use two analogue joysticks where one is for moving forwards and back and the other joystick to turn left and right. I was wondering how people usually go about it, as in if the joystick is pushed forwards, will it go forwards at the same speed regardless how far the joystick is pushed? And the system checks if the joystick after every full leg motion?

Thanks
    Lanfear

With the RC servos, you

With the RC servos, you don’t have any way to tell in what position they are physically (unless you modify them). It’s usually not a big problem during the operation, as you can simply remember to what position you told them to go last time (assuming they had enough time to move), but it’s a problem at startup – if your starting position for the servos is very different from the position they are actyally physically in, they will do a very quick movement to the starting position, straining them and possibly entangling the legs and getting blocked.

As for movement, I have a very simple control scheme. The left stick is responsible for the speed of body shifting in the horizontal plane – more you push it in the given direction, the faster the robot will shift its body in that direction. The right joystick is for twisting the body along the vertical axis (turning) and for the body height. I have also a d-pad that I plan to use for tilting the body, but that’s not implemented yet. Anyways, as you might have noticed, that’s all for the stationary body posture changes. What about walking?
For that I have a button that makes the robot stomp its feet. It raises each leg in order, and puts it back on the ground (the exact spot where it goes is modified by the current body shifting speed). So if I hold that button and then shift the body using the left stick, it will walk in that direction. If I twist the body, the robot will rotate. Etc. I also plan to add more buttons for different gaits – basically just different orders of raising and lowering the feet. 

power

I have been looking at ubecs and read about ESC and BEC, which I imagine I can completely ignore since servos don’t use them. However I couldn’t find any ubecs without those connections so I imagine there aren’t, in which case, would I just ignore them and leave them disconnected?

Also I was thinking of using a ssc-32 and putting 9 servos on each side. Each side can be powered seperately, therefore assuming 1A each servo, 9A each side. Would it suffice to use a 10A ubec each side? 

I was also wondering about the lipo size, I think I should assume 20A to power the 2 ubec, ssc-32 and LPC1768. For 20-30mins that would mean I should use one 2s lipo of around 10000mah, which seems a bit big to me. Ofcourse the servos will not be taking that much current all the time and hence the lipo could be smaller, but how much smaller? Also any other details I should look out for like brand or something?

Thanks
    Lanfear

Tbh I had not even thought

Tbh I had not even thought about the nuts etc but i’m glad you mentioned it so I don’t have any suprises later. I’ll be following your progress on the hexapod to see the outcome of the different regulators and the servos. Also, is it normal for the servos to get really hot? It seems strange to me that they aren’t constructed to withstand constant use for such a short time.

Anyhow thanks for the replies guys

Bearings

I’m getting the same kit that Bajdi and Duane Degn used and i’m going to assume the the kit will come without the bearings. Now i’ve found one site which said that it uses a " Footstep bearing * 6 " but that didn’t get me anywhere on google or ebay. So could someone please tell me which bearing would be the right one to get and it’s size.

Thanks
         Lanfear

 

Thanks Duane. Ive been

Thanks Duane. Ive been following your progress on your hexapod and saw you weren’t going to use regulators anymore and power the servos directly. I was wondering whether since voltage discharge curve of a LiPo is not straight, if it has any affect on the system? Also I wouldn’t mind any info you gained from playing with the regulators =D.

On a related note, I was wondering how ppl go about not draining their lipos too much? Since monitoring the voltage probably is not the best way to go about it, do ppl use a charge module or something of the sort to alarm them to change lipo?

Lastly, I have been thinking of using a ssc-32 to control the motors. However when I was reading its product page, http://www.lynxmotion.com/p-395-ssc-32-servo-controller.aspx, it says that the servo type supported are Futaba or Hitec. Anyone have any idea why that is? It would seem to me that it wouldn’t make any difference which servos are used and that they just print that because of some deal they made with those companies?

Thanks in advanced
        Lanfear

I monitor the lipo on one of

I monitor the lipo on one of the analog pins of the arduino. I have a voltage divider (a simple two-resistor bridge) to bring the maximum voltage to a level tolerable by that pin, and I have a check in the code that will detach all the servos and start beeping if the voltage drops below 3.74V for more than 4s.

They name Futaba RC servos, because that’s the company that actually introduced the standard. Pretty much all other RC servos should work, although the ranges and angles may differ slightly. See http://www.servocity.com/html/connector_types.html

That servo controller looks pretty large, clunky, and expensive. I would look around a bit more, for instance, http://www.pololu.com/category/12/rc-servo-controllers and https://www.adafruit.com/products/815 (they can be bought much cheaper from China).

servo controllers

Ive looked at some other servo controllers like the mini maestro which is a lot smaller and weights less, but one thing I couldn’t find in others but could in the ssc-32 is the function to start and end the servo motion at the same time even at different distances. It could be that other boards have it but I couldn’t find it written anywhere.

As far as the price goes I actually couldnt find the ssc-32 or the mini maestro on ebay =/, but on https://www.robotshop.com/eu/en/servo-controllers.html they are both around 40euros.

One funny thing at the ssc-32 is that it lists the peak current at 15Amps and the steady at 3-5amps http://www.lynxmotion.com/p-395-ssc-32-servo-controller.aspx isn’t 3-5amps a bit low for steady use or am I see this wrong?

Thanks

       Lanfear

I don’t know about all those

I don’t know about all those features. I always end up sending the positions of all servos every frame anyways. You can’t really do anything else when the tip of your robot’s leg has to move in a straight line, not an arc, so you have to use the reverse trigonometric functions to calculate the angles. I would also forget about the “buildin hexapod gait” thing they have.

The best and cheapest for me so far was just driving the servos with an Arduino Pro Mini board ($2) with a simple breakout board (http://sheep.art.pl/Servo%20Board%20for%20Pro%20Mini) and very simple sketch that just reads the positions from the serial interface. It’s limited to 12 servos, but who says you can’t have two of them? There was also that guy writing a library for servos with shift registers, but I can’t find it now.

Of course, if you don’t want to experiment, just buying a ready solution is probably best. Just remember that you probably will only use the very basic functionality of setting the servos to the desired positions every frame, so anything fancy extra is just a waste.

 I ordered a chinese clone of that adafruit controller now just to experiment with it, it looks interesting. Especially since you can chain several of them, to get more servos.

 

servo torque

Just recieved the frame and found it was a bit heavier than I thought it would. I weighed it and found it to be 0.9kg including the bolts, nuts and bearings. I then did some calculations to find the torque that a servo would need to support the hexapod if on 3 legs which are as follows:

-     frame  – 900g                      = 900
-    Servo horns – 3g x18            = 54
-    Servos – around 55g x15       = 825
-    Servo controller – 150g          = 150
-    Micro – 12g                          = 12
-    Battery – around 350g max    = 350
                                                 = 2291 = 2.3kg
                   
                                                   2.3/3 = 0.8kg

Assuming the hexapod frame was uniform, the lenght from the furthest servo is about 20cm and hence the torque would be around 16kg.cm

However ppl seem to use about 10-12kg.cm, so… what am I missing?

That’s why the mammal

That’s why the mammal configuration is so much better! :slight_smile:

But indeed, different servos will carry different weights (maybe it’s even a good idea to use different models?):

  • The first servo from the body has its axe vertical, so it doesn’t need to cary any weight, it just works against the friction and inertia. You just need good bearing here.
  • The second servo has it the worst: it has to carry 1/3 of the weight of the robot body and the first servos when the leg is on the ground, and the weight of the second servo when the leg is in the air.
  • The third servo has to carry even more in theory (body plus all other servos), but in practice the lever is much shorter, so it’s not that bad.

You are using a kit, so that doesn’t apply, but generally it’s possible to design the leg in a way that takes that into account. For instance, the length of the coxa doesn’t affect the lever, but affects the range of the leg, so you probably want it long. Femur and tibia affect the second servo’s lever length the most, so you probably want them relatively short – but long enough to be able to compensate for the arc created by the long coxa and still move the leg in a straight line. In addition, the distance of the base of the leg from the center of body affects stability a lot.