Hi,

Depends on your code for setting up the accelerometer, sampling frequency, and precision of calculations.

If your robot is standing still, or moving uphill or downhill at constant speed,

it will look the same as accelerating or decelerating, to the accelerometer.

Continue experimenting with the accelerometer, until you can communicate with the sensor,

and determine whether it is uphill or downhill, and what the slope is, when you know that the car is standing still.

Then start calculating from that.

For a model car that is likely to have good acceleration, I suggest sampling and calculating 100 times/second.

You may try the following experiment:

From a standing start, light a LED when PIC detect motion. Then accelerate flat out for 10 seconds, and breake hard.

When your calculations predict zero speed, switch the LED off, and display the highest speed recorded.

If you can keep a reasonable speed estimate going for 10 or 20 seconds on flat and level ground,

then I think you have a good start.

There exist experimentation boards with 9dof sensors: 3 accelerometer channels, 3 gyroscope channels(rate of rotation), and 3 magnetometer channels( direction to magnetic north).

It can be done, it is sensors like the accelerometer you have, and other sensors,

that are used to keep stable, those drones that fly themselves.

Continue experimenting, there is a lot to learn, both math and computing.

Regards,

Mysil

post edited by Mysil - 2019/12/03 05:49:12