Smoothing data from a sensor

The simplest is to do a moving average of your data. That is, to keep an array of sensor data readings and average them. Something like this (pseudocode): data_X = [0,0,0,0,0]; function read_X () { data_X.delete_first_element(); data_X.push(get_sensor_data_X()); return average(data_X); } There is a trade-off when doing this. The larger the array you use, the smoother … Read more

How to detect movement of an android device?

Definitely work with the accelerometer: // Start with some variables private SensorManager sensorMan; private Sensor accelerometer; private float[] mGravity; private float mAccel; private float mAccelCurrent; private float mAccelLast; // In onCreate method sensorMan = (SensorManager)getSystemService(SENSOR_SERVICE); accelerometer = sensorMan.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mAccel = 0.00f; mAccelCurrent = SensorManager.GRAVITY_EARTH; mAccelLast = SensorManager.GRAVITY_EARTH; // And these: @Override public void onResume() { … Read more

Android TYPE_LINEAR_ACCELERATION sensor – what does it show?

Very interesting question!!!! I’m developing somethig similar to your application. What i found about TYPE_LINEAR_ACCELERATION isn’t happy for me. 1) TYPE_LINEAR_ACCELERATION, TYPE_GRAVITY, ecc are implemented only for Android 2.3 (and up) So i have Android 2.2 and i can’t test them. 2) TYPE_LINEAR_ACCELERATION isn’t so accurate as it would be, because there are some simple … Read more

How to use onSensorChanged sensor data in combination with OpenGL

I couldn’t test the code yet (but I will, looks really interesting). One thing that caught my attention is that you don’t seem to filter the sensor data in any way. Sensor readings are very noisy by nature, specially the magnetic sensor. I’d suggest you implement some low pass filtering. See my previous answer for … Read more

Android accelerometer not working when screen is turned off

Basically, it is a problem with my phone. Other users have reported this also happens with their phones, from different brands but same Android version. Other persons have no problem at all – strongly indicating that this is not a problem with the stock version of android but from the implementations of each company for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)