How do I ensure all robot legs touch the ground

I'm a software guy that got one of these Arduino project books as a gift. I've been planning to build a walking spider robot, but there's one problem I can foresee that I'm not quite sure how to solve.

On the off chance that my robot's legs are not cut to perfect sizes, or that the motors are screwed in at slightly different spots, how do I make sure that all of the legs touch the ground with relatively equal force to support the weight of the robot, and avoid any sort of funny wobbling when it walks?

There were two possible solutions that occurred to me, the simple one was to use some kind of spring mechanism to allow each leg to retract a little, so that if only one leg touches the ground first, it will have a bit of give to allow some of the other legs to touch as well.

The more complex approach would be to mimic what real spiders do in the wild, and have some kind of touch sensor on the bottom of each leg so that it can tell when one has touched the ground, this would have the added bonus of helping with climbing over top of obstacles.

I'm guessing that this would be a common problem for anyone who tries to build a walking robot without relying on a pre-packaged shield that already comes with all the legs, so I'm curious how other people are managing this.

If you have sensors in the robot you might be able to tell when the leg hits ground by the sound, vibration, or tilt.

I think most use a hexapod with 3&3 gait. By using three legs as a tripod while moving the other three you guarantee that the three extended legs will be touching the ground.

Some years ago lynxmotion made some ground contact switches (below) for use on a hexapod. There was lengthy discussion in their forum (below) but to me the project went in the weeds trying to use modified IK formulas. Looks like someone has picked back up on the project in the below youtube video.

ttp://www.robotshop.com/forum/hybrid-terrain-adaption-t5348

I'm curious if anyone has investigated using 'force sensitive resistors' for this purpose. They seem to work in a similar fashion to the light sensitive resistors mentioned in my project book. By setting up a similar circuit, I imagine one could use them not only to determine when a leg has touched the ground, but also to ensure that each leg is carrying a certain bare minimum amount of weight.

I'm also thinking of putting some along the sides of the legs so the robot can tell when it bumps into something and climb over small obstacles.

My only concern would be whether or not they respond to a light enough touch, but I might be able to compensate for that by adding some arbitrary weight to the robot. They're pretty cheap so I'm tempted to make a quick purchase and run a few tests.

if you use servos, you could monitor the current draw.
when the servo encounters a load it will draw more current.

otherwise maybe go with a tilt sensor, when the foot touches the ground it will begin a tilt

Any motor the current will increase with the load. I see a bunch of current sensing IC's out there now, should be easy to monitor each. You could use that for leveling as well, if one motor is drawing ore current slow it down to let the others catch up when lifting.

I'm curious if anyone has investigated using 'force sensitive resistors' for this purpose.

People have and just too erratic to be of use. Below is some simple electrical contact detection testing. This was using an ssc-32 servo controller and a simple program on a pc. Something similar could be done with an arduino.

Ahh here we go

Use a sheild with a motor driver that has the feedback and read the voltage across the sense resistor for each motor. As load on motors increases the current draw will increase and therefore the voltage on the sense line. So a leg in the air will move easily so there will be low current draw and low voltage. Once the leg touches the ground it will start to bear weight and therefore more load and more current and ore voltage on the sense line.

EugeneNine:
Ahh here we go
http://forum.arduino.cc/index.php?topic=157475.0

Use a sheild with a motor driver that has the feedback and read the voltage across the sense resistor for each motor. As load on motors increases the current draw will increase and therefore the voltage on the sense line. So a leg in the air will move easily so there will be low current draw and low voltage. Once the leg touches the ground it will start to bear weight and therefore more load and more current and ore voltage on the sense line.

thats what i said

But it doesn't have to be servos, any motor will work

from a microswitch mounted under each leg, or even simplr with a spring with a wireinside (type simple motion detector.
to a force sensor.
the current sensor is dependat ofthe force so you a light touch is not detected. with servos it does not work as they are position controlled.

I'd personally use both.

This is a topic of interest because I was building a walker in college but graduated, got married, started a career, had kids, etc. Kids are getting a little older so I started digging back in to electronics to start teaching them and found about Arduino.

I was using PIC in college with parallax's 8080 like compiler and the intent was to have multiple tiny PIC's per leg. Back then we didn't have as many I/O lines. Plan was to have a small pic to control each leg motor with current feedback for force and a pot for position feedback. Then a pic dedicated to each foot. I had a simple switch in the bottom of each foot like some mentioned so I could "feel" before putting the foot down. Then enlongated holes for the foot joint with a spring holding the pivot in the bottom of the hole so when weight was pressed down it would compress the spring and move the pivot to the top of the joint and that could be measured too. But then several contacts around the outside of the foot to detect if it hit anything while walking.
I was using the I2C but between all the PIC's and had implemented a halt so if a foot hit something it would stop immediately (basically a reflex) then let the main central processor figure out what to do next. The goal was to make the PICs take to each other so the central system would just tell the network to walk and it could do other things. Much like humans, where we don't think about moving our feet and legs, we just thing that we want to walk and we walk.

I decided to take the plunge and get a simple, circular force sensitive resistor to see what they were like. After setting up the same circuit used for light sensitive resistors in my project book, I was able to see the amount of force being detected by the resistor in the serial output window.

I can see the erratic nature of the numbers that someone mentioned earlier in the thread, but I can't help feeling that this can be compensated for in code. After thinking on it a bit I came up with the following idea:

Define two constants to represent the smallest and largest values you expect to see while the FSR is colliding with something, and divide this range into a series of intervals. The main program will make decisions and take actions based on when the amount of force changes from being in one interval to another interval, and ignore the more precise measurement coming directly from the resistor. To avoid the problem of the resistor registering a force that's just on the border of an interval and rapidly switching between them, define a 'tolerance' constant and register a change from one interval to the next ONLY if the force is outside of the previously registered interval by more than the tolerance value.

By tweaking the tolerance and the number of intervals one can effectively change the sensitivity of the resistor. I might try making a prototype for a single leg next weekend.