Skip to main content
Python code automating PicoScope measurement using pyPicoSDK

pyPicoSDK Tutorial: Automating PicoScope Measurements with Python

GSAS Engineering · · 8 min read

Why Automate Oscilloscope Measurements?

Manual oscilloscope operation, adjust settings, capture, read values, record in a spreadsheet, works for bench debugging. But for production testing, design characterization, and data acquisition, manual operation is too slow and introduces operator variability.

Pico Technology’s pyPicoSDK is a Python package that provides programmatic control of PicoScope oscilloscopes. Combined with Python’s NumPy, SciPy, and matplotlib ecosystem, it enables engineers to build automated measurement scripts that run unattended, produce consistent results, and integrate with existing data pipelines.

Prerequisites

Hardware

Any PicoScope supported by PicoSDK, this includes the PicoScope 2000, 3000, 4000, 5000, and 6000E series. Connect the PicoScope to your PC via USB.

Software

  1. PicoSDK: install from picotech.com/downloads. This installs the device drivers and shared libraries.
  2. Python 3.8+: standard Python installation
  3. pyPicoSDK: install via pip:
pip install pyPicoSDK

pyPicoSDK depends on NumPy, which is installed automatically.

Tutorial: Basic Voltage Measurement

Step 1: Connect and Open the Device

from pyPicoSDK import ps3000a  # Import the driver for your PicoScope model

## Open the first available PicoScope 3000A series device
scope = ps3000a.open_unit()
print(f"Connected to: {scope.info}")

The open_unit() function scans USB for connected PicoScope devices and returns a handle to the first one found. If you have multiple scopes connected, you can specify the serial number.

Step 2: Configure a Channel

## Configure Channel A
scope.set_channel(
    channel='A',
    enabled=True,
    coupling='DC',
    range_mv=5000,  # +/- 5V range
    offset_mv=0
)

## Disable unused channels to maximize sample rate
scope.set_channel(channel='B', enabled=False)
scope.set_channel(channel='C', enabled=False)
scope.set_channel(channel='D', enabled=False)

The range_mv parameter sets the input voltage range. Choose the smallest range that accommodates your signal, this maximizes ADC resolution.

Step 3: Configure Timebase and Capture

import numpy as np

## Set the sample interval and number of samples
sample_interval_ns = 100  # 100 ns between samples = 10 MS/s
num_samples = 10000       # 10,000 samples = 1 ms capture window

## Configure the timebase
scope.set_timebase(sample_interval_ns=sample_interval_ns, num_samples=num_samples)

## Set a simple trigger: rising edge on Channel A at 1V
scope.set_trigger(
    channel='A',
    threshold_mv=1000,
    direction='RISING',
    auto_trigger_ms=5000  # Auto-trigger after 5 seconds if no event
)

## Run a single capture
scope.run_block()

## Wait for the capture to complete
scope.wait_ready()

Step 4: Retrieve and Process Data

## Get the captured data as NumPy arrays
time_ns, voltage_mv = scope.get_data(channel='A')

## Convert to standard units
time_us = time_ns / 1000.0
voltage_v = voltage_mv / 1000.0

## Calculate basic statistics
v_mean = np.mean(voltage_v)
v_rms = np.sqrt(np.mean(voltage_v ** 2))
v_peak = np.max(voltage_v) - np.min(voltage_v)

print(f"Mean: {v_mean:.3f} V")
print(f"RMS:  {v_rms:.3f} V")
print(f"Peak-to-peak: {v_peak:.3f} V")

Step 5: Save and Close

## Save data to CSV
np.savetxt('measurement.csv',
           np.column_stack([time_us, voltage_v]),
           delimiter=',',
           header='Time_us, Voltage_V',
           comments='')

## Close the PicoScope connection
scope.close()

Production Test Application

For production testing, verifying that a power supply output meets specifications across a batch of units, the script expands to:

def test_power_supply(scope, unit_id):
    """Test a power supply unit and return pass/fail results."""
    scope.run_block()
    scope.wait_ready()
    time_ns, voltage_mv = scope.get_data(channel='A')
    voltage_v = voltage_mv / 1000.0

    v_mean = np.mean(voltage_v)
    v_ripple = np.max(voltage_v) - np.min(voltage_v)

    # Define pass/fail criteria
    results = {
        'unit_id': unit_id,
        'v_mean': v_mean,
        'v_ripple': v_ripple,
        'mean_pass': 4.95 <= v_mean <= 5.05,  # 5V +/- 1%
        'ripple_pass': v_ripple < 0.050,       # < 50 mV ripple
    }
    results['overall_pass'] = results['mean_pass'] and results['ripple_pass']
    return results

Call this function for each unit in the batch, collect results, and export a test report.

Data Acquisition Application

For long-duration data logging, monitoring a temperature sensor output over hours, use streaming mode:

## Streaming mode captures data continuously
scope.run_streaming(
    sample_interval_ns=1000000,  # 1 ms sample interval = 1 kS/s
    buffer_size=100000            # 100k sample buffer
)

## Process data in real-time using a callback
import time
all_data = []

for i in range(3600):  # Capture for 1 hour
    time.sleep(1)
    data = scope.get_streaming_data(channel='A')
    if data is not None:
        all_data.append(data)

Integration with Analysis Libraries

pyPicoSDK returns NumPy arrays, making integration simple with:

  • SciPy: Signal processing (filtering, FFT, peak detection)
  • matplotlib: Waveform and spectrum visualization
  • pandas: Data organization and export
  • scikit-learn: Statistical analysis and anomaly detection for production test data

Why Buy PicoScope from GSAS

GSAS Micro Systems is India’s authorized Pico Technology partner. Our engineers support pyPicoSDK integration for automated test systems, from script development guidance to full test station architecture.

  • PicoSDK and pyPicoSDK setup assistance
  • Demo units at offices in Bengaluru, Hyderabad, Chennai, Pune, Mumbai, and Delhi NCR
  • INR invoicing with GST-compliant documentation
  • Application engineering for automated test system design

Request a quote → · Book a demo →

Interested in Pico Technology tools?

Talk to our application engineers for personalized tool recommendations.

Stay in the Loop

Get monthly compliance updates, product insights, and engineering best practices delivered to your inbox.

Related Articles

I3C FAQ for firmware teams covering MIPI I3C bus fundamentals, tooling and adoption in India, from GSAS
Technical Guides Binho Semiconductor Design

I3C FAQ for Firmware Teams: What the Bus Is, What Changes, and What You Need on the Bench

MIPI Alliance describes I3C as the successor to I2C, with legacy compatibility so that I3C and I2C devices can coexist on the same bus, a two-wire interface that supports in-band interrupts to reduce pin count, plus multi-controller support and dynamic addressing. This FAQ answers the questions firmware teams actually ask before adopting it.

31 Jul 2026 · 8 min read
Binho Supernova running in I3C target mode to emulate a device against a customer controller, supported in India by GSAS
Technical Guides Binho Semiconductor Design

Running the Binho Supernova as an I3C Target: Emulating a Device Against Your Own Controller

Binho specifies the Supernova's I3C role as Controller or Target, which means the same adapter can stand in as the device under test rather than only driving one. That second direction is how a team validates its own I3C controller, its ENTDAA implementation and its interrupt handling, before the target silicon exists.

31 Jul 2026 · 7 min read
Functional verification engineer in India reviewing RTL waveforms, coverage charts and a regression dashboard, Siemens Questa One and the Questa Prime to Questa One rename explained by GSAS
Questa Siemens EDA Semiconductor Design

What Happened to Questa Prime and ModelSim?

Siemens has consolidated its Questa verification line under a single brand. The Questa product hub now returns a 301 redirect to the Questa One page, the ModelSim URL redirects to Questa One Sim, and Questa Prime no longer appears on any Siemens public product page. Here is what Questa One actually contains, what Siemens says the word One means, and what Indian verification teams should check before treating this as only a name change.

31 Jul 2026 · 11 min read