hi to all
anybody have c function for PIC microcontroller to calculate integral
from output of ADXL330 accelerometer chip for measuring distance.
**broken link removed**
If you take the readings at regular intervals all you have to do is a running total, to the highest precision you can afford.
There are other methods that do some interpolation between points like simpsons method. Stick to integer math if you can, for as much as you can.
I realize this is not quite an answer to the question you asked.
Does the data sheet have the equation which converts the frequency into an acceleration? You could just integrate that by hand, then plug the integral into the program. Which uC are you using?
The accelerometer measures acceleration.
Velocity is the integral with respect to time of acceleration.
Distance is the integral with respect to time of velocity.
The accelerometer measures acceleration.
Velocity is the integral with respect to time of acceleration.
Distance is the integral with respect to time of velocity.
You will know which speed you are at though and can make calculations from that
An acceleration of 1m/s^2 of 1 sec will leave you at 1m/s!
And if ds/dt = 0 then you are not moving
If there is no acceleration then either the speed is some constant value or zero (not moving).
The processor should know what the state is and calculate from there.
So after a period of acceleration, the speed should be known, when the acceleration drops to zero the processor continues integrating the speed to calculate the distance travelled.
If there is no acceleration then either the speed is some constant value or zero (not moving).
The processor should know what the state is and calculate from there.
So after a period of acceleration, the speed should be known, when the acceleration drops to zero the processor continues integrating the speed to calculate the distance travelled.
This is the sort of thing which submarines use for navigation when submerged, I have no idea what their accuracy is but the equipment to implement it is a bit bigger than a little accelerometer from RS/Farnell/Digikey coupled to a PIC on a bit of Veroboard!
Theoretically it is quite easy, but in practice there is a bit more to it if you want an accurate one.