3

This question has been asked in a few ways but there has been no conclusive answer to it.

I am trying to find out the maximum range of the accelerometer on Android phones. Some forums claim +-2Gs and some +-3.5Gs.

The accelerometer hardware (of the LSM330 which is on the s4) has a higher range, up to 16Gs. http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00059856.pdf

I wrote an application to practically find this range and loaded it onto an S4. The following picture shows the readings. Clearly, the maximum range in each direction is 2Gs.

Application Readings

  1. Is there a way to increase this range and if so, how?
  2. Has anyone found a larger default range on other Android phones?

For those interested, here is the nb part of my code:

public class MainActivity extends Activity implements SensorEventListener{

Sensor accelerometer;
SensorManager sm;

TextView maxValue;
TextView realTimeValues;
TextView realTimeResultant;
TextView maxValues;
TextView maxResultant;

float x = 0;
float y = 0;
float z = 0;
float res = 0;
float xMax = 0;
float yMax = 0;
float zMax = 0;
float resMax = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    sm = (SensorManager)getSystemService(SENSOR_SERVICE);
    accelerometer = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

    sm.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_FASTEST);

    maxValue = (TextView)findViewById(R.id.MaxValue);
    realTimeValues = (TextView)findViewById(R.id.RealTimeValues);
    realTimeResultant = (TextView)findViewById(R.id.RealTimeResultant);
    maxValues = (TextView)findViewById(R.id.maxValues);
    maxResultant = (TextView)findViewById(R.id.maxResultant);


    float max = accelerometer.getMaximumRange();
    maxValue.setText("Max range: "+ max);           
}

@Override
public void onSensorChanged(SensorEvent event) {

    if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER)
        return;

    x = event.values[0];
    y = event.values[1];
    z = event.values[2];
    res = (float) Math.sqrt( x*x + y*y + z*z);

    realTimeValues.setText("X: " + x + "\nY: " + y + "\nZ: " + z);
    realTimeResultant.setText(res + " m/s^2");

    if (Math.abs(x) > Math.abs(xMax))
        xMax = x;
    if (Math.abs(y) > Math.abs(yMax))
        yMax = y;
    if (Math.abs(z) > Math.abs(zMax))
        zMax = z;
    if (res > resMax)
        resMax = res;

    maxValues.setText("X: " + xMax + "\nY: " + yMax + "\nZ: " + zMax);
    maxResultant.setText(resMax + " m/s^2");    
}
}
ace
  • 189
  • 1
  • 1
  • 9
  • Additional info: I realise that the post about 3.5Gs could have been a resultant acceleration of all 3 axis = sqrt(2^2 + 2^2 + 2^2). Still in need of assistance... – ace Jun 22 '13 at 20:33
  • I hope this helps: http://stackoverflow.com/questions/12739143/android-accelerometer-max-values (if you haven't seen it already :/) – ejavice Jun 24 '13 at 12:51
  • Thanks @user2493429, I had seen it. No-one seems to have carried on any threads post- 'I'll check it out' :/ – ace Jun 24 '13 at 20:50

1 Answers1

0

It seems impossible to do so.

It should also be noted that the Linear accelerometer is cannot essentially increase the range of accelerometer readings, even though its values go up to 3Gs (on some phones). The reason for this increase is only due to the way in which the linear acceleration is calculated (the use of a filter essentially) which sometimes results in values higher than 2Gs should the direction be switched quickly enough.

See here for calculation of linear accelerometer: http://developer.android.com/guide/topics/sensors/sensors_motion.html

ace
  • 189
  • 1
  • 1
  • 9