KYMOCORE FOR PYTHON · 0.1.0 · MIT

Measurements from Python, live on screen.

Not every signal comes from a microcontroller. A Raspberry Pi reads sensors, a test bench script drives a power supply, a simulation computes a plant model. kymocore sends those values to KymoStudio while they happen – in the same binary format as the firmware.

KymoStudio
KymoStudio showing measurements live as a time series and an XY chart

What it is for

Wherever measurements come out of a Python script and you don't want to look at them only afterwards as a CSV file.

Raspberry Pi & single-board computers

Plot sensor values read via I²C, SPI or GPIO live – without building your own plot window.

Test benches & HIL

The script's setpoints next to the measurements of the device under test – in one workbench, on one time axis.

Simulation

Watch a plant model or controller simulation with the same charts you will later use on real hardware.

Data from other programs

Forward values from instruments, logs or APIs to KymoStudio.

Recording & CSV

KymoStudio records, replays and exports CSV – just as for data from a board.

Analysis included

Cursors, step response, FFT and trigger work on Python data too, with the sender's timestamps.

QUICK START

One call per value

In KymoStudio, add a UDP source on port 5025, start it and assign channel 0 to a chart. With x= and z= you get XY and 3D paths.

pip install kymocore            # UDP, TCP
pip install kymocore[serial]    # + serial / USB
pip install kymocore[mqtt]      # + MQTT
import math, time
from kymocore import Sender

with Sender.udp('127.0.0.1', 5025) as sender:
    for i in range(1000):
        sender.send(0, math.sin(i / 20))       # channel 0
        sender.send(1, math.cos(i / 20), x=i)  # XY point
        time.sleep(.01)

Four ways into KymoStudio

KymoStudio's existing sources receive the data unchanged.

TransportCallSource in KymoStudio
UDPSender.udp(host, port)UDP, listening on port
TCPSender.tcp_server(port)Telnet/TCP connects to this machine; values sent while no client is connected are dropped, as on a device
SerialSender.serial('COM4', 115200)Serial, same baud rate
MQTTSender.mqtt(broker, topic)MQTT, topic among its receive topics; one message per value

Same protocol as the firmware

Each value is a compact frame of 9 to 21 bytes, tested against the golden vectors of the Kymotrace protocol v6.2. Optionally with CRC-8. frame() returns the bytes for a transport of your own.

Timestamps included

Time since the sender started, from a monotonic clock, in microseconds (default; wraps after 71.6 minutes and KymoStudio continues the time axis) or milliseconds. Without a timestamp, KymoStudio stamps on arrival.

Part of Kymotrace

Two libraries, one protocol: KymoCore runs on the microcontroller, KymoCore for Python on the PC or Raspberry Pi. On PyPI the package is called kymocore.

FIRMWARE · C++11

KymoCore

Measurements, traces and live parameters on the microcontroller.

PC · PYTHON

KymoCore for Python

Send measurements from scripts. This page.

EXAMPLES

KymoProbe

Ready-made firmware for ESP32, Arduino and STM32.

DESKTOP APP

KymoStudio

Receive, display, record, analyse.

Key points

  • One call per value, up to 256 channels, XY and XYZ
  • Core without dependencies; pyserial and paho-mqtt are optional
  • Python 3.10 or newer, any operating system
  • MIT license, also for commercial projects

Honest limits

  • Sending only: no runtime traces, no live parameters, no back channel
  • Numbers only, no text messages
  • Microsecond timestamps need KymoStudio 2.5 or newer
  • Version 0.1.0 – the API may still change

Background on recording and export: Embedded data logging →

Run the script, open KymoStudio, see the curve.

Get KymoStudio 2.8.0 kymocore on PyPI