Introduction: Robot Movement Distance Control
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.