09-07-2020, 10:26 AM
(This post was last modified: 09-08-2020, 12:23 PM by Dominik Dorsel.)
Hey Gautier,
your code looks quite good so far. To write your configuration data once after a connection is established you just have to replace the "input" tag on the bluetooth output to "config".
Furthermore you should add an "id" to both bluetooth blocks. If the bluetooth in- and output have the same id phyphox knows that they belong to one device.
Unfortunately I cannot test my changes until tomorrow. So if its not working out of the box I might messed something up here.
EDIT: Well I messed something up and figured out that something is not working as intended. Right now it looks like phyphox is not writing the container value to the caracteristic... In the version below i did not write the value of the container "choice" but wrote a value directly to the arduino. This should fulfill your desired purpose and adds another point on my todo-list
.
The data transmision rate is little complex topic. If you are interested in some of the details I can recommend this article:
https://punchthrough.com/maximizing-ble-...d-android/
My practical experience: I was able to get up to 100Hz with a pixel 2 and Arduino Nano 33 BLE (my Smartphone was closeley to the Arduino). This rate is also not very reliable due to package loss etc. A rate of 50Hz is much more stable and thus usable for experiments. I have to admit my data rate test was without our library some months ago. I should test this again with our library, there might be some room for improvement on the library side.
You should also consider the data rate of the pressure sensor. The pressure sensor for example is one of the "slower" sensor with a maximum rate of 75Hz
(Datasheet: https://content.arduino.cc/assets/Nano_B...ps22hb.pdf)
Some currently possible workaraounds are:
- buffer your data with timestamps on the arduino and send them afterwards
- get up to 5 float values and send them at ones, you have to rearrange them with phyphox before visualization
Dominik
your code looks quite good so far. To write your configuration data once after a connection is established you just have to replace the "input" tag on the bluetooth output to "config".
Furthermore you should add an "id" to both bluetooth blocks. If the bluetooth in- and output have the same id phyphox knows that they belong to one device.
Unfortunately I cannot test my changes until tomorrow. So if its not working out of the box I might messed something up here.
EDIT: Well I messed something up and figured out that something is not working as intended. Right now it looks like phyphox is not writing the container value to the caracteristic... In the version below i did not write the value of the container "choice" but wrote a value directly to the arduino. This should fulfill your desired purpose and adds another point on my todo-list
![Sad Sad](https://phyphox.org/forums/images/smilies/sad.png)
The data transmision rate is little complex topic. If you are interested in some of the details I can recommend this article:
https://punchthrough.com/maximizing-ble-...d-android/
My practical experience: I was able to get up to 100Hz with a pixel 2 and Arduino Nano 33 BLE (my Smartphone was closeley to the Arduino). This rate is also not very reliable due to package loss etc. A rate of 50Hz is much more stable and thus usable for experiments. I have to admit my data rate test was without our library some months ago. I should test this again with our library, there might be some room for improvement on the library side.
You should also consider the data rate of the pressure sensor. The pressure sensor for example is one of the "slower" sensor with a maximum rate of 75Hz
(Datasheet: https://content.arduino.cc/assets/Nano_B...ps22hb.pdf)
Some currently possible workaraounds are:
- buffer your data with timestamps on the arduino and send them afterwards
- get up to 5 float values and send them at ones, you have to rearrange them with phyphox before visualization
Dominik