Pre-release SerialFlow 0.9.0 beta 2 works, but has rough edges. Tell us what you find.

Example · MDX-400 motor-drive bench · Recording

Recording a whole bench run

Press Record. 18 220 samples land in SQLite, CSV and JSON Lines, ready for Python.

  • No firmware change
  • 3 formats from one run
  • 18 220 samples, 0 dropped
  • Python reads it with sqlite3

The MDX-400 is a simulated motor drive. A script printed the serial lines its firmware would send, and SerialFlow read them exactly as if they came from a COM port. Your own board works the same way.

The MDX-400 bench run is 40 minutes of thermal and battery data, then a live tail of speed steps. A graph is not a record: the Speed Control streamer keeps only its newest 800 points. So the Data Collector wrote the whole run to SQLite, CSV and JSON Lines for Python, and the Thermal & Battery graph was saved as a session and compared with a second run.

What we set up

Recording needs no firmware change: the Data Collector stores the graph lines SerialFlow already reads, from every open port. The settings are in Settings → Terminal & Data → Data Collection (or Settings… on the Data Collector panel). This run used all three formats:

SettingThis runDefault
SQLite database, with One database for all runson, onon, on
CSV files (samples.csv + events.csv per run), Delimiteron, Commaoff, Comma
JSON Lines stream (data.ndjson per run)onoff
Include computed (derived) signalsonon
Record events (bookmarks, markers, graph init/clear, port connect/disconnect)onon
Start and stop automatically with the portoffoff
Queue Capacity / Batch Size / Flush Interval65536 / 2048 / 250 msthe same

Leave Output Folder empty to write to Documents\SerialFlow\recordings. Changes apply to the next run.

SerialFlow Settings dialog on the Data Collection page, with SQLite database, CSV files and JSON Lines stream ticked.
Settings → Data Collection: all three storage formats ticked.

Set it up in SerialFlow

Record the run

  1. ☰ → View → Data Collector opens the panel. One panel records every port.
  2. Type a run name: motor-bench-run.
  3. Click ● Record.
  4. Run the bench. Here the 40-minute run arrived first (graphs A to D), then the live tail.
  5. Click ■ Stop. The run appears under Recent runs (this session). Open Folder shows the files.

Save and share a session

A .sfplot session holds one graph view: its data, the firmware’s limit lines, markers and notes, its bookmarks, the Y range, axis label and legend the firmware set, and the view itself (zoom, lanes, styles). motor_bench_run.sfplot is 228 KB.

  1. Click Save Session on the Thermal & Battery toolbar and save it as motor_bench_run.sfplot. The dialog Save plot session starts in Documents\SerialFlow\sessions.
  2. Reopen it: right-click any graph and choose Open Session in New View…, then pick the file. It opens as a view of its own, named after the file.
  3. Send it to a colleague. The data is inside the one file, so they need no port and no recording.

The result

SerialFlow window recording: the run log on the left, the Data Collector panel on the right with 13 688 samples at 104 per second and SQLite, CSV and JSON all OK.
Recording, 1 min 31 s in: 13 688 samples at 104 per second, all three storage rows OK.
Data Collector panel after Stop: 18 220 samples, 10 signals, 17 events, and a recent run motor-bench-run of 2 min 18 s in SQLite, CSV and JSON.
After Stop: 18 220 samples, 10 signals and 17 events, in all three formats.

The run took 2 min 18 s: 18 220 samples from 10 signals on graphs A to D, 17 events, 0 dropped. Each storage row counts 18 237 items, the samples plus the events. With the default output folder, the files land here:

Documents\SerialFlow\recordings\
  serialflow-recordings.sqlite                  every run, one file
  rec-20261114-151103-186-motor-bench-run\
    samples.csv   events.csv   data.ndjson

The recording is in long format, one row per sample. The first rows of samples.csv, and a graph B row:

timestamp_utc,port,graph,signal_id,signal_name,unit,is_computed,x,y
2026-11-05T08:58:26.8368187Z,COM4,A,1,Setpoint,rpm,0,0,0
2026-11-05T08:58:26.8384130Z,COM4,A,2,Speed,rpm,0,0,-3.6
2026-11-05T08:58:26.8394688Z,COM4,A,1,Setpoint,rpm,0,1,0
…
2026-11-05T08:58:26.8628756Z,COM4,B,2,MOSFET,°C,0,20.8667,82.44

For a spreadsheet of one graph, Export… on the graph toolbar writes the wide format, one column per signal. The X column takes the graph’s X label and unit, Time [min] here (a graph without an X label gives plain X). Here is motor_bench_thermal_battery.csv (CSV wide format, 1 201 rows, X in minutes):

Time [min],Motor winding [°C],MOSFET [°C],Pack voltage [V],State of charge [%]
0,23.95,24.12,52.61,98
0.0333,23.92,24.15,52.62,97.99
0.0667,23.93,24.24,52.6,97.99
Standalone graph view motor_bench_run with four signals over 40 minutes, event markers, the MOSFET limit line at 85 °C and a Peak 82.6 °C note.
motor_bench_run.sfplot reopened in a new view: 4 signals, 4 804 points, markers and notes included.

Read the recording in Python

Python’s built-in sqlite3 opens the database: nothing to install. It has five tables (runs, signals, samples, events, meta) and two views that join them:

ViewColumns
v_samplesrun_id, run_name, port, graph_id, signal_id, signal_name, unit, is_computed, t_utc, t_utc_ticks, x, y
v_eventsrun_id, run_name, port, graph_id, kind, label, x, detail, t_utc, t_utc_ticks

This script lists the signals, finds the hottest MOSFET sample and prints the markers on graph B:

import sqlite3

DB = "serialflow-recordings.sqlite"      # in Documents\SerialFlow\recordings
RUN = "motor-bench-run"

db = sqlite3.connect(f"file:{DB}?mode=ro", uri=True)     # open read-only

print(db.execute("SELECT name, sample_count, dropped_count FROM runs WHERE name = ?",
                 (RUN,)).fetchone())

# One row per signal: graph, name, unit, number of samples, min and max
for row in db.execute("""SELECT graph_id, signal_name, unit, COUNT(*), MIN(y), MAX(y)
                         FROM v_samples WHERE run_name = ?
                         GROUP BY graph_id, signal_id""", (RUN,)):
    print("%s  %-16s %-4s %5d  %8.2f  %8.2f" % row)

# The hottest MOSFET sample. x is the firmware's own X value: minutes on graph B
print(db.execute("""SELECT x, y FROM v_samples
                    WHERE run_name = ? AND graph_id = 'B' AND signal_name = 'MOSFET'
                    ORDER BY y DESC LIMIT 1""", (RUN,)).fetchone())

# Event markers and bookmarks that the firmware sent on graph B
for x, kind, label in db.execute("""SELECT x, kind, label FROM v_events
                                    WHERE run_name = ? AND graph_id = 'B'
                                    AND x IS NOT NULL ORDER BY x, kind""", (RUN,)):
    print(f"{x:5.1f} min  {kind:<12} {label}")

The output for this run:

('motor-bench-run', 17794, 0)
A  Setpoint         rpm   6187      0.00   3000.00
A  Speed            rpm   6187     -7.90   3129.70
B  Motor winding    °C    1201     23.85     70.16
B  MOSFET           °C    1201     24.04     82.64
B  Pack voltage     V     1201     44.22     52.68
B  State of charge  %     1201     52.92     98.00
C  Ia               A      145    -18.61     18.57
C  Ib               A      145    -18.56     18.52
C  Ic               A      145    -18.62     18.64
D  Iβ               A      181    -17.63     17.57
(20.9333, 82.64)
  2.0 min  EventMarker  Cruise profile
 15.0 min  EventMarker  Hill climb 150 %
 16.4 min  Bookmark     Overcurrent trip
 21.0 min  Bookmark     Thermal derate
 21.0 min  EventMarker  Thermal derate
 26.0 min  Bookmark     Regen
 26.0 min  EventMarker  Regen
 29.0 min  EventMarker  Cool-down

The streamer showed 800 points of Speed Control; the recording kept all 6 187. Graph D has one signal, Iβ: in an XY frame Iα is the X value. The peak, 82.64 °C at minute 20.93, is the 82.6 °C on the graph.

Compare two runs

Run 2 is the same profile with better MOSFET cooling (heatsink v2), saved as run2_heatsink_v2.sfplot. With run 1 on screen, click Compare… on the Thermal & Battery toolbar and pick the file. Run 2 holds temperatures only, so two traces arrive: Motor winding · v2 and MOSFET · v2. Untick the other signals in the Signals sidebar: the MOSFET peaked at 68.1 °C instead of 82.6 °C.

Each layer gets sidebar rows with X-Offs (shift along X), Opacity (0.1 to 1.0) and Remove Layer. Compare… also takes recorder .sqlite files (pick the run from a list), CSV, TSV, JSON Lines and JSON.

In your own firmware

Nothing extra to send: the lines that draw the graph are the lines that get recorded. From the MDX-400 feed:

LineRecorded as
~{B:0:20.9667:70.07:82.55:44.22:62.40}4 rows in samples, all with x = 20.9667
~{B:E:3:21:Thermal derate:FF5252:D}1 row in events, kind EventMarker
~{B:B:21:Thermal derate:MOSFET 82 °C - torque limited to 70 %:FFAB40}1 row in events, kind Bookmark

The same lines from your own firmware, in plain C:

#include <stdio.h>

void thermal_graph_init(void)                       /* once, at boot */
{
    printf("~{B:I:Thermal & Battery:100000:L:T:R:Time:min:0}\n");
    printf("~{B:S:1:F32:R:Motor winding:°C:0:FF8A65}\n");
    printf("~{B:S:2:F32:R:MOSFET:°C:0:F06292}\n");
    printf("~{B:S:3:F32:R:Pack voltage:V:0:81C784}\n");
    printf("~{B:S:4:F32:R:State of charge:%%:0:64B5F6}\n");
}

/* Every 2 s: 4 rows in the recording's samples table */
void thermal_sample(float t_min, float wind, float mos, float pack_v, float soc)
{
    printf("~{B:0:%.4f:%.2f:%.2f:%.2f:%.2f}\n", t_min, wind, mos, pack_v, soc);
}

/* On derate: 2 rows in the events table, an event marker and a bookmark */
void thermal_derate(float t_min, float mos)
{
    printf("~{B:E:3:%g:Thermal derate:FF5252:D}\n", t_min);
    printf("~{B:B:%g:Thermal derate:MOSFET %.0f °C - torque limited to 70 %%:FFAB40}\n",
           t_min, mos);
}

B:I makes graph B a logger (L) with time in minutes, and the B:S lines set each signal’s name, unit and colour. B:0 sends a sample with its own X, B:E draws event marker 3 as a dashed line (D), and B:B adds a bookmark with a comment.

Good to know

  • The serial port never waits for the disk. Samples go through a queue. If the disk cannot keep up, new samples are dropped and counted: a red Dropped counter in the panel and dropped_count in runs. This run: 0.
  • Timestamps are arrival times, from a run clock that never jumps; x keeps the firmware’s own axis. Fed from a file, as here, all 40 minutes of graph B arrive within a second, so use x.
  • SQLite survives a crash or a power cut. CSV and JSON Lines can lose the last flush interval (250 ms by default) if the app crashes.
  • One database for all runs puts every run in one file: filter on run_name. Off, each run gets a data.sqlite.
  • Raw terminal text is not recorded. That is the job of the log file and auto-log.
  • The firmware can press Record. With Settings → Terminal & Data → Device Captures ticked (it is off at first), a line ~RecOn:motor-bench-run starts a run with that name and ~RecOff stops it. See Device commands in the manual.
  • Excel with a decimal comma: set the CSV Delimiter to Semicolon.

Try it yourself

  1. ☰ → View → Data Collector. Type motor-bench-run as the run name and click ● Record.
  2. ☰ → Test → Load Test File → Demo → showcase_preload.txt. The 40-minute run fills graphs A to D.
  3. ☰ → Test → Delayed Playback → Demo → showcase_live.txt. When it ends, after about 1 min 50 s, click ■ Stop.
  4. Click Open Folder and run the Python script there.
  5. Right-click any graph → Open Session in New View… and pick Documents\SerialFlow\Demo\motor_bench_run.sfplot.
  6. Click Compare… on the Thermal & Battery toolbar and pick Documents\SerialFlow\Demo\run2_heatsink_v2.sfplot. In Signals, untick everything except MOSFET and MOSFET · v2.