Analysis

Real-time plot

Watch the trend, the overshoot and the spike instead of reading them off scrolling text.

On this page

Real-time plot

The real-time plot draws the numbers a device prints as live curves. Tuning a motor's PID loop, calibrating a sensor or checking an ADC for noise, you see the trend, the overshoot and the spike at a glance, instead of reading them off scrolling text. Firmware that already talks to VOFA+ or the Arduino Serial Plotter needs no change.

Every connection has its own plot, above its receive view, so the text under the curves is still there to explain a glitch in them. To open it:

  • Tools → Plot switches the plot of the focused connection on or off;
  • Plot in the receive view's right-click menu does the same for that connection;
  • ✕ at the right end of the plot's toolbar closes it.

The plot reads the bytes as they arrive, whether the receive view shows text or hex and even while it is paused. It only works while it is open: numbers that arrived before you opened it are not drawn, and a closed plot costs nothing. The two exceptions are a field you monitor from the protocol decode view, which keeps being recorded while the plot is closed (see Monitoring decoded fields), and a plot that is recording to CSV, which keeps parsing and writing until you stop it.

The main window with a TCP connection receiving lines such as speed:1427.5,target:1370.2; above the receive view the plot draws the speed and target channels as a blue and a red curve over the last 600 samples, the statistics table on its right lists each channel's last value, mean, min, max, peak-to-peak and standard deviation, and the status line under it reads 2 channel(s), 49 samples/s and the SPU Free plotting time left
The plot sits above the receive view. Channel names come from the labels in each line, and the table on the right doubles as the legend.

Sending numbers from the device

Choose how the device sends its numbers in the first box of the plot's toolbar.

Text (CSV, FireWater, Arduino) is the default and fits almost any firmware that can printf. Print one line per sample, the numbers separated by commas, spaces, tabs or semicolons, ending in \n, \r or \r\n:

The device prints What the plot does
1.5,-0.2,3 or 1.5 -0.2 3 Three channels, named CH1, CH2 and CH3
temp:23.5,hum:45.2,pres:1013.2 Three channels named temp, hum and pres (the Arduino Serial Plotter style; spaces around the colon are fine)
pid:100.0,98.6,2.1 VOFA+ FireWater: the single label in front names the line, not a channel, so this is three channels CH1 to CH3
ADC=0x3FF temp = 21.5 Two channels, ADC (1023) and temp: a label may also end in =, and integers may be written in hex (0x3FF, -0x10) or binary (0b101)
Motor started or 12:30:45 boot ok Not a sample: skipped as ordinary log text

So an STM32 speed loop can print printf("%.2f,%.2f,%.2f\r\n", target, speed, pwm); and an Arduino sketch Serial.print("temp:"); Serial.print(t); Serial.print(",hum:"); Serial.println(h);. Log messages can go to the same port: any line with something that is not a number in it is left out of the plot. With labels, each label becomes a channel the first time it appears, a line may leave some out (the curve has a gap there), and a line that mixes labelled and bare numbers, such as a:1,2,b:3, is skipped rather than guessed at. A clock such as 12:30 is not taken for a label, nor a comparison such as x==5. Because = ends a label, a boot line such as baud=115200 becomes a channel too; print it with a space or a colon after the number's name if that is in the way (baud 115200 is skipped).

JustFloat (VOFA+) is for firmware that sends raw binary: one little-endian 32-bit float per channel, and each frame closed by the four bytes 00 00 80 7F. It costs the MCU no formatting time, which matters at a few kHz:

float frame[3] = {angle, speed, current};
static const uint8_t tail[4] = {0x00, 0x00, 0x80, 0x7F};
HAL_UART_Transmit(&huart1, (uint8_t *)frame, sizeof frame, 10);
HAL_UART_Transmit(&huart1, tail, sizeof tail, 10);

The plot finds the frame boundary by itself when it joins a stream midway or after lost bytes; the first frame after a connection opens is used for that and not drawn.

Binary (raw integers) is for firmware that sends a fixed-size struct of raw integers, such as ADC counts, without converting them to float. Describe one record in the box that appears next to the format, the way Python's struct module does, and, if the record starts with sync bytes, type them in hex in the box after it:

Character Meaning
< / > Little endian (the default) / big endian from here on; ! is big endian too
b B int8 / uint8
h H int16 / uint16
i I (or l L) int32 / uint32
q Q int64 / uint64
f d 32-bit float / 64-bit double
x A pad byte, not a channel
a number in front Repeats the type, as in 4h

For example <hhHf with sync bytes AA 55 reads frames such as AA 55 + two int16, a uint16 and a float, little endian: four channels. Without sync bytes the records must follow each other with nothing in between. With them, a record that is not where the next one should start is skipped and the plot looks for the sync bytes again; the skips are counted as bad frames under the plot. A record is up to 256 bytes and the sync bytes up to 16. While the layout does not parse, it turns red and its tool tip says why.

#pragma pack(push, 1)
struct { uint8_t sync[2]; int16_t ia, ib; uint16_t vbus; float temp; } r = {{0xAA, 0x55}};
#pragma pack(pop)
r.ia = adc[0]; r.ib = adc[1]; r.vbus = adc[2]; r.temp = t;
HAL_UART_Transmit(&huart1, (uint8_t *)&r, sizeof r, 10);   // layout <hhHf, sync AA 55

Regex is for output you cannot change, such as T=23.5C H=45%. Type a regular expression in the box that appears next to the format:

  • each capture group is a channel, and a named group names it: T=(?<T>[-\d.]+).*H=(?<H>[-\d.]+) gives channels T and H;
  • without groups, every match in the line is a channel: -?\d+\.?\d* plots every number on the line.

A captured 0x3FF or 0b101 is read as the integer it is.

An invalid expression turns red, and its tool tip says what is wrong.

Protocol Fields plots values that the protocol decode view has already taken out of the frames, such as Modbus registers or the fields of a frame template, so the device needs no extra output at all. You do not pick it here: it is what the plot switches to when you add a decoded field to it, as the next section explains.

Changing the format clears the plot, since the old samples say nothing about the new stream. A plot takes up to 32 channels.

Several devices on one connection

On a TCP Server with several clients, or a UDP connection that hears from several senders, the plot's toolbar shows a peer box once data has arrived from a named peer:

  • All Peers, the default, puts every peer's numbers on the same channels. Right for one device; with two that each print 1.0,2.0, their samples interleave on CH1 and CH2.
  • Each Peer Separately gives every peer channels of its own, named with its address, such as CH1 · 192.168.1.20. A device that reconnects from a new port comes back to its own curves.
  • Only 192.168.1.20 plots that device and ignores the rest.

Peers are told apart by their address, so two clients running on one computer count as one. Changing the choice clears the plot. Fields monitored from the protocol decode view are always bound to their own client, so the box does not appear in the Protocol Fields format.

Monitoring decoded fields

When the protocol decode view already shows a temperature, a voltage or a status register, you can watch it as a curve without changing the firmware or writing an expression:

  1. In the protocol decode panel, select a frame, then select a numeric field in the field tree on the right.
  2. Click Add to Monitor above the tree, or right-click the field and choose Add to Monitor.

The plot opens in the Protocol Fields format with the Time axis, and the frame you picked gives the first point. Add more fields the same way; a connection monitors up to 16. If the plot was showing samples of another format, SPU asks first, because switching clears them.

A monitored field is tied to exactly one stream: the decoder (and template), the field, the direction (TX or RX) and, on a TCP server or UDP connection, the client. The same register from another client, the other direction or another slave is a different field, so two sources never overwrite or splice into each other. A Modbus register can be monitored only when its response is paired with the request, because only then is its address known; a register shown as [0], [1]… in an unpaired response says so in its tool tip and cannot be added.

Monitoring keeps going with the protocol decode panel hidden and with the plot closed, as long as the connection's decoder can feed at least one monitored field; the values and curves are there when you open the plot again. With nothing left to feed, a hidden panel stops decoding as before.

In this format the statistics table gains three columns, and Last shows the field's current value:

Column Shows
Last The latest valid value, as an exact number; greyed when it is no longer current. Its tool tip shows the decoder's own text and the raw value
State See below
Updated When the frame of the latest sample arrived
Unit The unit from the template
State Meaning
No data Nothing received for this field yet
Valid The latest sample is good
Invalid The latest frame for this field was bad: a checksum error, a Modbus exception, a reply that left the register out, a value out of range or not a number
Stale No update for longer than the field's stale time (3 seconds unless you change it)
Disconnected The port closed or the device was lost; on a TCP server, that client left
Decoding paused A file transfer has the port, decoding is on hold, or SPU Free's plotting time is used up
Not decoded The connection cannot sample this field now: another decoder is chosen, its template is not in the library, or the template's field has changed. The tool tip says which

Invalid, stale and disconnected samples break the curve; they are never drawn as zero. For Modbus, a damaged or exception reply only counts against the registers of the range it answered: a failed read of 40011 says nothing about 40001. When the cause is over (the port reopens, the client reconnects, the transfer ends), the field waits for data again.

Fields... on the toolbar lists the monitored fields. For each one you can set its Stale timeout..., Remove it (the other fields keep their curves) or, when it applies, re-bind it:

  • Re-bind to the Current Field, after the template's field was edited and a field of the same name is still there. Renaming a field or adding fields above it keeps the binding; changing what it reads (its offset, type, byte order, scale, offset value or unit) does not, so the curve never carries on with different numbers without you saying so;
  • Re-bind to a client's address, when the same field now comes from another client, such as a device that reconnected to the TCP server from a new port.

To find out where a point came from, hold Ctrl (⌘ on macOS) and click it: the protocol decode panel opens with that frame selected and the field highlighted. If the frame has left the table, or the table was cleared, a window shows the frame that was kept with the sample; the most recent 1,024 samples keep their frames.

The time of each point is when its frame arrived at this computer, not when the device measured it. The number in the table, on the curve and in the CSV is the same number: a 32-bit float is kept to the 7 significant digits it is shown with, and a field with value labels plots its raw code.

Reading the curves

  • Horizontal axis: Samples counts samples, which is exact for firmware that prints at a fixed rate whatever the cable does to timing, and matches VOFA+ and the Arduino plotter. Time shows seconds since the plot started, from when the data arrived; since a serial port delivers data in batches, samples that arrive together are spread evenly over the interval.
  • How much is in view: the next box offers 100 to 50,000 samples, or 1 to 300 seconds on the time axis, and All. The mouse wheel over the plot zooms the same span in and out.
  • Vertical axis: with Auto Y on, the range follows what is in view. Ctrl + wheel sets a fixed range around the pointer, and switching Auto Y off keeps the range on screen.
  • Lanes gives every visible channel a band of its own, stacked one above the other, each with its own vertical axis and its name in the corner. Use it when the channels have different scales: next to 101325 Pa, a 3.3 V rail on a shared axis is a flat line, in its own lane its ripple is plain. Under Auto Y each lane fits its own data; Ctrl + wheel over a lane fixes that lane's range only, and a double click goes back to auto. When the plot is too short for all the lanes (about 24 pixels each), the curves share one axis until you make it taller. Switching Lanes on or off goes back to Auto Y.
  • Pause freezes the view while samples keep being recorded. Dragging the plot pans back through the history and pauses too. A double click goes back to live with Auto Y.
  • Hovering over the plot shows every channel's value at that sample or time.
  • Clear forgets every sample. A new connection keeps them, so a device that resets and reconnects continues the same curves.
  • Pop Out moves the plot into a window of its own, titled with the connection's name, to put on a second screen; closing that window puts the plot back above the receive view.

The line under the plot counts channels, samples per second and samples held, and "N other lines skipped" (or "bad frames skipped" for JustFloat). The plot keeps the most recent 100,000 samples of each connection in memory; older ones drop off the front. Export → History in Memory raises that to 1,000,000 or 5,000,000 samples (about 8 MB or 40 MB per channel, used only as it fills). To keep a run longer than that, record it to CSV. Even with tens of thousands of samples in view the drawing stays smooth, and a one-sample spike is never thinned away.

Channels and statistics

