Go Down

Topic: Estimating speed using 3-axis accelerometer math needed. (Read 357 times) previous topic - next topic

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

johnwasser

Average a bunch of readings while stationary.  Subtract those averages from each axis and accumulate the remainder acceleration.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy