Skip to main content
PicoScope 7 serial decoding, with the protocol decoder selection open over a decoded bus, available in India from GSAS Micro Systems

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 an 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

Horizontal stacked bar showing where an ADAS test vehicle's bandwidth budget is spent, split into cameras, lidar, radar and bus traffic, with the logger uplink limit drawn as a vertical rule crossing the bar, from GSAS Micro Systems India
Automotive Ethernet Automotive & Mobility

ADAS Sensor Data Logging: Bandwidth Budgets That Add Up

Every page that tells you an ADAS test vehicle produces terabytes a day states the headline and skips the arithmetic, so you cannot redo it for your own sensor set. This article publishes the arithmetic instead: one formula, every table row derived on the page, a worked eight-hour drive that chains those rows into a sustained write rate, a media count and an offload window, and the five places bandwidth budgets go wrong. Written by the GSAS Micro Systems engineering team in India.

29 Aug 2026 · 15 min read
Two test paths leaving the same device under test, one into a conformance suite that returns a passed report and one into a partner node that surfaces a field defect, showing why an ECU can clear a published suite and still fail in a vehicle, from GSAS Micro Systems India
Automotive Ethernet Automotive & Mobility

Automotive Ethernet Conformance: TC8 and Testing Above It

Summarising TC8 as a layer 1 to layer 4 suite is wrong in both directions. The public OPEN Alliance ECU test documents run from transmitter distortion up to a SOME/IP chapter with its own standardised test stub, and they contain exactly one time synchronisation test case. This is what those documents enumerate, chapter by chapter, what genuinely lives above their boundary, why a passing ECU can still fail against a partner node, and how much pre-compliance work a Tier-1 in India can honestly do in-house before a test house visit. Written by the GSAS Micro Systems engineering team in India.

29 Aug 2026 · 12 min read
Horizontal timeline of a CAN frame crossing a gateway, with four annotated segments showing bus arbitration, the point where the timestamp is applied, encapsulation into an IP packet, network transit and host receive, from GSAS Micro Systems India
Automotive Ethernet Automotive & Mobility

CAN-to-Ethernet Gateways and Tunnelling Legacy Buses

One word, two jobs. A CAN-to-Ethernet gateway either carries a frame across an IP network unchanged, for loggers and remote benches, or stops the frame and re-expresses its signals as service calls. The two have different failure modes, different timing costs and different questions to ask a supplier. This article separates the jobs, states what open documentation actually shows about encapsulation and configuration, and gives a checklist you can put to a vendor. Written by the GSAS Micro Systems engineering team in India.

29 Aug 2026 · 12 min read