The table to the right of the plot is its legend and a statistics table at the same time. For each channel it shows Last, Mean, Min, Max, P-P (peak to peak) and Std Dev, calculated over the samples in view. Zoom or pause on a stretch of the curve and the numbers describe just that stretch: the mean of a sensor held at a reference point, the noise of an idle ADC channel as its standard deviation, the ripple of a supply as its peak-to-peak.

  • Untick a channel to hide its curve; tick it to bring it back.
  • Double-click a name to rename it, for example CH2 to speed_rpm. Clearing the name brings back the one from the stream.
  • Right-click a channel and choose Scale and Offset... to show it as sample × gain + offset: ADC counts as volts with a gain of 3.3/4095 (a fraction is fine), a raw pressure in kPa with a gain of 0.001. The curve, the statistics, the hover readout, the cursors and the exports all use the scaled value; the name's tool tip and the CSV column say how the channel is scaled. Remove Scale in the same menu shows the samples as they arrived.

Measuring with cursors

Turn on Measure and click the plot to place cursor A, then cursor B; later clicks move the nearer cursor, and a right-click clears both. A readout shows the position of each cursor and, for every visible channel, its value at A and B and the difference. On the Time axis it also shows the time between them and 1/Δt in Hz, which reads the period and frequency of an oscillation or a step response's rise time straight off the curve.

Saving and sharing

  • Export → Export CSV... saves every sample the plot holds, with a sample number, the arrival time in seconds (time_s), the wall-clock time (wall_time, local time to the millisecond) and one column per channel under its name. wall_time comes from the same clock that stamps a session recording, so a plot export and a .spulog line up; a plot drawn in a replay window gets the recording's own times. Numbers are written with the digits they need and no rounding noise, so 0.1 stays 0.1. In the Protocol Fields format each field has a second column, <name> state, that says why a value is missing: INVALID, STALE, DISCONNECTED, PAUSED or NO_DATA, or empty when that row is simply a sample of another field. The file is UTF-8 with a byte-order mark, so Excel shows channel names in any language correctly.
  • Export → Save Image... saves the plot as a PNG with a title (the connection's name), the time span in view, any gains, and a legend of the visible channels above the curves; the pointer's readout is left out. Export → Copy Image puts the same picture on the clipboard, ready to paste into a chat or a report.
  • The plot's settings are saved per connection with the .spu project: whether it is open, the format and expression, the monitored fields, the axis, the span, the vertical range, channel names and hidden channels. With no project open, the first connection's plot settings are kept on this computer. The samples themselves are not saved in the project; export a CSV, or record one, to keep a run.

Recording long runs

Export → Record to CSV... asks for a folder and from then on writes every sample into it as it arrives, however small the history in memory: an overnight soak test or a weekend on the climate chamber keeps every point. Recording goes on while the plot is closed and while the view is paused; ● REC in the toolbar, or Export → Stop Recording, ends it, and the line under the plot shows how many samples have been written and to which file.

The files are named after the connection and the time recording started, such as plot-COM3-20261117-221503.csv. A new file, …-002.csv and so on, starts every 1,000,000 rows (what a spreadsheet opens), and whenever the columns change: a new channel appears, a channel is renamed or rescaled, or the plot is cleared. Every file is therefore a plain CSV with one header that names all its columns. The columns are those of Export CSV. If the disk fills or the folder goes away, recording stops and the line under the plot says why; what was written stays.

The folder is asked for every time and never remembered: the Mac App Store version may only write where you have just pointed it, and a remembered folder would fail after a restart.

A replay window can plot a recording too: Plot is in each port's View menu and its right-click menu there, and the curves follow the recording's own timing at any replay speed. Decoded fields can be monitored in a replay the same way, from its protocol decode panel.

Free and SPU Pro

In Free, the plot is there to show that it works with your device:

  • the first 2 channels are drawn; the others are parsed and listed in the table, marked Pro;
  • 120 seconds of plotting per session, shared by every connection and counted again after SPU restarts; plotting in a replay window is not counted. Only seconds in which new samples arrive count, so a plot left open on an idle port uses nothing, and monitored fields recorded while the plot is closed use nothing either. The line under the plot shows the seconds left; when they run out, the plots stop on their last frame and stay readable until SPU restarts;
  • Save Image, Copy Image, Lanes and Scale and Offset are free; Export CSV, Record to CSV and Measure need SPU Pro.

SPU Pro has none of these limits, and activating it lifts them at once, without a restart.

Was this document helpful?