Accelerometer insists z axis is accelerating at over 9 m/s/s all the time

While my Android Nexus 6P,
running Blynk app version 2.27.1
is laying flat on a table,
the code:

BLYNK_WRITE(V8) { // acceleration
    float x = param[0].asFloat();
    float y = param[1].asFloat();
    float z = param[2].asFloat();
    Serial.print(F("x: "));Serial.print(x);
    Serial.print(F(" y: "));Serial.print(y);
    Serial.print(F(" z: "));Serial.println(z);   
}

reports that the phone is in free fall (9.8m/s/s)

x: -0.21 y: -0.43 z: 9.95
x: -0.21 y: -0.41 z: 9.96
x: -0.22 y: -0.41 z: 9.93
x: -0.22 y: -0.41 z: 9.97
x: -0.21 y: -0.40 z: 9.95
x: -0.21 y: -0.41 z: 9.98
x: -0.19 y: -0.41 z: 9.96
x: -0.21 y: -0.41 z: 9.94
x: -0.21 y: -0.41 z: 9.95
x: -0.21 y: -0.40 z: 9.93
x: -0.22 y: -0.41 z: 9.97
x: -0.22 y: -0.41 z: 9.92

I ran two accelerometer calibration apps which did not make any difference.

Is this a problem with my accelerometer or is there a problem in the z axis code on Android 8.1.0?

Truncating the values to integers, as the sample code suggests (perhaps erroneously), https://docs.blynk.cc/#widgets-sensors-accelerometer (and in the app),
does not resolve the false z axis data.

Code running on the ESP8266 is 0.6.1 (probably irrelevant).

Aside from the widget simply reading what you hardware reports, this doesn’t seem like Blynk specific issue. Might I suggest Googling for your particular phone and issue… It seems there have been many…

https://www.google.com/search?q=Android+Nexus+6P+accelerometer

I don’t use the accelerometer much… but further tests or three different androids seems to indicate a Z axis reading in the 9.x as normal :thinking: I would recommend further Googling about interpreting the sensors output.

All hardware accelerometers are subject to failure, furthermore I suggested that it could be hardware. Until we know of the Blynk app 2.27.1 running on Android 8.1 reporting z accelerations close to zero we cannot determine if this is a Blynk issue or a hardware issue.

I am ignoring the z axis for my needs. The report is here for the potential that it is a Blynk app bug.

yes, I believe that the 9.8m/s/s should be subtracted from the z values.

Since my phone is stationary, I expect that to be done by Blynk as it is documented as a type of motion sensor.

Easiest way to confirm is to compare with a non-Blynk reading of the same sensor. On two different phones, using another App, I see a lying flat reading of -0.99 so it could be a rounding or decimal error
with Blynk??

I will leave this as is. But if you wish to pursue the bug hunt, I would recommend also mentioning that the reading rate doesn’t seem to actually change the rate of reading. I was not using any code to test, just a simple Accelerometer Widget and a Display Widget on same vPin… and blinking fast to see the results :stuck_out_tongue:

I have not yet tried the gravity widget yet, but I would expect it to return what the accelerometer is returning, and that the difference is that 9.8 would be subtracted from the z in the acceleorometer.

If z is positive going up, then in fact the phone is not in free fall but the opposite.

It is not clear what the expected difference is between the two widgets.