 # How do you calculate speed from accelerometers?

Hi, is there any way to calculate speed of a device from ax, ay, az? I'd like to get a forward movement value while e.g. driving a car without GPS or NET. If so, could you help me create a formula that could calculate it?

V= V+acceleration at any unit time

You probably cannot.

With only the acceleration, there is no way to calculate the speed. You need some other information, like the velocity (velocity, not speed) at some time. Then you can use an equation of motion like a⃗ =∂tv⃗ :v⃗ (t=T)=v⃗ Ta→=∂tv→:v→(t=T)=v→T. from https://www.quora.com/What-is-the-best-way-to-calculate-speed-from-acceleration.

So recommend you use the LocationSensor (yes, the GPS) and it calculates speed even though you really don't want to use it. If you do not like that answer, read any of these calculate speed from acceleration - Google Search

2 Likes

Plenty of information, and hard work by @SteveJG , in the following:

https://community.appinventor.mit.edu/search?q=speedometer

1 Like

Thank you guys. What about determing forward / backward movement in terms of linear acceleration instead of speed? Perhaps orientation + acc could be helpfull.

How to 'estimate' speed is discussed here (sort of the method is convoluted and not very accurate >

https://www.researchgate.net/publication/331739573_Speed_Estimation_using_Smartphone_Accelerometer_Data

First you may have to find mean acceleration using resultant vector calculation as ax, ay and az are vector quantity.

ie,

``````meanAcceleration = sq.root of (sq.of ax + sq.of ay + sq.of az)
``````

Then if you have total time then

``````velocity or speed = meanAcceleration / time
``````

Thanks but in my view it's wrong. If I shake a phone vertically, it will increase. That's not what I'm looking for. I'd like to figure out only forward axis movement.

Awesome,
v=a/t