This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Using PhyPhox for lsm9ds1 accelerometer
#2
Hey,

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);
}
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
Reply


Messages In This Thread
RE: Using PhyPhox for lsm9ds1 accelerometer - by Dominik Dorsel - 05-06-2022, 11:41 AM

Forum Jump: