phyphox Forums
Arduino Nano - Phyphox - Printable Version

+- phyphox Forums (https://phyphox.org/forums)
+-- Forum: App-Feedback (https://phyphox.org/forums/forumdisplay.php?fid=6)
+--- Forum: Bugs and Problems (https://phyphox.org/forums/forumdisplay.php?fid=9)
+--- Thread: Arduino Nano - Phyphox (/showthread.php?tid=2029)



Arduino Nano - Phyphox - Fredrik Frisk - 10-22-2024

Hi,

I am currently designing an experiment for my course in Edge ML and the idea is to use arduino nano BLE 33 sense for data aquision and ML inference. I have connected the board via BLE to Phyphox and it has worked well. But I have now migrated to the rev 2 version of the board and now I do not get any data from the board. I hope someone have some idea what is wrong.

thanks,

Fredrik

My sketch:

#include <phyphoxBle.h>
#include <Arduino_LSM9DS1.h>
void setup()
{
   PhyphoxBLE::start("IMU - Gyroscope");
   //Experiment
   PhyphoxBleExperiment PlotAcc;  
   PlotAcc.setTitle("Gyroscope Plotter");
   PlotAcc.setCategory("Arduino Experiments");
   PlotAcc.setDescription("Plots angular velocity measured by the Arduino card's sensors");
   //View
   PhyphoxBleExperiment::View firstView;
   firstView.setLabel("FirstView"); //Create a "view"
   //Graph
   PhyphoxBleExperiment::Graph firstGraph;          
   firstGraph.setLabel("X Rotatation over time");
   firstGraph.setUnitX("s");
   firstGraph.setUnitY("deg/s");
   firstGraph.setLabelX("time");
   firstGraph.setLabelY("X Rotation");
   /* Assign Channels, so which data is plotted on x or y axis
   *  first parameter represents x-axis, second y-axis
   *  Channel 0 means a timestamp is created after the BLE package arrives in phyphox
   *  Channel 1 to N corresponding to the N-parameter which is written in server.write()
   */
   firstGraph.setChannel(0,1);    
   PhyphoxBleExperiment::Graph secondGraph;          
   secondGraph.setLabel("Y Rotation over time");
   secondGraph.setUnitX("s");
   secondGraph.setUnitY("deg/s");
   secondGraph.setLabelX("time");
   secondGraph.setLabelY("Y Rotation");
   
   secondGraph.setChannel(0,2);
   PhyphoxBleExperiment::Graph thirdGraph;          
   thirdGraph.setLabel("Z Rotation over time");
   thirdGraph.setUnitX("s");
   thirdGraph.setUnitY("deg/s");
   thirdGraph.setLabelX("time");
   thirdGraph.setLabelY("Z Rotation");
   
   thirdGraph.setChannel(0,3);
   firstView.addElement(firstGraph);            //attach graph to view
   firstView.addElement(secondGraph);
   firstView.addElement(thirdGraph);
   PlotAcc.addView(firstView);         //Attach view to experiment
     //Export
   PhyphoxBleExperiment::ExportSet mySet;       //Provides exporting the data to excel etc.
   mySet.setLabel("mySet");
   PhyphoxBleExperiment::ExportData gx;
   gx.setLabel("gx");
   gx.setDatachannel(1);
   PhyphoxBleExperiment::ExportData gy;
   gy.setLabel("gy");
   gy.setDatachannel(2);
   PhyphoxBleExperiment::ExportData gz;
   gz.setLabel("gz");
   gz.setDatachannel(3);
   mySet.addElement(gx);                   //attach data to exportSet
   mySet.addElement(gy);      
   mySet.addElement(gz);                  //attach data to exportSet
   PlotAcc.addExportSet(mySet);        //attach exportSet to experiment
   PhyphoxBLE::addExperiment(PlotAcc);      //Attach experiment to server
   
   if (!IMU.begin()) {
     while (1);
   }
}
void loop()
{
  float gx, gy, gz;
  if (IMU.gyroscopeAvailable()) {
    IMU.readGyroscope(gx, gy, gz);
    PhyphoxBLE::write(gx, gy, gz);
   
  }
}



RE: Arduino Nano - Phyphox - Jens Noriʇzsɔɥ - 10-22-2024

Hi Fredrik,

as far as I remember, the hardware changed in Rev 2, so you need other drivers to access the sensors. Our friends in Paris, https://vulgarisation.fr/projet/arduino_nano/?lang=en, ran in a similar problem and you should find the correct libraries in their sketch.


RE: Arduino Nano - Phyphox - Fredrik Frisk - 10-22-2024

(10-22-2024, 09:42 AM)Jens Noriʇzsɔɥ Wrote: Hi Fredrik,

as far as I remember, the hardware changed in Rev 2, so you need other drivers to access the sensors. Our friends in Paris, https://vulgarisation.fr/projet/arduino_nano/?lang=en, ran in a similar problem and you should find the correct libraries in their sketch.

Thanks Jens!

That would explain it. I will use the link you have provided.

/Fredrik


RE: Arduino Nano - Phyphox - Jens Noriʇzsɔɥ - 10-22-2024

For the sake of completeness,
Code:
#include <Arduino_BMI270_BMM150.h> // IMU: acceleration, rotation rate, magnetic field
#include <Arduino_LPS22HB.h> // pressure
#include <Arduino_HS300x.h> // temperature and humidity
#include <Arduino_APDS9960.h>  // gestures, color, proximity
works for the Arduino Nano 33 BLE Sense Rev2.


RE: Arduino Nano - Phyphox - Fredrik Frisk - 10-22-2024

(10-22-2024, 10:01 AM)Jens Noriʇzsɔɥ Wrote: For the sake of completeness,
Code:
#include <Arduino_BMI270_BMM150.h> // IMU: acceleration, rotation rate, magnetic field
#include <Arduino_LPS22HB.h> // pressure
#include <Arduino_HS300x.h> // temperature and humidity
#include <Arduino_APDS9960.h>  // gestures, color, proximity
works for the Arduino Nano 33 BLE Sense Rev2.

Thanks again Jens!

I have tested this sketch and downloaded corresponding experiments from

https://astro-lab.app/arduino-und-phyphox/

using their QR-code to set it up. The QR-code from the french site,

file:///C:/Users/frf/Downloads/tuto_phyphox_en_ppt_ajour.pdf

 never loaded, but I found the link to astro-lab and their QR-worked.

/Fredrik


RE: Arduino Nano - Phyphox - Jens Noriʇzsɔɥ - 10-22-2024

Physics Reimagined finally switched their web preference to their own domain and you just found an old link. I have sent Fred an email so that they can update it, too. Thanks for reporting.


RE: Arduino Nano - Phyphox - fbouquet - 10-22-2024

(10-22-2024, 02:32 PM)Jens Noriʇzsɔɥ Wrote: Physics Reimagined finally switched their web preference to their own domain and you just found an old link. I have sent Fred an email so that they can update it, too. Thanks for reporting.

Hello,

Indeed, we switch our website due to "unforeseen circumstances" (a cyberattack on our university website...). Sorry about the link you found, I forgot to update the pdf file during the switch. It is now fixed. (You may have to force-reload the webpage to have the newest version.)

Good luck with your experiments,

Fred


RE: Arduino Nano - Phyphox - Fredrik Frisk - 10-31-2024

(10-22-2024, 05:25 PM)fbouquet Wrote:
(10-22-2024, 02:32 PM)Jens Noriʇzsɔɥ Wrote: Physics Reimagined finally switched their web preference to their own domain and you just found an old link. I have sent Fred an email so that they can update it, too. Thanks for reporting.

Hello,

Indeed, we switch our website due to "unforeseen circumstances" (a cyberattack on our university website...). Sorry about the link you found, I forgot to update the pdf file during the switch. It is now fixed. (You may have to force-reload the webpage to have the newest version.)

Good luck with your experiments,

Fred

Thank you very much!

I will start next week.

/Fredrik