accelerometer

jscoulter

Member
Licensed User
Longtime User
Hi All.
Is it possible to use the accelerometer to determine your speed (KMH or MPH) instead of using the GPS? if so, whats the calculation I need to use?

Thanks, Jeremy
 

derez

Expert
Licensed User
Longtime User
V = V0 + a*t for each axis and the total speed is sqrt(vx^2 + vy^2 +vz^2)

it can be done with a timer of dt time like this
at start:
vx0 = 0
vy0 = 0
vz0 = 0
v = 0
sub timer_tick
vx = vx0 + ax * dt
vy = vy0 + ay*dt
vz = vz0 + az * dt
v = sqrt(vx^2 + vy^2 +vz^2)
vx0 = vx
vy0 = vy
vz0 = vz
end sub
 
Last edited:
Upvote 0
Top