BLE & Serial Python Terminal with Real Time Plotting (for your tests?)

Hi,

I developed a simple terminal UI in Python, with graphical plotting/scope capability. In fact, I needed an equivalent of the Arduino IDE Serial Terminal & plotter, to draw real time curves with data sent by boards, but, over BLE. This tool supports Serial/USB and BLE protocols. You can store the terminal data on file, screenshot plot graphics and generate a .jpg.
You can also display your favorites key:values data in the right panel of the app. It adds dynamically the fields into a specific window. Quite usefull (for me) to always get an eye on my board apps key parameters, not lost inside the terminal window.
The plotting window is similar to the Arduino one, and the library used allows also supports computation over the data : right-clicking in the PyQtGraph plot provides view controls such as auto-range, averages, axis scaling (linear/log), pan/zoom mode selection, and export options for saving the plot. Quite cool.

If you have similar needs, you can use / test this tool ; it’s on Gitub here.
It don’t promess all is debugged, in particular on BLE, as the opening of session can be quite tricky and capricious with the BLE advertising, depending on the boards. It works for me with the Seeed nRf52840 (sense). No promess it works with others, and it also depends on your BLE code on the board ( I put the BLE code I used on my board in the Github files also).

Enjoy :slight_smile:

1 Like

Hi @troubadour06 ,

that is really interesting and could save time for me with a similar project I am working on. I have a question about the real-time conditions:

I developed a BLE-network (Master/Slave) for measurement and control based on simple Advertize-PDUs. The scanning time is less than 1 ms (request and response with 31 bytes payload).

Could your tool follow that speed?

I do not expect that for your BLE path, because my BLE master is connected via serial to the PC. (I use Seeed nRF52840 and Arduino Nano BLE 33 with their USB-interfaces.)

Hi, I dont know the settings you have, but with my latest BLE connexion function (posted in Github as ‘libBLE.h’), I can reach close to 30 K Bytes per second transmitted from the board to the Python app on a PC. Beyond, I dont know if it’s BLE or the python program limitation but it starts buffering a lot.
From time to time the bluefruit function bleuart.write takes more than 15 ms…

Thank you very much for your answer. The hint to the buffering was important for me.
My goal is the low latency, not the transmission speed, which is 1 Mbit/s. With respect to the protocol overhead (which is a lot because of short payload and request/response action) I could als reach the 30 kBytes/s, but only with one slave. Typical I have 10 slaves and one master, theoretical I could use a lot of slaves. It is just a very simple master/slave structure (polling).
I do not use known BLE libraries.
Reaction time (latency) in the graphical environment of the PC matters for me.
But recognition for your software!