Back to Serial Studio

Operation Modes

doc/help/Operation-Modes.md

3.2.717.3 KB
Original Source

Operation Modes

Overview

Serial Studio supports three parsing modes that determine how incoming data is interpreted and displayed. The mode is selected in the Setup Panel on the right side of the main window. Each mode works with any data source — Serial (UART), Bluetooth LE, Network (TCP/UDP), and all Pro sources (Audio, Modbus, CAN Bus, USB, HID, Process).

The three modes, in order of increasing complexity, are:

  1. Quick Plot — automatic CSV plotting with zero configuration.
  2. Project File — a JSON project file on the host defines the dashboard, while the device sends only raw values.
  3. Device Sends JSON — the device transmits a self-describing JSON frame that defines both data and dashboard layout.

The following diagram compares the data flow through each operation mode side by side.

mermaid
flowchart LR
    subgraph QP["Quick Plot"]
        Q1["CSV"] --> Q2["Auto Dashboard"]
    end
    subgraph PF["Project File"]
        P1["Any Format"] --> P2["Custom Dashboard"]
    end
    subgraph JSON["JSON Mode"]
        J1["JSON Frame"] --> J2["Device Layout"]
    end
FeatureQuick PlotProject FileDevice Sends JSON
JS Parser--Yes--
Custom Widgets--YesYes
Multi-Source--Yes (Pro)--
Setup EffortNoneEditorFirmware

Note: All modes work with any data source: Serial, TCP/UDP, BLE, and all Pro drivers.

Frame Detection options (Project File mode only): End Only | Start+End | Start Only | No Delimiters.


Quick Plot Mode

Selection

Choose the "Quick Plot (Comma Separated Values)" radio button in the Setup Panel.

How It Works

  • Frame detection: line-based. Each line of text terminated by CR, LF, or CRLF is treated as one frame.
  • Data format: comma-separated numeric values. Each value maps to one channel.
  • CSV delimiter: comma only. Other delimiters are not supported in this mode.
  • Header detection: if the first received row contains only non-numeric strings, those strings become channel labels for the dashboard.

When a connection is established, Serial Studio reads each line, splits it on commas, and creates a dashboard with:

  • A Data Grid widget showing all current values.
  • A MultiPlot widget overlaying all channels on a single time-series chart.
  • Individual per-channel plots.

No project file is required. No JavaScript parsing is involved.

Example Input

Temperature,Pressure,Humidity
23.5,1013.2,45.0
23.6,1013.1,45.1
23.7,1013.0,45.3

The first line sets channel labels. Subsequent lines are plotted in real time.

Limitations

  • Comma is the only supported delimiter.
  • No custom widgets (gauges, bars, compass, GPS map, FFT, etc.).
  • No alarm thresholds.
  • No per-channel configuration (units, ranges, scaling).
  • No JavaScript frame parsing.
  • No multi-source support.

When to Use

Quick Plot is the fastest way to visualize data. Use it when you want to verify that a device is transmitting correctly, prototype a new sensor, or demonstrate real-time plotting in an educational setting.


Project File Mode

Selection

Choose the "Parse via JSON Project File" radio button in the Setup Panel. Then load or create a project file using the Project Editor (wrench icon in the toolbar).

How It Works

  • Frame detection: configurable per source. Four detection methods are available.
  • Data format: configurable. Incoming bytes can be decoded as plain text (UTF-8), hexadecimal, Base64, or raw binary.
  • Dashboard definition: a .ssproj JSON file on the host defines all groups, datasets, widgets, alarms, FFT settings, and actions.
  • Device data: the device sends only raw values (CSV text, binary packets, etc.). Serial Studio maps each value to the corresponding dataset by index.
  • JavaScript parser: an optional parse(frame) function can transform arbitrary protocols into the array of values that Serial Studio expects.
  • Multi-source: a single project file can define multiple data sources, each with its own connection, frame detection, and decoder settings.

This mode provides full access to every widget type and configuration option in Serial Studio. It is the most commonly used mode for real-world projects.

Frame Detection Methods

Frame detection determines how Serial Studio identifies the boundaries of each data frame within a continuous byte stream. The method is configured per source in the Project Editor.

MethodEnum ValueBehavior
End Delimiter Only0A frame ends when the end delimiter is encountered. The most common choice for line-terminated CSV data (e.g., delimiter = \n).
Start and End Delimiter1A frame begins at the start delimiter and ends at the end delimiter. Use this for protocols that wrap data in markers (e.g., $DATA...;\n).
No Delimiters2All incoming data is passed directly to the JavaScript parser without any delimiter-based splitting. Use this for length-prefixed or fixed-size binary protocols where the parser itself determines frame boundaries.
Start Delimiter Only3A frame begins at one occurrence of the start delimiter and ends when the next occurrence is found. The second occurrence becomes the start of the next frame.

Delimiters can be specified as plain text or as hexadecimal byte sequences (toggle the "Hexadecimal Delimiters" option in the Project Editor).

Decoder Methods

The decoder determines how raw bytes are converted into a string before being passed to the JavaScript parser (or split as CSV).

DecoderEnum ValueDescription
Plain Text (UTF-8)0Bytes are decoded as UTF-8 text. The most common choice for ASCII/CSV protocols.
Hexadecimal1Each byte is converted to a two-character hex string. For example, bytes 0x03 0xFF 0x02 become "03FF02".
Base642Bytes are encoded as a Base64 string.
Binary (Direct)3Raw bytes are passed to the JavaScript parser as an array of integers (0--255). This is a Pro feature.

JavaScript Frame Parser

When the incoming data is not simple comma-separated text, you can write a JavaScript function to transform each frame into the array of values that Serial Studio expects.

The function signature is:

javascript
function parse(frame) {
    // 'frame' is a string (for PlainText/Hex/Base64 decoders)
    // or an array of integers (for the Binary decoder).
    //
    // Return a flat array of values:
    return [value1, value2, value3];
}

Key behaviors:

  • The returned array is mapped to datasets by index: element 0 goes to dataset index 1, element 1 goes to dataset index 2, and so on.
  • Multi-frame return: return an array of arrays to emit multiple frames from a single parse call: [[row1_val1, row1_val2], [row2_val1, row2_val2]].
  • Mixed scalar/vector: returning [scalar, [vec1, vec2, vec3]] auto-expands the inner array into separate dataset values.

Example — parsing a semicolon-delimited protocol:

javascript
function parse(frame) {
    return frame.split(";");
}

Example — parsing a fixed-size binary packet:

javascript
function parse(frame) {
    // frame is an array of bytes (Binary decoder)
    // Bytes 0-1: uint16 temperature (big-endian, x0.1)
    // Bytes 2-3: uint16 pressure (big-endian)
    var temp = ((frame[0] << 8) | frame[1]) * 0.1;
    var pres = (frame[2] << 8) | frame[3];
    return [temp, pres];
}

Multi-Source Support

Project File mode supports multiple data sources within a single project. Each source is an independent entry with its own:

  • Source ID and title
  • Bus type (UART, Network, BLE, etc.)
  • Frame detection method and delimiters
  • Decoder method
  • JavaScript parser code
  • Connection settings

This enables monitoring multiple devices simultaneously on a single dashboard. For example, a weather station project might define one UART source for a ground sensor array and one TCP source for a remote wind station, with both feeding into the same dashboard.

Multi-source is a Pro feature. The free (GPL) edition is limited to a single source per project.

When to Use

Project File mode is the right choice for any application that needs custom widgets, alarm thresholds, FFT analysis, per-channel configuration, multi-device monitoring, or a carefully designed dashboard layout. It is the most common mode for production telemetry systems, competition dashboards (CanSat, rocketry), and industrial monitoring.


Device Sends JSON Mode

Note: This mode is provided for specific use cases where the device must control its own dashboard layout at runtime. For most projects, Project File mode is the recommended approach — it is more flexible, does not require firmware changes, and is not affected by protocol changes between Serial Studio versions. The JSON frame structure used by this mode may change across versions, which can break firmware that was written for an older format.

Selection

Choose the "No Parsing (Device Sends JSON Data)" radio button in the Setup Panel.

How It Works

  • Frame detection: fixed delimiters. Every frame must begin with /* and end with */. These delimiters are hardcoded and cannot be changed.
  • Data format: a complete JSON object enclosed between the delimiters. The JSON defines both the dashboard layout and the current data values.
  • Dashboard behavior: Serial Studio rebuilds the dashboard dynamically whenever the JSON structure changes (new groups, different widgets, etc.). If only values change, the existing dashboard updates in place.

No project file is required. No JavaScript parsing is involved. The device firmware is entirely responsible for generating valid JSON.

Transmission Format

/*{ ... JSON payload ... }*/

The device sends the opening /*, followed by a JSON object, followed by */. Whitespace inside the delimiters is allowed.

JSON Frame Structure

A complete frame contains a root object with three optional top-level keys:

KeyTypeRequiredDescription
titlestringYesDashboard title displayed at the top of the window.
groupsarrayYesArray of group objects. Each group becomes a widget panel.
actionsarrayNoArray of action objects. Each action becomes a button that transmits data back to the device.

Group Object

Each group represents a panel on the dashboard containing one or more datasets.

KeyTypeDefaultDescription
titlestringDisplay name of the group.
widgetstring""Group widget type. See table below.
datasetsarrayArray of dataset objects belonging to this group.

Group widget values:

ValueDashboard WidgetRequired Datasets
"datagrid"Data GridAny number of datasets.
"multiplot"MultiPlot (overlaid time-series)Two or more datasets with graph: true.
"accelerometer"Accelerometer visualizationThree datasets (X, Y, Z).
"gyro"Gyroscope visualizationThree datasets (X, Y, Z).
"map"GPS MapTwo or three datasets (latitude, longitude, optional altitude). Uses widget values "lat", "lon", "alt" on datasets.
"plot3d"3D scatter/line plotThree datasets (X, Y, Z).
"image"Image viewer (Pro)Image data embedded in the stream.
"" (empty)No group-level widgetDatasets rendered individually based on their own widget values.

Dataset Object

Each dataset represents a single data channel within a group.

KeyTypeDefaultDescription
titlestringHuman-readable channel name.
valuestringCurrent value as a string (even for numbers).
unitsstring""Unit label (e.g., "degC", "%", "hPa").
indexint0Position index within the frame (used for mapping).
widgetstring""Dataset-level widget: "bar", "gauge", "compass", or "" for none. For special groups, use "x", "y", "z", "lat", "lon", "alt".
graphboolfalseIf true, this dataset is plotted as a time-series line.
fftboolfalseEnable FFT analysis for this channel.
fftSamplesint256Number of samples per FFT window.
fftSamplingRateint100Sampling rate in Hz for FFT frequency axis.
fftMindouble0Minimum display value for FFT plot.
fftMaxdouble0Maximum display value for FFT plot.
ledboolfalseShow an LED indicator for this channel.
ledHighdouble80Threshold above which the LED activates.
alarmEnabledboolfalseEnable alarm monitoring.
alarmLowdouble20Low alarm threshold.
alarmHighdouble80High alarm threshold.
widgetMindouble0Minimum value for bar/gauge/compass widgets.
widgetMaxdouble100Maximum value for bar/gauge/compass widgets.
plotMindouble0Fixed minimum for the plot Y-axis (0 = auto-scale).
plotMaxdouble0Fixed maximum for the plot Y-axis (0 = auto-scale).

Action Object

Actions define buttons in the dashboard toolbar that send data back to the connected device.

KeyTypeDefaultDescription
titlestringButton label.
iconstring"Play Property"Icon name for the button.
txDatastringData string to transmit when the button is pressed.
eolstring""End-of-line sequence appended after txData (e.g., "\r\n").
binaryboolfalseIf true, txData is interpreted as binary hex data.

Full Example

json
/*{
  "title": "Weather Station",
  "groups": [
    {
      "title": "Environment",
      "widget": "datagrid",
      "datasets": [
        {
          "title": "Temperature",
          "value": "23.5",
          "units": "degC",
          "widget": "gauge",
          "widgetMin": -20,
          "widgetMax": 60,
          "graph": true,
          "alarmEnabled": true,
          "alarmHigh": 50
        },
        {
          "title": "Humidity",
          "value": "45.2",
          "units": "%",
          "widget": "bar",
          "widgetMin": 0,
          "widgetMax": 100,
          "graph": true
        },
        {
          "title": "Pressure",
          "value": "1013",
          "units": "hPa",
          "graph": true
        }
      ]
    }
  ],
  "actions": [
    {
      "title": "Reset Sensor",
      "icon": "Refresh",
      "txData": "RST",
      "eol": "\r\n"
    }
  ]
}*/

When to Use

Device Sends JSON is suited for cases where the firmware must control its own dashboard layout at runtime — for example, when a device switches between operating modes and needs different widgets for each mode. Keep in mind that transmitting large JSON payloads over a serial port adds significant overhead compared to sending raw values, and the JSON structure is tied to the specific Serial Studio version you are using.


Choosing the Right Mode

ScenarioRecommended Mode
Arduino or ESP32 sending CSV numbers for quick debuggingQuick Plot
Rapid prototyping or classroom demonstrationQuick Plot
Need gauges, bars, compass, GPS map, FFT, or alarmsProject File
Custom binary protocol with length-prefixed packetsProject File + Binary decoder + JS parser
Multiple sensors on different ports in one dashboardProject File (multi-source, Pro)
Production telemetry system with saved configurationProject File
Device changes its dashboard layout at runtimeDevice Sends JSON

Feature Comparison

FeatureQuick PlotProject FileDevice Sends JSON
Setup effortNoneCreate project in editorFirmware must build JSON
Frame detectionLine-based (auto)Configurable per sourceFixed /* ... */
CSV delimiterComma onlyAny (via JS parser)N/A (JSON)
JavaScript parserNoYesNo
Custom widgetsNo (plots only)Yes (project-defined)Yes (device-defined)
Alarms and LED indicatorsNoYesYes
FFT analysisNoYesYes
Multi-sourceNoYes (Pro)No
Saved configurationNoYes (.ssproj file)N/A
Device data complexityMinimalAny format with JS parserMust generate JSON

Getting Started Recommendations

If you are new to Serial Studio, start with Quick Plot. Connect your device, make sure it sends comma-separated numbers terminated by a newline, and click Connect. You will see data on screen within seconds.

Once you need more control — specific widget types, unit labels, alarm thresholds, or a polished dashboard layout — move to Project File mode. Open the Project Editor, define your groups and datasets, and load the resulting .ssproj file. This is the recommended mode for most real-world projects.

Device Sends JSON mode exists for niche cases where the device firmware needs to control the dashboard layout dynamically at runtime. It is generally not recommended: it requires transmitting verbose JSON over the data link, and the expected JSON structure may change between Serial Studio versions, which can break your firmware without warning. If you are unsure which mode to use, choose Project File.