10-22-2024, 08:57 AM
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);
}
}
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);
}
}