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);
PhyphoxBLE::poll();
}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.
| 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.
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::View view("Data");
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);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/.
Note, that this library is just a wrapper to easily integrate phyphox into Arduino projects without learning the phyphox file format. Even the example above is just a fraction of what the full phyphox file format can do.
Please refer to the phyphox docs and in particular the documentation of the BLE interface to learn what it can do. This is especially relevant if you want to transfer data in a more efficient format than 32bit floats or if you are implementing your own BLE communication without even using this library directly.
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: [email protected].
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.