Search code examples
c#androidxamarinaccelerometergyroscope

Detecting hard braking and hard acceleration of a car with accelerometer/gyroscope


I'm developing an Android App for the company i work for. This app is going to be used by our employees that deliver products to our customers. Right now they use a TomTom device which also detects how hard an driver is braking/accelerating with the car. As we want to try to get 1 device with all functions that are being used right now i'm trying to find how to do this with an android device.

Right now we aim on using the Zebra (Motorola) TC75 as device and it has an accelerometer in it. I found the following document on how to call it's sensors and it is working. https://developer.xamarin.com/recipes/android/os_device_resources/accelerometer/get_accelerometer_readings/

However i have honestly no clue what the values are to detect that hard breaking/accelerating is happening.

Could someone possibly push me into the right direction to get this working? Or is the thing i wish to detect not possible?

Thanks in advance.

Pim Dröge


Solution

  • accelerometer does what the name says - measures acceleration (1st derivation of speed over time -> 2nd derivation of distance over time 62).

    The accelerometer returns values that describe the changes in acceleration along the three axes of the coordinate system measured in m/s2.

    see

    https://developer.xamarin.com/recipes/android/os_device_resources/accelerometer/get_accelerometer_readings/#Additional_Information

    So, you'll need a bit numerical math to integrate the values to obtain speed and distance. Simple alogorithms should be OK, but if you'll need more stability go for higher order algorithms like Runge-Kutta.