Disconnect/Failure behaviour


I have implemented a Cordova/Android app in which I stream the gyroscope and accelerometer at 50Hz. With changed connection settings this seems to work reasonably well.
But occasionally I seem to encounter connection failures which I cannot explain. Both the mobile phone and sensor battery are full enough, the distance between them is minimal (next to each other). But still sometimes after a few seconds or minutes, sometimes after half an hour, there is a connection failure.
What can cause these problems? And what can I do to prevent them?
How does the metabase app work while recording data? Does it simply reconnect if a failure is detected? Which would result in missing some data in the stream?



  • Just a follow up on this post. If the disconnect happens, I receive a error status 8 (timeout if I'm right). Also what stands out is that if I walk out of range, and walk back, then reconnect, the streaming is still active.
    But if the connection is dropped unexpectedly, the streaming is also stopped.

    The Android logs don't show any other information, but is some internal sensor state stopping the connection and streaming?
  • Try using the latest firmware (v1.2.4) and see if that helps  Also, you should check if it's an issue with your Android device by running the same test with other devices, like an iOS device or a different Android device.  Random disconnects, such as what you are describing, suggests its an issue with your device's bluetooth drivers.

    MetaBase doesn't stream data.
  • Thanks for the reply. The 1.2.4 firmware seems to improve the stability, but every now and than the connection is dropped.
    We are using multiple (Android) devices, with a R and RPro. The same behaviour is seen with all these devices.

    Also, after an unexpected connection loss and the stopped streams, I also noticed that the board is rejecting connections for a short while. A connection request is immediately ignored. This is not the case when walking out of range. It looks like the board has reset/restarted itself?
  • Also, how does the MetaBase app record data? Especially over longer periods. As far as I understood, the internal memory isn't that big.
    Eg, I'd like to record data for over an hour at 50Hz for 2 sensors.

  • Which android devices and OS did you test with?  I was able to stream gyro and acc data @ 100Hz to a Nexus 6 on Android M.  

    MetaBase only logs data.
  • This is on a Samsung Note 4 with Android 6.0.1 and on a Motorola with Android 5, I don't know the specific type and version.

    But as said, streaming works, but every now and than the connection is dropped. I did several tests yesterday, and I don't see how it can be related to the problem, but when having the sensor and device on my desk or with me walking around then more than 99% it is ok.
    But yesterday I had the sensor and device in my car, and I lost the connection several times.

    Out of curiosity, what connection settings do you use for streaming?

    Thanks again!
  • edited September 2016
    Most modern cars have a Bluetooth entertainment system these days so perhaps that disrupts the btle connection.  Given that you said the connection drops is very infrequent, you should just reset the Bluetooth adapter before starting a stream.

    The only change I have for the connection parameters is decreasing the max connection interval to 7.5ms.
  • Thanks for the help so far. 

    How can I reset the adapter using the API? I guess I'm overlooking the specific part in the documentation.
  • Bluetooth specific functions are not part of the MetaWear API.  You need to use the Android API for this or just simply reset it from the settings menu.
  • Ah ok, now I see. I thought you meant a reset of the sensor. I looked over the "adapter" part :).

    Do you, or perhaps anyone else, know if and how this can be done using android? I've looked into it for a while now, and having to stop/start the bluetooth service seems to be quite a drastic measure :(.
This discussion has been closed.