phyphox BLE
Plot your Arduino's data in the phyphox app and control the board from the phone
Loading...
Searching...
No Matches
phyphox BLE

Plot your Arduino's sensor data on a phone, and control the Arduino from the phone — with the free app phyphox and a few lines of code.

phyphox is a physics app from RWTH Aachen University that turns a phone's own sensors into measuring instruments, with live graphs, data analysis and export. This library lets any Bluetooth-capable Arduino-compatible board show up in that app as one more sensor: the board tells the phone what to display, sends its data, and receives values the user enters.

#include <phyphoxBle.h>
void setup() {
PhyphoxBLE::start(); // start the Bluetooth server
}
void loop() {
float value = analogRead(A0);
PhyphoxBLE::write(value); // plot it in phyphox
delay(50);
}
static void poll()
Gives the BLE stack CPU time and drives the transfer.
static void write(const float &v1)
static void start(const char *deviceName="phyphox-Arduino")
Advertise as deviceName ("phyphox-Arduino" by default).

Open phyphox, tap + → Bluetooth device, pick your board: the graph appears.

‍Version 2.0 is a rewrite of the library. Existing sketches keep working; see Migrating from 1.x for the few things that changed and the Changelog for what is new.

Supported boards

board Bluetooth library status notes
ESP32, ESP32-C3 ESP32 core (board package 3.x or 4.x) tested nothing to install
other ESP32 variants with a radio (S3, C6, …) ESP32 core (board package 3.x or 4.x) compiled (S3) nothing to install
Arduino Nano 33 BLE / Sense / Sense Rev2 ArduinoBLE tested (Nano 33 BLE) installed automatically; call PhyphoxBLE::poll() in loop()
Arduino Nano 33 IoT ArduinoBLE tested NINA firmware ≥ 3.0 (Firmware Updater); poll() in loop()
Arduino MKR WiFi 1010, Nano RP2040 Connect ArduinoBLE compiled NINA firmware ≥ 3.0 (Firmware Updater); poll() in loop()
Arduino UNO R4 WiFi ArduinoBLE tested poll() in loop()
Arduino Nicla Sense ME ArduinoBLE tested poll() in loop()
senseBox MCU with Bluetooth-Bee NINA-B31 (serial) tested poll() in loop()
senseBox MCU-S2 with Bluetooth-Bee, MKR1000 with NINA-B31 NINA-B31 (serial) compiled poll() in loop()
Portenta H7, GIGA R1 WiFi, UNO WiFi Rev2 ArduinoBLE untested poll() in loop()
STM32WB and other STM32duinoBLE boards STM32duinoBLE untested install it; poll() in loop()

tested: on the bench with the Android and the iOS app before the release, every example; compiled: every example compiles in the continuous integration, never run on the board; untested: neither, expected to work through the same Bluetooth library — reports welcome.

Details per board: Getting started.

Beyond the simple API

Describe what the phone should show — tabs, graphs with labelled axes, values, sliders, buttons — and get it back:

PhyphoxBleExperiment exp("Voltmeter", "Arduino Experiments", "Voltage on A0 over time.");
PhyphoxBleExperiment::Graph graph("Voltage");
graph.setChannel(0, 1); // time on x, channel 1 on y
graph.setLabelX("Time"); graph.setUnitX("s");
graph.setLabelY("Voltage"); graph.setUnitY("V");
PhyphoxBleExperiment::Slider gain("Gain", 1, 10, 1, /*input channel*/ 1);
gain.onChange([](float g) { gainFactor = g; });
view.addElement(graph).addElement(gain);
exp.addView(view);
PhyphoxBLE::start("Voltmeter", exp);
Definition phyphoxBleExperiment.h:74
Definition phyphoxBleExperiment.h:194
A tab in the app. Links its elements into a list until addExperiment() copies them.
Definition phyphoxBleExperiment.h:253
Definition phyphoxBleExperiment.h:34

The examples/ folder (File → Examples → phyphox BLE in the IDE) has a sketch for every feature. The documentation is in `docs/`, and published together with the reference of every class and method at **https://phyphox.github.io/phyphox-arduino/**.

Contributing, licence, contact

Issues and pull requests are welcome here. The library is released under the GNU Lesser General Public Licence v3.0 or later (COPYING.LESSER). Contact: conta.nosp@m.ct@p.nosp@m.hypho.nosp@m.x.or.nosp@m.g.

Developed by the phyphox team at RWTH Aachen University; the original library was created by Alexander Krampe (master thesis), maintained by Dominik Dorsel, and extended by Marcel Hagedorn and Edward Leier. Version 2.0 is an AI-assisted full rewrite.