1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Car Speed Using 3axis Accelerometer

  1. Sep 24, 2009 #1
    I have joined this forum in need of some help. I am poor at physics but not too bad at math.
    I am making a device to place in a car to act as a dead reckoning navigation system using a digital compass and a 3 axis accelerometer.
    I tried measuring the speed of the car using one plane (axis) but the results were inaccurate. I have been researching that i can use all three to get a 3 dimensional acceleration. Will this tell me how fast i am travelling no matter the orientation of the device?
    I am unsure of the physics behind the forumlar that i would need to use. Is anyone able to help?
    I have already made the hardware and can get readouts from the accelerometers but the readouts are in g's. I need the calculated speed to be in a useful unit such as m/s or MPH.
    I have been researching and trying different methods all day.
  2. jcsd
  3. Sep 24, 2009 #2

    Ranger Mike

    User Avatar
    Science Advisor
    Gold Member

    one big problem is terrain. by this i mean the formaul Speed x time = distance looks good but..when you throw in terrain..the 2 D map distance is wrong...hills and mountains mean you will have a lot more distance than origainlly calculated...military convoy commanders had to ad a percentage of extra fuel to compensate for hilly terrain
  4. Sep 24, 2009 #3
    I understand that the distance will be increase more rapidly for hills etc but im not too worried by this. If i know how fast im travelling and for how long, i can use the heading generated from the compass to work out when i change direction. Then i can keep a culmulative total for how far iv travelled, and use trigonometry to work out how far this will make me from my start position. The bit that im really stuck on is how to actually calculate the speed.
    My problem when only using a single axis was that my device was telling me i was moving when i was actually staying still, i was hoping a 3d acceleration would correct this/make the deviation alot smaller.
    Thanks for your quick reply
  5. Sep 24, 2009 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    There are several basic issues with this concept, all of which can be overcome.

    First, the accelerometer doesn't measure velocity. It measures acceleration. You will need to know the velocity at some point in time and numerically integrate the acceleration to get your velocity.

    Second, the accelerometer doesn't measure the full acceleration of the car. An accelerometer that is stationary with respect to the surface of the Earth will register an acceleration of about 9.8 m/s2 directed upward. There is no way to measure the acceleration due to gravity. The software in aircraft and spacecraft navigation systems includes a model of the Earth's gravity because of this. You will need to do something similar.

    Thirdly, the accelerometer is fixed with respect to the vehicle. What if the vehicle makes a right turn, or starts climbing a hill? You will need to know the vehicle's orientation.

    Fourthly, you want to know the velocity with respect to the Earth's surface. This is of course a rotating reference frame. You will need to incorporate the Earth's rotation into your equations of motion.

    Finally, the above is just a start. Solve the above basic problems and you will still find that the error in your computed velocity grows with time. You can improve things by using a Kalman filter and by incorporating elevation and the figure of the Earth into your basic model. In general, your accuracy will improve as you increase the fidelity of your model and increase the robustness of your system with respect to measurement errors.
  6. Sep 25, 2009 #5
    Thanks DH

    I had another play today, im programming in c and its pretty long winded due to math limitations of using integers/floating point values.

    My program is too sensitive, it seems to 'think' its moving even when it isnt.

    I have gone back to using one axis, atleast until i get a stable enough output and accurate results in a straight line.
  7. Sep 25, 2009 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    wa5211, it looks like you are trying to reinvent the wheel all by yourself. This is essentially a solved problem. A literature search will go a long, long ways toward making your system more robust.
  8. Sep 25, 2009 #7


    User Avatar

    Staff: Mentor

    You don't need to differentiate between acceleration due to gravity and acceleration due to the engine. If you have a 3 axis accelerometer, 9.8 minus the acceleration downward gives you the gravitational component of the forward (backwards) acceleration.

    If you drop the car from a helicopter, it won't matter what direction it is oriented - the accelerometers will be able to tell you how far it has traveled and how fast.
    No you don't. If you assume that gravity is fixed at 9.81 m/s (or adjust it if you know you'll be driving in a vastly different area), the accelerometers will give you all the accelerations you need to know your speed. The difficulty is only in matching that to the distance on a map that isn't flat.
    Last edited: Sep 25, 2009
  9. Sep 25, 2009 #8


    User Avatar

    Staff: Mentor

    How far off is it? This may be more an issue with the stability/range of the accelerometers. Ie, an accelerometer with a range of 10g's that is accurate to 1% of full scale might tell you you are accelerating at 1m/s^2 when you are stationary. That's probably not acceptable. You need a very high accuracy and a narrow scale (say, .1% of 2g) to have much hope of it being useful even over the short term.
  10. Sep 25, 2009 #9

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That is assuming that
    1. That gravity is uniformly 9.8 m/s2 all over the world,
    2. That the accelerometer's case frame is perfectly aligned with respect to the car, and
    3. That you know which way is down in the case frame.
    The first is definitely not true. The second is an engineering problem. There are always going to be alignment errors. Biases in the estimate of the gravitational acceleration and biases in the case alignment can easily appear as an uncompensated biases in the integrated state.

    The final problem requires that knowledge of the car's orientation. Which way is down? Suppose you calibrate and align the accelerometers level ground so that the accelerometer read a pure z axis acceleration vector. Now move the car onto a 10% slope. Even if the car is stationary, it will no longer be measuring a pure z axis acceleration vector.

    The accelerometer does not measure the acceleration due to gravity. Subtracting the acceleration due to gravity from the accelerometer reading is something that has to be done in software.

    If you drop the car from a helicopter the accelerometer won't be able to say doodly-squat about how the car travels because the accelerometer will read zero. The software that processes the accelerometer readings will be able to say something about this, but only if the software was programmed to incorporate some kind of model of the Earth's gravity field into the equations of motion.

    Some examples. Assume the accelerometer is aligned so that on level ground it measures a pure z acceleration.
    1. Two cases:
      • You are driving up a gentle 5.173o hill in Oslo (g=9.819 m/s2). You see a signal ahead and start slowing down at a nice gentle 0.88539 m/s2 with respect to the roadway. The accelerometer will measure 9.779 m/s2, purely in the z axis.
      • You are driving at a constant speed on a flat roadway in Mexico City (g=9.779 m/s2). The accelerometer will measure 9.779 m/s2, purely in the z axis.

      Without knowing which way is down, how is the software that processes the accelerometer readings to know which case is which?

    2. Two cases again:

      • A stunt car driver takes the car out for a spin. He accelerates forward, throws the car into a bootleg turn, and hits the brakes to come to a stop. He intentionally pitches the bootleg so the center of rotation is close to the location of the accelerometer. The accelerometer will read a forward acceleration when the driver starts moving, a slight acceleration during the bootleg, and a forward acceleration when the driver hits the brakes.
      • An amateur driver takes the car out for a spin. She accelerates forward, drives smoothly around a turn, and hits the brakes to come to a stop. The center of rotation of her turn is well outside the vehicle, making the acceleration registered by the vehicle during the turn be the same as that registered during the bootleg. In this case, the accelerometer will read a forward acceleration when the driver starts moving but a rearward acceleration when the driver hits the brakes.

      Without knowing that the car did indeed do a quick 180 versus a gentle turn, how is the software to know that in both cases the braking did indeed bring the car to a stop?
  11. Oct 1, 2009 #10
    I really need help. I want to calculate speed from a tri axial acclerometer.
    I tried calculating the speed from data which i mentioned below
    Calculation of velocity from discrete acceleration data:

    Integral of acceleration will give velocity value. Since data given for acceleration is discrete so we have calculated velocity value at x direction (Vx) through integrating under discrete acceleration data at x direction by using matlab programme. Similarly Vy and Vz was calculated. Total velocity value will be sqrt(Vx*Vx + Vy*Vy + Vz*Vz)

    but the speed which i am getting through this method is 30m/s for one subject which is impossible.
    I didnot process the data before calculation (which could be the reason behind inaccuracy).
    Please. somebody help me in processing my data and correcting the method of calculating the speed.
    I am using tri axial acceleromter (glink), and i attached it on sacrum during run. The subject ran on 400m track which is not bumpy . distance was 50m on plane surface.
    Please some body help
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook