I am making an application that is used to measure the velocity, it has an accelerometer that measures the component acceleration in the XYZ-axis. When the car is moving just straight the measurement is ok, as only linear components are involved.

My doubt came when the car is on a curve, I am not sure if the accelerometer can measure correctly in such situation or if it is necessary to apply a gyroscope to measure any missing component.

The code snippet for measure the total acceleration is shown below, I measure the acceleration in each axis and I remove the gravitational to finally calculate the velocity and the speed

    float AccTotal_X = ((AcX - grav_X)*9.81);
    float AccTotal_Y = ((AcY - grav_Y)*9.81);
    float AccTotal_Z = ((AcZ - grav_Z)*9.81);

    float Vx = vx_0 + AccTotal_X*dt;
    vx_0 = Vx;
    float Vy = vy_0 + AccTotal_Y*dt;
    vy_0 = Vy;
    float Vz = vz_0 + AccTotal_Z*dt;
    vz_0 = Vz;

    speed_dt = sqrt(pow(Vx,2)+pow(Vy,2)+pow(Vz,2))*3.6;
  • What hardware are you using? Most accelerometers also include turn sensors. But there's a great range in quality of these things, from very inaccurate for $5 to highly accurate for $60000. – PMF Apr 12 at 12:28
  • Note that the gravity only acts in one direction. You don't need to multiply with the gravity in all axes. – PMF Apr 12 at 12:29
  • @PMF, I am using the MPU5060, it has both accelerometer and gyroscope, however, I am justing using the accelerometer to measure the acceleration linear to get the velocity. – Ghedim Apr 12 at 12:53
  • @PMF about the gravity being multiplied in all axis is because depending on the inclination of the sensor on the plane, the gravity will be present in one or more axis – Ghedim Apr 12 at 12:59
  • @GustavoDaSilvaGhedim Are you getting accurate results? Accelerometers usually have bias and noise which usually make them unsuitable to compute velocity by integrating their readings. – Sacha Apr 12 at 13:35

I found out the answer to the question in the following article SenSpeed: Sensing Driving Conditions to Estimate Vehicle Speed in Urban Environments

According to the article

When a vehicle makes a turn, it experiences a centripetal force, which is related to its speed, angular speed and turning radius. Thus, by utilizing the accelerometer and the gyroscope, we can derive the tangential speed of a vehicle.

Therefore, just with the accelerometer is not possible to measure the velocity when an object is making a turn, it is necessary a gyroscope also.

The equation to measure the tangential velocity is:

v = Rω (1),

Where v is the tangential speed, R the radius of the curve and ω the angular speed.

As the centripetal acceleration is given by a = ω²R (2), reformulating (2) and substituting in (1), it is obtained:

v = a/ω (3).

Both a and ω are given by the accelerometer and the gyroscope respectively.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.