05-06-2022, 11:41 AM
Hey,
your code looks good! I think the problem is within your loop-block:
This line will return a 1 when new data is available (and the datapoints itself of course). If the accelerometer is not ready, you get an 0 and NAN as you can see in the libraries repository:
https://github.com/arduino-libraries/Ard...1.cpp#L109
Since the loop is basicly running with no delay (except this very small 1ms) you will call some "readAccelertion" while no data is available. You should get new data every ~10ms, since the output data rate is fixed to 104Hz in this library (if you want to change the data rate, you might switch to another library - i think the sparkfun one is able to set some settings).
To avoid this, you could go with this:
Next issue might be the limiting bluetooth low energy rate. Depending on your smartphone and connection quality you will not be able to reach 115Hz. You should also check the phyphoxBLE example "connectionParamter" which allows to tweak the bluetooth paramter. This thread might be helpful aswell, since our french colleagues where able to get this rate with the same arduino setup:
https://phyphox.org/forums/showthread.php?tid=1026
Let me know if its still not working.
Cheers,
Dominik
your code looks good! I think the problem is within your loop-block:
Code:
IMU.readAcceleration(x, y, z);
This line will return a 1 when new data is available (and the datapoints itself of course). If the accelerometer is not ready, you get an 0 and NAN as you can see in the libraries repository:
https://github.com/arduino-libraries/Ard...1.cpp#L109
Since the loop is basicly running with no delay (except this very small 1ms) you will call some "readAccelertion" while no data is available. You should get new data every ~10ms, since the output data rate is fixed to 104Hz in this library (if you want to change the data rate, you might switch to another library - i think the sparkfun one is able to set some settings).
To avoid this, you could go with this:
Code:
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
PhyphoxBLE::write(x, y, z);
}
https://phyphox.org/forums/showthread.php?tid=1026
Let me know if its still not working.
Cheers,
Dominik