Posts: 1
Threads: 1
Joined: Sep 2023
Institution: CAU Kiel
Hi there,
is there a possibility to run the phyphox BLE library on Arduino Wifi R4, or is support planned in near future?
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
We have just received two of the new Unos, however, not yet looked into these.
Support is certainly planned, “when” depends on the effort we have to put into it. Hard to tell right now.
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
At first sight, it looks that the new Unos operate exactly like the IoTs. The following patch makes it work for the time being (the libraries are stored in the sketchbook folder):
Code:
diff -dur phyphox_BLE.std/library.properties phyphox_BLE/library.properties
--- phyphox_BLE.std/library.properties
+++ phyphox_BLE/library.properties
@@ -6,5 +6,5 @@
paragraph=The purpose of this library is to use the open source phyphox app (see https://phyphox.org) to plot sensor data on your phone. phyphox is much more than only 'plotting your data'. You can also perform data analysis with it or access your phones sensors to use in your Arduino project.
category=Other
url=https://phyphox.org/arduino
-architectures=mbed,esp32,samd,mbed_nano
+architectures=mbed,esp32,samd,mbed_nano,renesas_uno
includes=phyphoxBle.h
diff -dur phyphox_BLE.std/src/phyphoxBLE_NanoIOT.cpp phyphox_BLE/src/phyphoxBLE_NanoIOT.cpp
--- phyphox_BLE.std/src/phyphoxBLE_NanoIOT.cpp
+++ phyphox_BLE/src/phyphoxBLE_NanoIOT.cpp
@@ -1,4 +1,4 @@
-#ifdef ARDUINO_SAMD_NANO_33_IOT
+#if defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_UNOR4_WIFI)
#include "phyphoxBLE_NanoIOT.h"
#include "Arduino.h"
diff -dur --minimal phyphox_BLE.std/src/phyphoxBle.h phyphox_BLE/src/phyphoxBle.h
--- phyphox_BLE.std/src/phyphoxBle.h
+++ phyphox_BLE/src/phyphoxBle.h
@@ -23,7 +23,7 @@
#elif defined(ESP32)
#include "phyphoxBLE_ESP32.h"
-#elif defined(ARDUINO_SAMD_NANO_33_IOT)
+#elif defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_UNOR4_WIFI)
#include <ArduinoBLE.h>
#include "phyphoxBLE_NanoIOT.h"
#else
Please note that you also need to add “PhyphoxBLE::poll();” to the “loop()” function and you must provide a name in “PhyphoxBLE::start("<name>");” (likely a bug in our BLE driver for the IoT)…
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
BTW, the BLE support has just been added to the Arduino code base on August 30. Please note that you have to update the board firmware to make it work at all…
Posts: 2
Threads: 0
Joined: Sep 2023
Institution: Teacher
Hi Jens,
great you found time, supporting the R4 Wifi.
As a newbie in Arduino / C++ I don't really have an idea, what to do with the patch-code.
Do I have to include it to the first section of declarations in my *.ino file or do I need to modify the phyphoxBle.h file or similar?
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
In order to patch (edit), you need to find the Arduino sketchbook folder, head to the libraries and phyphox_BLE folder, and edit the three files in the “diff […]” lines. The diffs perhaps speak for themselves…
If you have (hopefully just) some hours of time, I would recommend to wait for the library update. The next major update has been pending for days (weeks). At the moment, it looks that the R4 changes are either minimal –or fix substantial … inconveniences in the IoT part anyway. So we should not hold these back.
Posts: 2
Threads: 0
Joined: Sep 2023
Institution: Teacher
Had been impatient ;-)
- anyway, it is working now and I have learned something in the end.
Thanks
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
The update is now available in the Arduino IDE: phyphoxBLE 1.2.0 (see
https://github.com/phyphox/phyphox-ardui...tag/v1.2.0)…
Posts: 4
Threads: 1
Joined: Nov 2023
Institution: EKFE Rethymnon
Ηι, Ι try to use an Arduino UNO R4 with a sonar sensor HC-SR04.
I get this error message :
Compilation error: 'currentConnections' is not a member of 'PhyphoxBLE'
I send you my code
Code:
#include <ArduinoBLE.h>
#include <phyphoxBle.h>
#include <NewPing.h>
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
char board_name[]="UnoUltraSonic";
unsigned long initial_time, first_time, first_difference_float ;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
pinMode(LED_BUILTIN, OUTPUT);
PhyphoxBLE::minConInterval = 6; //6 = 7.5ms
PhyphoxBLE::maxConInterval = 6; //6 = 7.5ms
PhyphoxBLE::slaveLatency = 0; //
PhyphoxBLE::timeout = 10; //10 = 100ms
PhyphoxBLE::start(board_name); // Το όνομα του board μπορεί να αλλάξει στην αρχή του προγράμματος
PhyphoxBLE::configHandler=&receivedData; // δείτε το παράδειγμα της βιβλιοθήκης Phyphox Arduino library
}
void receivedData(){ // δείτε το παράδειγμα της βιβλιοθήκης Phyphox Arduino library
if (PhyphoxBLE::currentConnections == 1){
initial_time = millis(); //ορίζει την αρχή του χρόνου
}
}
void loop() {
delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
Serial.print("Ping: ");
Serial.print(sonar.ping_cm()); // Send ping, get distance in cm and print result (0 = outside set distance range)
Serial.println("cm");
first_time = millis();
first_difference_float = ((float)first_time-(float)initial_time)/1000;
PhyphoxBLE::poll();
PhyphoxBLE::write(first_difference_float, sonar.ping_cm() );
}
Posts: 543
Threads: 24
Joined: Apr 2020
Institution: RWTH Aachen University
There is no “currentConnections” in the NanoIOT driver that is used for the UNO R4. It just exists for ESP32 boards and boards with NRF52.
Which example is your code built one? I wonder if all the class members that you are accessing should really be exposed to public…