Posts: 1
Threads: 1
Joined: Jun 2022
Institution: Sable Systems
Greetings! I'm experimenting with uploading data from a lengthy Arduino experiment (up to several hours, which makes it impractical to read sample-by-sample on an iPhone because of power & auto-off considerations). Typical sample sizes will be 500 - 20000 samples, in an Arduino environment using an ESP32. I'd like to upload these samples as soon as a BLE connection is made to the device and the "run" icon is tapped. Is there a way to detect, within the provided Arduino library (great work!), when Phyphox has been activated & is ready to receive & record data? So that when the connection is made & the run icon is tapped, the data can be uploaded from the Arduino app in a burst? (The timebase in minutes is recorded as one channel of data & is used as the X axis.)
I've looked through the library code & don't see an obvious way to do this. Any help would be greatly appreciated!
Posts: 52
Threads: 0
Joined: Aug 2018
Institution: RWTH Aachen University
Hey,
thanks for bringing this up. Currently its just possible to get the current number of connections with:
Code: uint16_t PhyphoxBLE::currentConnections
Unfortunately there is no way to "auto-start" the experiment or get information about the current state of the play-button right now. But I think this could be added relatively easily. I will talk with one of our student assistant who is already working on some updates for the library to add this feature in near future.
Cheers
Dominik
Posts: 3
Threads: 0
Joined: Jan 2023
Institution: SRM Institute of Science and Technology
(06-13-2022, 10:50 AM)Dominik Dorsel Wrote: Hey,
thanks for bringing this up. Currently its just possible to get the current number of connections with:
Code: uint16_t PhyphoxBLE::currentConnections
Unfortunately there is no way to "auto-start" the experiment or get information about the current state of the play-button right now. But I think this could be added relatively easily. I will talk with one of our student assistant who is already working on some updates for the library to add this feature in near future.
Cheers
Dominik Hi Dominik,
I wanted to ask you if there has been an update on the same feature requested by @heliophagus.
My project requires me to send high rates of data(100-120 samples/second) from an Arduino nano 33 BLE and simultaneously store the data in a SD-card connected with the Arduino.
In order to sync the data being displayed in the graph of the phyphox app and the ones I store in the SD-card, it is important for me to know when the "play" button is pressed in the app.
Alternatively, is there a way I can send, say a 5 min data buffer from phyphox to the arduino? I can then store the data buffer directly into the SD card.
Regards,
Mukund
Posts: 52
Threads: 0
Joined: Aug 2018
Institution: RWTH Aachen University
Hey,
unfortunately we dont have an finished update on this. But the next update is almost finished and contains the following:
- An "Event characteristic" is added to the BLE server. If phyphox sees an event characteristic on the connected device, it will write the current real time (unix time), the current experiment time and the status of the experiment ( started, paused, synced).
- New layout options will be available such as multiple data sets in one graph with lines or dots (or mixed) or different colors
- Multiple float values can be received
- Smatphone sensordata can be readout and send to the microcontroller
- The generated xml file can be printed to the serial monitor
- The memory consumption significantly reduced
So especially the first feature should solve your issues :-). Unfortunately we found a bug in the (android) version of phyphox regarding the event characteristic, which we have to fix before we publish the new version of the library . If you are using an iOS device, feel free to test my current branch of the library (disclaimer: Im not sure if messed up some parts in my dev branch, so you might encounter some problems)
https://github.com/Dorsel89/phyphox-ardu...ext-update
Cheers
Dominik
Posts: 3
Threads: 0
Joined: Jan 2023
Institution: SRM Institute of Science and Technology
(01-26-2023, 01:42 PM)Dominik Dorsel Wrote: Hey,
unfortunately we dont have an finished update on this. But the next update is almost finished and contains the following:
- An "Event characteristic" is added to the BLE server. If phyphox sees an event characteristic on the connected device, it will write the current real time (unix time), the current experiment time and the status of the experiment ( started, paused, synced).
- New layout options will be available such as multiple data sets in one graph with lines or dots (or mixed) or different colors
- Multiple float values can be received
- Smatphone sensordata can be readout and send to the microcontroller
- The generated xml file can be printed to the serial monitor
- The memory consumption significantly reduced
So especially the first feature should solve your issues :-). Unfortunately we found a bug in the (android) version of phyphox regarding the event characteristic, which we have to fix before we publish the new version of the library . If you are using an iOS device, feel free to test my current branch of the library (disclaimer: Im not sure if messed up some parts in my dev branch, so you might encounter some problems)
https://github.com/Dorsel89/phyphox-ardu...ext-update
Cheers
Dominik
Hi Dominik,
Thank you for your response.
I checked out your current branch for the library and I'm happy to see the updates! Especially the first one, since it outright solves the problem and the 5th one as it would be helpful to print the generated xml to debug occasional xml parse errors.
I am not currently using an iOS device and have requested my colleague to get me one so that we can test it out. Our use-case predominantly focuses on Android devices at the moment, hence, will wait for your Android bug fix to test it on an Android device.
Another question that popped in my mind, is it possible to create a custom experiment(using the editor tool/xml code) that includes a button to trigger the in-app graphical display while simultaneously sending the button state to the Arduino BLE device?
Really appreciate the awesome work you guys have done(and are doing) with Phyphox!
Best Regards,
Mukund
Posts: 547
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
(01-26-2023, 03:23 PM)Mukund Wrote: Another question that popped in my mind, is it possible to create a custom experiment(using the editor tool/xml code) that includes a button to trigger the in-app graphical display while simultaneously sending the button state to the Arduino BLE device?
What do you mean by trigger: resetting a graph or tapping the “play” button? There is some discussion on sending button states inside tabs at https://phyphox.org/forums/showthread.php?tid=1640
Posts: 52
Threads: 0
Joined: Aug 2018
Institution: RWTH Aachen University
Hey,
Jens got already a good starting point if I understand your question correctly. In case you dont know: It is possible to add an .phyphox file to your arduino sketch. Therefore you have to convert the .phyphox (or a zip file with one or multiple) file into an byte array and add it to the start function as we did in our CO2 project:
https://github.com/Dorsel89/phyphox-ardu...it.ino#L65 (check also line 75)
I know its ugly, but this way you can use all in phyphox available features and still store the experiment localy on your microcontroller without being limited by the library. If you dont know how to get the byte array you might want to take a look in the following java script (I know its ugly aswell, but since its rarely requested im too lazy to make a prober "public suitable" version ).
https://github.com/Dorsel89/ZipFileToByteArray
Cheers
Dominik
Posts: 3
Threads: 0
Joined: Jan 2023
Institution: SRM Institute of Science and Technology
01-27-2023, 04:40 PM
(This post was last modified: 01-27-2023, 04:57 PM by Mukund.)
(01-26-2023, 05:03 PM)Jens Noritzsch Wrote: (01-26-2023, 03:23 PM)Mukund Wrote: Another question that popped in my mind, is it possible to create a custom experiment(using the editor tool/xml code) that includes a button to trigger the in-app graphical display while simultaneously sending the button state to the Arduino BLE device?
What do you mean by trigger: resetting a graph or tapping the “play” button? There is some discussion on sending button states inside tabs at https://phyphox.org/forums/showthread.php?tid=1640 Hi Jens,
I checked the link out and it seems like a good start to implement the button I wanted to.
For clarification on your question: I want the button to act as a way to reset/restart the graph(will have to check methods that clear the screen for the new graph to be displayed) and signal to the Arduino device that it's time to create a data buffer to be written to the SD-card. I want the user to be able to control each new "start" of the display and automate the SD-card writing simultaneously. The graphs would be displayed only for 5 minutes, post which Arduino would store the 5 minute data to the SD-card, stop sending data to the server and wait to listen to the next "button pressed" state.
Will try it out and let you know if I get stuck anywhere.
Thanks for the help!
(01-26-2023, 07:08 PM)Dominik Dorsel Wrote: Hey,
Jens got already a good starting point if I understand your question correctly. In case you dont know: It is possible to add an .phyphox file to your arduino sketch. Therefore you have to convert the .phyphox (or a zip file with one or multiple) file into an byte array and add it to the start function as we did in our CO2 project:
https://github.com/Dorsel89/phyphox-ardu...it.ino#L65 (check also line 75)
I know its ugly, but this way you can use all in phyphox available features and still store the experiment localy on your microcontroller without being limited by the library. If you dont know how to get the byte array you might want to take a look in the following java script (I know its ugly aswell, but since its rarely requested im too lazy to make a prober "public suitable" version ).
https://github.com/Dorsel89/ZipFileToByteArray
Cheers
Dominik Hey Dominik,
Yes, I think Jen's recommendation might work, just need to quickly implement it and test it out.
Thanks for explaining how I could add the .phyphox file to the Arduino sketch, I was a bit lost there.
I also checked the java script file and it seems good enough for me to generate the required byte array. Since we are prototyping with an IOT device right now, I do not mind an "ugly" solution to the problem(since most of our solutions are also ugly ).
Thanks again for the prompt help!
|