Skip to content

catalineacsu/tek-scope-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scope Control with GUI

A small tkinter desktop app for driving a Tektronix TBS1104 (and other TBS / TDS / TPS / MDO / MSO / DPO bench scopes that share the same SCPI command set) over USB / GPIB / LAN via PyVISA.

You get a live waveform display, per-channel controls, and a one-click CSV export. A separate viewer is included for overlaying saved CSV captures.

Features

  • Auto-scans the VISA bus for a Tektronix scope on startup
  • Per-channel toggle, V/div, and probe attenuation (1X / 10X / … / 1000X)
  • Time/div control
  • "Read Now" single-shot capture, or Live mode (~5 Hz update)
  • Save the current frame as CSV (one time column + one column per enabled channel)
  • Companion plotCSVs.py viewer to overlay multiple captures with auto-scaled time units (s / ms / µs / ns)

Requirements

Software

  • Python 3.10 or newer (uses PEP 604 union syntax, e.g. ScopeController | None)
  • A VISA backend installed on the host:
    • NI-VISA (recommended on Windows) — https://www.ni.com/visa
    • or Keysight IO Libraries Suite
    • or pyvisa-py as a pure-Python fallback (pip install pyvisa-py pyusb zeroconf psutil)

Python packages

pip install -r requirements.txt

(pyvisa, numpy, matplotlib)

Hardware

Built and tested against a Tektronix TBS1104. The SCPI commands used (HORizontal:SCAle, CH<n>:SCAle, CH<n>:PROBe, SELect:CH<n>, ACQ:STATE, WFMPRE:*, CURVE?) are common to most Tektronix bench scopes — TBS1000B, TDS1000/2000, TPS2000, MDO/MSO/DPO 2000/3000/4000 series should all work, though only the TBS1104 has been verified.

Connect the scope by USB (recommended) or LAN before launching.

Installation

git clone https://github.com/catalineacsu/tek-scope-controller.git
cd tek-scope-controller
python -m venv .venv
# Windows:
.venv\Scripts\activate
# Linux / macOS:
source .venv/bin/activate
pip install -r requirements.txt

Usage

Main scope control GUI

python main.py

On launch the app scans for a Tektronix scope. If one is found, its current state (time/div, per-channel V/div, probe, on/off) is read back and the dropdowns are synced to match.

  • Channels — tick a box to enable a channel; pick V/div and probe attenuation from the dropdowns. Changes are pushed to the scope immediately.
  • Time/div — pick from the standard 1-2.5-5 sequence (2.5 ns/div up to 50 s/div).
  • Read Now — grabs one frame from every enabled channel and plots it.
  • Live — continuously re-reads at ~5 Hz. Disable before reconnecting or saving.
  • Save CSV — writes the most recently displayed frame to a CSV file (see format below).
  • Reconnect — re-scans the VISA bus; useful after unplugging / re-plugging.

If multiple Tektronix scopes are on the bus, the first one found is used (this is logged).

CSV viewer

python plotCSVs.py

Pick a folder, double-click CSV files to add them to the Selected list, optionally enter comma-separated legend labels (one per file), and click Execute to overlay them in a matplotlib window. The time-axis unit is chosen automatically based on the largest time value across all selected files.

CSV format

Each saved capture has one header row followed by one row per sample:

time_s,CH1_V,CH2_V
-2.500000000e-03,1.234560e-01,-2.345670e-02
-2.499960000e-03,1.235780e-01,-2.341230e-02
...
  • First column is time in seconds (shared across channels — the TBS1104 uses one time base for all channels).
  • Remaining columns are voltages in volts, already corrected for the configured probe attenuation (the scope applies the probe factor; the host does not multiply again).

The viewer (plotCSVs.py) accepts any CSV in this shape — first column time, remaining columns values.

Project layout

main.py              entry point — starts the GUI
gui.py               tkinter GUI, plot, threading, CSV save
scopeController.py   PyVISA wrapper — SCPI commands, waveform decode
plotCSVs.py          standalone CSV overlay viewer
requirements.txt

Troubleshooting

  • "No Tektronix scope found" — confirm the scope shows up in NI-MAX (or pyvisa.ResourceManager().list_resources()). On Windows the TekVISA / NI-VISA driver must be installed and the scope must be in the default USBTMC mode.
  • Connect failed: VI_ERROR_RSRC_BUSY — another program (TekVISA OpenChoice, a previous Python session) still holds the device. Close it or unplug/replug.
  • Live mode looks frozen — make sure at least one channel is enabled and is actually triggering on the scope itself. The GUI displays whatever the scope's last buffered acquisition contains.
  • Probe factor off by 10× — set the probe attenuation in the Probe dropdown (or directly on the scope) to match the physical probe. The waveform is scaled by the scope using that setting.

License

MIT License. Copyright (c) 2026 Andak Consulting. See the header of any source file for the full text.

About

Tkinter GUI for Tektronix TBS / TDS / MDO bench oscilloscopes — live plotting, per-channel control, CSV export. PyVISA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages