Pages: [1]   Go Down
Author Topic: Estimating speed using 3-axis accelerometer math needed.  (Read 230 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have searched high and low for some simple physics math to estimate speed (not velocity) using 3 axes, while cancelling out earths 9.81m/s^2 in any orientation.

I just really need an estimate of linear speed is all, no vector (velocity) required.  I am not trying to estimate a position from this at all, so please don't respond with "You can't accurately get a position using just an accelerometer.. " stuff.  I really just want to know if it's moving or not.  I am also trying to avoid calculus if possible (integral I'm looking at you)

This is what I had in mind in pseudocode but it just seems too simple and somehow doesnt correct for gravity (I was OK at Newtonian mechanics but awful at math lol):

(Assuming the unit is turned on at a complete standstill and gives measurements in G)

everything = 0

loop() {
samples = samples +1
xtotalgs = oldxsgs + xacceleration
ytotalgs = oldygs + yacceleration
ztotalgs = oldzgs + zacceleration

oldxgs = xtotalgs
oldygs = ytotalgs
oldzgs = totalzgs

speed = ABS((xtotalgs+ytotalgs+ztotalgs) - samples)) (minus the number of samples to subtract 1 g from each reading) ABS is absolute value I don't need/want negative values
}

I would rather be able to factor out gravity without a running total of samples, just for simplicity sake, and I know there's going to be noise that deviates the readings of gravity from 1G, but at least I'll have a starting point.

Anybody know of a better way of doing this??  Want to shoot holes in my math?  Am I way off base?  Is there a better sensor/application for this?  Been done/reinventing the wheel and I don't know it?  Find out tonight at 11.

Thanks guys -J
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 179
Posts: 8067
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Average a bunch of readings while stationary.  Subtract those averages from each axis and accumulate the remainder acceleration.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: