Skip to content

Latest commit

 

History

History
207 lines (145 loc) · 3.53 KB

File metadata and controls

207 lines (145 loc) · 3.53 KB

sig – Linux CLI for Siglent SDS1202X-E

sig is a small, fast Python CLI tool for reading measurement values (frequency, RMS, peak-to-peak) from a Siglent SDS1202X-E oscilloscope via LAN (SCPI).

The tool is intentionally Linux-like:

sig freq
sig rms
sig pkpk

Internally, PyVISA is used. Measurements are queried via PAVA? (and optionally via the Cymometer / frequency counter).

Features

  • ✅ Linux-style CLI (sig …)
  • ✅ Connection via LAN (more stable than USB)
  • ✅ Supports C1 / C2
  • ✅ Frequency display in kHz with decimal point
  • ✅ RMS & PKPK
  • ✅ Clean handling of “no signal” (nan)
  • ✅ Works reliably with Siglent SDS1202X-E firmware 1.3.26
  • ✅ No GUI, perfect for scripts & automation

Requirements

  • Linux
  • Python ≥ 3.9
  • Siglent SDS1202X-E
  • Network connection to the oscilloscope
  • SCPI over LAN enabled

Python dependencies

pip install pyvisa pyvisa-py

Project structure

siglent/
├── sig.py          # CLI tool
├── venv/           # Python venv (optional, recommended)
├── freq_scop.py    # tests / experiments
├── scps_scope.py
└── README.md

Installation (recommended with venv)

git clone https://github.com/DL2DBG/siglent.git
cd siglent

python3 -m venv venv
source venv/bin/activate

pip install pyvisa pyvisa-py

Linux command sig (wrapper)

It is recommended to use a wrapper in ~/bin so that sig behaves like a real Linux command.

/home/ulrich/bin/sig

#!/usr/bin/env bash
set -euo pipefail

REPO="/home/ulrich/Dokumente/GitHub/siglent"
VENV="$REPO/venv"
CLI="$REPO/sig.py"
exec "$VENV/bin/python3" "$CLI" "$@"
chmod +x ~/bin/sig

If required:

export PATH="$HOME/bin:$PATH"

Usage

usage: sig [-h] [-i IP] [-c {C1,C2,both}] [--idn] [--raw] {freq,rms,pkpk,all}
sig: error: the following arguments are required: cmd

Frequency (kHz)

sig freq
C1 freq=7010.000 kHz
C2 freq=nan kHz

RMS

sig rms

Peak-to-Peak

sig pkpk

All values

sig all

Single channel only

sig freq -c C1
sig rms  -c C2

Different IP address

sig freq -i 192.168.178.54

Measurement method

Default: PAVA?

Commands used

C1:PAVA? FREQ
C1:PAVA? RMS
C1:PAVA? PKPK

This method is:

  • fast
  • stable
  • directly coupled to the scope’s measurement display

Note on resolution

The frequency may appear in discrete steps (e.g. 7010 / 7020 kHz). This is not a bug but the internal quantization of the measurement function.

Optionally, the Cymometer (CYMT?) can be used (frequency counter), which is often more accurate under clean trigger conditions.

Known limitations

  • C2 shows nan if:
    • channel is disabled
    • no valid signal is present
  • USB-SCPI is firmware-dependent and problematic on the SDS1202X-E → LAN recommended
  • Only tested with SDS1202X-E; other SDS models may be compatible

Tested with

  • Device: Siglent SDS1202X-E
  • Firmware: 1.3.26
  • OS: Linux
  • Python: 3.12
  • pyvisa / pyvisa-py

License

MIT License (or adjust as desired)

Motivation

A small, fast tool for:

  • laboratory use
  • embedded development
  • RF experiments
  • automated measurements
  • shell scripts

No GUI, no overhead.

Contributing

Pull requests, issues, and improvements are welcome 🙂

Acknowledgements

Parts of this project (design, debugging, documentation) were developed with the assistance of ChatGPT (OpenAI) as an interactive programming aid.