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

Example · MDX-400 motor-drive bench · Units

Raw ADC counts in, volts and amps out

Three integers per line from the firmware. Scale, offset and unit on the PC.

  • Firmware sends counts: no floats
  • y = x × scale + offset
  • DC power = V × I, computed
  • Hold, clamp or discard bad samples

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 power stage measures three things with its 12-bit ADC: pack voltage through a 20:1 divider, DC bus current with a ±50 A Hall sensor, and heatsink temperature with a 10 mV/°C sensor. Converting counts on the microcontroller means float maths and a rebuild whenever a divider changes, so the firmware sends raw counts and SerialFlow does the maths.

What the firmware prints

Graph G is a logger with a time axis and three signals: unsigned 16-bit integers sent as decimal text, unit cnt. Then comes one line every 50 ms: the time in seconds and three counts.

~{G:I:Power stage · raw ADC:100000:L:T:R:Time:s:0}
~{G:S:1:U16:D:Pack V adc:cnt:0:81C784}
~{G:S:2:U16:D:I_dc adc:cnt:0:FFD54F}
~{G:S:3:U16:D:T_hs adc:cnt:0:F06292}
…
~{G:0:0.00:3289:2081:1031}
~{G:0:0.05:3290:2083:1029}
…
~{G:0:9.30:3215:2824:1065}
~{G:0:9.35:3213:2829:4095}
~{G:0:9.40:3212:2827:1066}
…
~{G:E:1:16:Hill:FFAB40:D}
~{G:E:2:26:Regen:40C4FF:D}
LineMeaning
~{G:I:Power stage · raw ADC:100000:L:T:R:Time:s:0}Graph G: name, 100 000 points per signal, Logger mode, time X axis, raw X display, X label Time, unit s, no SI scaling
~{G:S:2:U16:D:I_dc adc:cnt:0:FFD54F}Signal 2: U16 value sent as D (decimal) text, name, unit cnt, no SI scaling, colour
~{G:0:9.30:3215:2824:1065}One sample with an explicit X of 9.30 s, then signals 1, 2 and 3 in ID order
~{G:E:1:16:Hill:FFAB40:D}Event marker 1 at 16 s, labelled Hill, orange, dashed

At 9.35 s the heatsink reads 4095, the top of the ADC range: an open-sensor glitch. The 45-second run has four, at 9.35, 21.80, 33.15 and 40.60 s.

From counts to volts

Each channel needs one scale factor and one offset, worked out from its sensor:

SignalSensorScale (per count)OffsetUnit
1 · Pack voltage20:1 divider into a 3.3 V ADC: 66 V ÷ 40950.01611720V
2 · DC bus current±50 A Hall sensor, 0 A at mid-rail: 100 A ÷ 40950.02442-50A
3 · Heatsink10 mV/°C, 500 mV at 0 °C: 330 °C ÷ 40950.0805861-50°C

For the sample at 9.30 s, ~{G:0:9.30:3215:2824:1065}, that gives:

Pack voltage     3215 × 0.0161172        = 51.82 V
DC bus current   2824 × 0.02442    − 50  = 18.96 A
Heatsink         1065 × 0.0805861  − 50  = 35.82 °C

The same rule turns the glitch at 9.35 s into nonsense: 4095 × 0.0805861 − 50 = 280 °C.

Set it up in SerialFlow

All three steps happen in ☰ → Tools → Signal Manager… (also on the toolbar), on its three tabs: Incoming Signals, Computed Signals and Overrides.

Scale, offset and unit

  1. Let some data arrive first: Signal Manager lists the signals it has seen, here graph G, IDs 1 to 3.
  2. On Incoming Signals, select signal 3, T_hs adc. Under UNIT CONVERSION type Heatsink in Name, °C in Unit, 0.0805861 in Scale and -50 in Offset. Note takes a reminder.
  3. Do the same for signals 1 and 2, with the values from the table.
  4. Tick each row’s checkbox, or press Enable All: new rows start as a pass-through.
  5. Preview shows the result for the last sample: 1079 cnt → 36.9524 °C.
Signal Manager, Incoming Signals tab: three graph G signals with their scale factors, and the heatsink's unit conversion with name Heatsink, unit °C, scale 0.0805861 and offset -50.
The heatsink conversion and its live preview: 1079 counts → 36.95 °C.

A computed signal: DC power

Power is not on the wire. A computed signal multiplies the two converted signals as they arrive and adds the product to graph G as a fourth trace.

DC power = pack voltage × current

  1. On Computed Signals, press the template Power (V×I): a Multiply signal Power, unit W, ID 100.
  2. Set Source 1 to graph G, signal 1 (pack voltage) and Source 2 to graph G, signal 2 (current).
  3. Rename it DC power. Check that Target: Graph is G and Show on Graph is ticked.
  4. Result shows the live product: 52.091 × 12.124 = 631.57.

It multiplies volts by amps, not counts. During regenerative braking the current is negative, so DC power is too: −484 W at 26.00 s, as energy flows back into the pack.

Signal Manager, Computed Signals tab: DC power as a multiply of graph G signals 1 and 2, with the result 52.091 × 12.124 = 631.57.
DC power from the Power (V×I) template, with its live result.

Value-range rules

Three value-range rules guard the raw values. The range check runs on the value as it arrives, before the conversion, so the limits are in counts:

SignalMinMaxIn unitsActionWhy
3 · Heatsink4103000−17 to 192 °CHold4095 means an open sensor: keep the last good value
2 · DC bus current2053890±45 AClampLimit the trace to the rated range
1 · Pack voltage2400370038.7 to 59.6 VDiscardA reading outside this is a dropped conversion: throw it away

In this run only Hold had work to do: at 9.35 s the heatsink stays at 35.82 °C, the value from 9.30 s, instead of jumping to 280 °C. Current and voltage stayed in range, so Clamp and Discard never acted.

The wizard

  1. On the Overrides tab, tick Enable Override System and press Setup Wizard.
  2. Choose Validate signal value ranges (discard, clamp, or hold) and press Next →.
  3. Value Range Rules (step 2 of 3): press + Add once per rule. A new row starts on the first live graph and signal. Type the graph letter, the signal and the limits into the row (G, 3, 410, 3000) and pick the Action. An empty Min or Max means no limit. A cell with an invalid entry turns red, and its tooltip says why.
  4. Next → opens Review & Apply: Apply saves, Cancel discards every change.

The same rows can be edited later on the Overrides tab itself: a valid change takes effect at once.

Override Configuration Wizard, Value Range Rules step: three rules on graph G with Hold, Clamp and Discard.
The wizard’s Value Range Rules step with the three bench rules.

The result

The converted view tells the story the counts hid: the pack sags from 53.0 V to about 51 V on the hill, the current climbs past 30 A, and the heatsink warms from 33 °C to about 52 °C before the regen at 26 s.

Three-lane graph: pack voltage, DC bus current and computed DC power over 45 seconds.
DC power as its own lane: about 1 600 W on the hill, below zero when the regen starts.

In your own firmware

The firmware side is integers only: no float, no %f.

#include <stdio.h>
#include <stdint.h>

/* Once after reset: graph G, three 12-bit ADC channels as raw counts */
void power_graph_init(void)
{
    printf("~{G:I:Power stage · raw ADC:100000:L:T:R:Time:s:0}\n");
    printf("~{G:S:1:U16:D:Pack V adc:cnt:0:81C784}\n");
    printf("~{G:S:2:U16:D:I_dc adc:cnt:0:FFD54F}\n");
    printf("~{G:S:3:U16:D:T_hs adc:cnt:0:F06292}\n");
}

/* Every 50 ms: time in seconds, then the three counts in signal-ID order */
void power_graph_sample(uint32_t t_ms, uint16_t v, uint16_t i, uint16_t t)
{
    printf("~{G:0:%lu.%02lu:%u:%u:%u}\n",
           (unsigned long)(t_ms / 1000), (unsigned long)(t_ms % 1000 / 10),
           (unsigned)v, (unsigned)i, (unsigned)t);
}

The wire can carry part of the job: the SI-prefix field of the Init Signal line scales by a power of ten, so ~{B:S:1:U16:D:Voltage:V:-3:00FF00} sends millivolts and shows volts. A factor such as 66/4095, or an offset of −50 A, has no wire field: that is Signal Manager’s part.

Good to know

  • Linear only. A conversion is raw × scale + offset: right for dividers, shunts, Hall sensors and linear temperature sensors. An NTC still needs its curve in the firmware.
  • New samples only. Conversion is applied as samples arrive; samples already in the graph keep their values. Send the data again after a change.
  • Everywhere at once. A conversion applies to graphs, dashboards and statistics, and is saved in your profile.
  • 14 operations. Computed signals add, subtract, multiply, divide, take max, min, average or percentage of two signals, or abs, negate, scale and offset, square, square root or delta of one. Their IDs start at 100.

Try it yourself

No demo file sends raw counts, but graph F of the canvas demo carries pack voltage, current and the firmware’s own power figure to check the maths against.

  1. ☰ → Test → Load Test File → Demo → showcase_canvas_live.txt. Graph F, Bench telemetry, appears with 13 signals.
  2. ☰ → Tools → Signal Manager… → Incoming Signals: select graph F, ID 7 (MOSFET), type °F in Unit, 1.8 in Scale, 32 in Offset, and tick the row.
  3. Computed Signals → Power (V×I): Source 1 F:5 (Pack voltage), Source 2 F:4 (DC bus current), Target: Graph F, Show on Graph ticked.
  4. ☰ → Test → Delayed Playback → Demo → showcase_canvas_live.txt. The MOSFET now reads 118.8 °F on the first line (48.2 °C) and 140.9 °F on the last (60.5 °C).
  5. Compare the new Power trace with signal 6, Electrical power, computed by the firmware. Last line: 51.90 V × 12.18 A = 632.1 W; the firmware says 632.
  6. Untick the MOSFET row to switch °F off again.