SerialUI provides a graphical interface to send and receive text and data from the serial port or BLE connection (Nordic UART Service).
It includes a serial plotter for displaying numerical data.
It offers features beyond other serial terminals. For example, in addition to features found on Arduino IDE it offers:
- Serial over BLE
- Recording of received data
- Extended charting of the data
Throughput is similar to other serial terminal programs. Data is transmitted using N
This program is written in python using PyQt
and Bleak
as well as PyQtGraph
or fastplotlib
.
Under development are binary data transmission and indicating data with display elements other than a chart.
The main program is SerialUI.py. It uses files in the assets, docs and helper folders.
Video using ESP32 with testBLESerial program. Data is transmitted using BLE Serial and maximum transfer test shows > 100 kByte/s. Device is connected to application with both serial USB and serial BLE.
The serial monitor interface
The serial charting interface
Serial BLE extension
One liner Windows:
- pip3 install pyqt6 pyqtgraph markdown wmi bleak
One liner Linux:
- pip3 install pyqt6 pyqtgraph markdown pyudev bleak
The following python modules are needed:
pyqt5orpyqt6user interfacepyqtgraphplottingfastplotlibfor high throughput plottingnumpydata gathering and manipulationmarkdownhelp filewmion Windows for USB device notificationspyudevon Linux for USB device notificationsbleakfor bluetooth communicationnumbaacceleration of numpy code
To install the optional accelerated text parser you need to navigate in your shell to the helper folder and then execute:
python3 setup.py build_ext --inplace -vpip install -e .If you are using virtual env for python don't forget to activate it.
If you rebuild, clean the previous build with:
python3 setup.py clean --all || truerm -rf build *.egg-info .eggs
This requires a c11 compiler and the python packages pybind11 and setuptools to be available.
A future version will also need:
scipyimage decompression (FFT)cobsserial data encoding (byte stuffing)tampfor compression (lightweight for microcontrollers)
The programs configuration is stored in config.py (main folder). Here you can enable/disable features such as:
- USE_FASTPLOTLIB: Plotting with fastplotlib instead of pyqtgraph
- USE_BLE: enable serial communication over BLE
- USE_BLUETOOTHCTL: enable pairing and trusting of BLE devices (available on Unix like systems)
The program is organized into these modules.
The NUS provides a serial interface similar to regular USB interface for microcontrollers.
The implementation on a microcontroller requires more programming effort than a simple Serial.print especially if secure connections and automatic reconnection is considered. BLE connections can be optimized for low power, extended distance or high throughput.
A detailed example is the BLE test program which was used to test SerialUI.
With ESP32-S3 a transfer rate of more than 100kByte/s can be expected when BLE connection is optimized for high throughput.
The data parser extract values and variable names from lines of text. Besides a python version, there is a C accelerated version available. For supported data formats see: Data Parsing Approach
Indicating data is not implemented yet: Feature not implemented yet.
Fastplotlib itself is under development. There is a cusom legend.py in python libraries folder that is needed when you enable fastplotlib in the config file. The file replaces the legends.py of the creators. It needs more work.
During program startup the library and the chart widget are initialized. This requires building the pipeline for the GPU which takes 5-10 seconds. During that time the program might be sluggish.
In the Arduino_programs folder are example programs that simulate data for serial UART and BLE connection.
A detailed comparison of SerialUI with other serial IO programs was conducted.
The SerialUI is as performant as other good terminal programs. The maximum text transfer of an ESP32-S3 over USB is about 800k bytes/s and 100k bytes/s over BLE. With a Cortex-M7 (Teensy) we reached about 7M bytes/s over USB.
With both fastplotlib and pyqtgraph we can plot two channels with at least 200k samples per second at 10Hz plotting refresh rate. When large display history is needed fastplotlib with a dedicated GPU is better suited as plotting engine.
The following libraries are used:
- asyncio for bleak
** - bleak - BLE
** - cobs - serial binary
**** - fastplotlib - GPU based charting
***beta - datetime
- difflib - device ID comparison
- html - html display
- logging
- markdown - markdown display
- math
- numpy - data buffer and display
- numba - accelerator
* - os
- pathlib
- platform
- pybind11 - text parsing acceleration
* - PyQt5 or 6 - UI
- pyqtgraph - charting
- re - regular expression filter
- scipy - fft
*** - setuptools
* - tamp - compressor
*** - textwrap - logging
- time
- typing
- wmi - USB events or pyudev - USB events
- zlib - compressor
***
[*] not required but will accelerate the program,
[**] needed if BLE is enabled,
[***] needed if fastplotlib is enabled
[***] future version
Urs Utzinger, 2022-2025 (University of Arizona), Cameron K Brooks, 2024 (Western University), ChatGPT (OpenAI)


