09-11-2020, 09:23 AM
Hey everyone,
thanks for sharing this observations!
Your "first"-approach could work but i see there some problems which might cause the data loss. Im not sure but i think the analysis loop is running independent from the incomming bluetooth data. This means it could be possible that you get 2 new values into CH1 container while your analysis is currently running. At the beginning of the next analysis run phyphox will take the first value and clear the second one.
You could proof this with sending continuous data, so first value = 1 second value = 2 and so on. If for example value 3 & 4 will be received at roughly the same time during a analysis loop your routine should take value = 3 and clear value = 4.
Another approach would be using the append function. With this you could append multiple values to your "allData" container.
The 4-data-package observation looks like you are using an iPhone ;-) Bluetooth Low Energy is able to send more than 1 data packet per connection interval. The number of packages is limited to 4 by iOS and to 6 by Android. Since your already at the maximum of packages per connection interval I assume that you are limited due to the connection interval. (This is just a rough summary, more details can be found in the already mentioned article : https://punchthrough.com/maximizing-ble-...d-android/ )
To play around with the connection parameters I implemented a feature to set these values within the phyphox library. You can find this version here:
https://github.com/Dorsel89/phyphox-ardu...nParameter
You might should uninstall the official version of the phyphox library first! Afterwards you can download my version as zip and add it via "sketch" - "add library" - "add Zip Library". I also added the example "connectionParameter" where i decreased the connection interval.
In general you have to set a min and max connection interval value. For me it looks like phyphox always choses the max value (right now i dont know if its possible to change this behaviour).
You can check the actualy used connection interval with the android app "nrf connect". For me it looks like the iOS version does not have this feautre.. but maybe i just couldnt find it.
Cheers,
Dominik
thanks for sharing this observations!
Your "first"-approach could work but i see there some problems which might cause the data loss. Im not sure but i think the analysis loop is running independent from the incomming bluetooth data. This means it could be possible that you get 2 new values into CH1 container while your analysis is currently running. At the beginning of the next analysis run phyphox will take the first value and clear the second one.
You could proof this with sending continuous data, so first value = 1 second value = 2 and so on. If for example value 3 & 4 will be received at roughly the same time during a analysis loop your routine should take value = 3 and clear value = 4.
Another approach would be using the append function. With this you could append multiple values to your "allData" container.
The 4-data-package observation looks like you are using an iPhone ;-) Bluetooth Low Energy is able to send more than 1 data packet per connection interval. The number of packages is limited to 4 by iOS and to 6 by Android. Since your already at the maximum of packages per connection interval I assume that you are limited due to the connection interval. (This is just a rough summary, more details can be found in the already mentioned article : https://punchthrough.com/maximizing-ble-...d-android/ )
To play around with the connection parameters I implemented a feature to set these values within the phyphox library. You can find this version here:
https://github.com/Dorsel89/phyphox-ardu...nParameter
You might should uninstall the official version of the phyphox library first! Afterwards you can download my version as zip and add it via "sketch" - "add library" - "add Zip Library". I also added the example "connectionParameter" where i decreased the connection interval.
In general you have to set a min and max connection interval value. For me it looks like phyphox always choses the max value (right now i dont know if its possible to change this behaviour).
You can check the actualy used connection interval with the android app "nrf connect". For me it looks like the iOS version does not have this feautre.. but maybe i just couldnt find it.
Cheers,
Dominik