this is the way how i have implemented a movement distance control on my 3rd robot vehicle. the point is that we can give a command (serial port or bluetooth...) to the robot, to move forward or backwards a specified (in the control applicacion) distance and then stop. this is based on using an accelerometer sensor and a digital signal processor.(maybe a microcontroller is also fine, i used a DSP)

## Step 1: The Hardware

you need to design a PCB with a DSP or microcontroller and an acceleration sensor and some other robot circuits, like motor control, some sensors...

the acceleration sensor senses the acceleration (speeding-up and slowing-down) of the robot, creates a voltage output (Vout=Vbias+acceleration*number) which is measured by the and the analog/digital converter in the DSP. In the DSP its already represented as numbers. Sample rate can be 200-600Hz. I have used the MMA6270Q sensor from www.freescale.com, and the TMS320F2811 DSP from www.ti.com .

We have studiet in the first year at the university, that the integral of the acceleration over time is equal to the actual speed, and the integral of the speed is the actual path/distance from the starting point. I have used the DSP to do this double numeric integral to produce this distance.

so, how it works:

1. we send a command to the DSP that the robot has to go forward 350 milimeters.

2. the DSP converts it into another number, as a final distance limit (N_limit)

3. the DSP checks the actual output value of the sensor, to set it as a base/bias for the next calculations (N_bias)

4. the DSP/robot turns on the motors, and starts going forward. also starts calculating the acceleration (N_in-I_bias)*number, and the numeric integrals and the actual distance (N_actual)

5. the DSP compares the N_actual to the N_limit at every new sampling period. If N_actual is greather, then turn off the motors and the robot stops.

thats it.

the acceleration sensor senses the acceleration (speeding-up and slowing-down) of the robot, creates a voltage output (Vout=Vbias+acceleration*number) which is measured by the and the analog/digital converter in the DSP. In the DSP its already represented as numbers. Sample rate can be 200-600Hz. I have used the MMA6270Q sensor from www.freescale.com, and the TMS320F2811 DSP from www.ti.com .

We have studiet in the first year at the university, that the integral of the acceleration over time is equal to the actual speed, and the integral of the speed is the actual path/distance from the starting point. I have used the DSP to do this double numeric integral to produce this distance.

so, how it works:

1. we send a command to the DSP that the robot has to go forward 350 milimeters.

2. the DSP converts it into another number, as a final distance limit (N_limit)

3. the DSP checks the actual output value of the sensor, to set it as a base/bias for the next calculations (N_bias)

4. the DSP/robot turns on the motors, and starts going forward. also starts calculating the acceleration (N_in-I_bias)*number, and the numeric integrals and the actual distance (N_actual)

5. the DSP compares the N_actual to the N_limit at every new sampling period. If N_actual is greather, then turn off the motors and the robot stops.

thats it.

I like this project!!
From someone with experience in this field of inertial navigation I can say that the accuracy of the distance travelled is determined by how long it takes you to travel the distance. Accuracy will depend on the sensitivity of the sensor.
Any inertial sensor will have some inaccuracies and by integrated this twice you also integrate the error which causes drift in the accuracy.
The way to get round this is to on power up when the robot isn't moving, read what the sensor is saying and then use this value as an offset to get your real zero value. If you do this process everytime the robot is stationary you should eliminate most of the drift. This is called a ZUPT or Zero UPdaTe.
A way to do this very accurately over long distances would be to use sonar and the doppler effect to tell the unit how fast you are travelling and use this result to aid the distance measuring calculation.
I've just got an ADIS16355 sensor at work to play with which is a highly accurate solid state Tri-Axis Inertial Sensor. Very Cool!!

I need not say more. Well said Scotty3785.

hi.
scotty3785says:...
my answers:
actually i have done the Zero UPdaTe each time before moving. the zero also depends on the slope of the surface. i used my robot on a table, so the slope was constant during moving.
i take not only one sample of the zero, but 128, and calculate an average. with this, i basiclly filtered out the noises, and increased the resolution from (ADC was 12 bits) 12bits to much higher (the proc was doing calculations on 32bit and 64bits data.).
the accuracy of the zero can be measured easily: the robot starts, then stops. the speed value has to return to close-zero, and not to a big positive or negative value.
i think its easier to get the acc.sensor and the DSP than to get a sonar, and its much smaller.
my accuracy based on tests, was aaround 5-30%. when the robot was turning around in place, the accuracy was much worse. but if you try to turn around -blindfolded- then whats the accuracy? not better: you have to look around to make it to be more accurate. the robot does the same.
there was a robot contest in hungary, and i think everyone used time-delay to control distance. i think my method is much better.

I think these sensors are very cool. I knew they existed, but the first time i saw them in action was in a Nintendo Wii gamepad. I thought, how the hell are they doing this. I did some online research and found out, it's only a tri-axis acceleration sensor. I thought it was some sort of a gyro as well, but these are clumsy and expensive. (We used to plate mirrors for laser-gyros for aviational use, but they cost a little fortune back then. 99.998% reflection. Your regular mirror is below 80%, because the light travels from air to glass to the mirror coating and then back again without a anti-reflective coating. Our mirrors had the reflective coating on the front side, and the only needed to reflect the light for one narrow wavelength...)
A friend of mine made a speed/distance sensor like they are now in use in optical mouses over 20 years ago. In addition to your acceleration sensor, this coud move your robot around extremly precise.

my acceleration sensor is based on MEMS technology, which is micromechanics on silicon chips.

Sweet,
how precise is the distance?

t.rohnersays: my answer:
the accuracy based on tests, was aaround 5-30%. when the robot was turning around in place, the accuracy was much worse. but if you try to turn around -blindfolded- then whats the accuracy? not better: you have to look around to make it to be more accurate. the robot does the same.