Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

Recently, I saw that the official Phyphox released the Phyphox-BLE extension library, which is posted on the Arduino.cc website: https://www.arduino.cc/reference/en/libraries/phyphox-ble/, and the address is https://github.com/Staacks/phyphox-arduino. The self-introduction says it is not very mature yet, but the few examples provided already show that it is quite complete. Here, I will record a simple trial without going into too much detail.

1. Basic Concepts

Let me introduce a little bit of basic information; I am also a learner and a novice.

1. ESP32 Development Board. Simply put, the ESP32 is an enhanced version of an IoT development board that integrates Bluetooth BLE, WIFI, and other functions. It has stronger performance than the common Arduino, but the usage is quite similar.

2. Phyphox & Phyphox Editor. Phyphox is an app developed specifically for physics experiments. It fully utilizes the sensor capabilities of Android, iPhone, and other devices, turning smartphones and tablets into mobile sensor laboratories. Phyphox comes with a small number of customized experiments, and if users want to create their own experiments or study the principles of the provided experiments, they can use the experiment editor, Phyphox Editor, which is an online editor for creating personalized creative experiments. The address is https://phyphox.org/editor/.

3. Bluetooth 5.0 BLE. Bluetooth is a data sharing protocol that has evolved over several generations. Currently, the low power consumption of the 5.0 protocol can be recognized by both Android and Apple devices. Generally, Bluetooth protocols before 4.0 are not recognized by Apple devices.

2. Why ESP32?

1. Insufficient sensors in Phyphox. Generally, smartphones already have enough sensors, but there are still times when they are insufficient. For example, most Android phones do not have a barometer, and most phones cannot directly measure force, even with force sensors.

2. Insufficient electrical experiments in Phyphox. Commonly used sensors for electrical experiments are not easy to implement in Phyphox, such as measuring voltage, resistance, etc.

3. Direct connection of external sensors to Phyphox. There is an urgent need for Phyphox to connect directly to external sensors, and there are roughly three methods:

One is to use an independent Bluetooth module to transfer data; the second is to have Phyphox receive all data, experimental panels, etc., from external sensors; the third is to modify the functions of certain sensors in the phone and connect them directly, such as using the audio jack to input weak currents, modulating sensor data into the current, and using magnetic sensors to receive strong currents, modulating sensor data into strong currents. Clearly, only the second solution is the most direct and convenient, which is to use the Phyphox-BLE extension library.

4. Why ESP32? The bad news is that the Phyphox-BLE library commonly only supports Arduino Nano 33 series development boards. These boards have been released by Arduino in recent years, and there are basically no clones; they are all original imports and are very expensive. The good news is that the Phyphox-BLE documentation actually lists the ESP32 development board. The original ESP32 board is also quite expensive, but there are modified versions, such as the GOOUUUESP32 development board, which is a common ESP32 development board with the ESP-WROOM-32 core board.

3. Arduino IDE Environment for ESP32

In the Arduino IDE preferences, fill in the update address https://dl.espressif.com/dl/package_esp32_index.json, then search for ESP32 in the board manager and install the ESP32 board definitions. This installation has a very large download volume; generally, using a VPN is best, followed by educational networks, while others are not easy to download.

Where are the installed ESP32 libraries located? Many conventional Arduino libraries are installed by default in the libraries directory under the Arduino program directory or in the Arduino directory under the system disk documents. However, the ESP32 libraries installed by the Arduino IDE by default appear in the C:\Users\user\AppData\Local\Arduino15\packages\esp32 directory. The downloaded installation packages appear in the C:\Users\user\AppData\Local\Arduino15\staging\packages directory as a bunch of .zip, .tar.gz, .tar.bz2 compressed files.

Occasionally, it may prompt to install the Python environment. It is not confirmed whether this is absolutely necessary during the actual testing process. I tried installing Python 2.7, Python 2.6, Python 3.0, and went through the process of installing, uninstalling, and reinstalling, but it is unknown who worked or if anything worked at all; in any case, it can be used later.

Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

There is a widely circulated installation method: download all the compressed packages of ESP32 from the official website and unzip them into the hardware directory under espressif’s ESP32 directory. However, this method did not succeed, prompting missing this .h or duplicating that .h.

4. Creating Phyphox Experiments from Examples

Find the Phyphox BLE library in the library manager of the Arduino IDE and install it.

Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

In the Phyphox-BLE library, find CreateExperiment.ino, which is an experiment that generates random numbers. A View containing a Graph is created in Phyphox to plot the random number graph. By starting a Bluetooth device named My Device, the experiment and data are sent to Phyphox.

Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

Test the experiment in Phyphox. Open Phyphox, click the orange button with a “+” in the lower right corner, select “Add Experiment for Bluetooth Device,” find the Bluetooth device, and after some prompts, the Random Number Plotter experiment is added to Phyphox. Open the experiment to draw the random number graph.

Creating and Expanding Our Phyphox Experiments with ESP32 Development Board

At this point, using the ESP32 development board, one can create their own experiments without the Phyphox editor, and a wide variety of sensors can communicate with the ESP32, allowing Phyphox experiments to truly achieve the standard of a mobile sensor laboratory.

– END –

Leave a Comment

×