Rigol DS1054Z

From Autopilot Wiki
Jump to: navigation, search
Rigol DS1054Z
Image DS1054Z1.jpg
Modality Measurement, Electronics
Tool Type Instrument, Oscilloscope
Manufacturer Rigol Technologies
Product ID/Part Number DS1054Z
Product Page https://www.rigolna.com/products/digital-oscilloscopes/1000z/


Price (USD) 419
Controlled By: Autopilot Paper
Rigol DS1054Z
Analog Channels 4
Digital Channels 0
Sampling Rate (Hz) 1000000000
Bandwidth (Hz) 50000000
External Interfaces USB, Ethernet, RS232
Memory Size (MB) 24

Oscilloscope


Note: Sampling rate is split across channels, so 1GHz when one channel is used, 500MHz when two, and 250MHz if three or four.

Unlocking Features

By default, the DS1054Z comes with a number of features builtin that are locked to the "premium" versions. Thanksfully there is a tool "riglol" that lets us overcome them.

  1. Get serial number
    • Press "Utility" in the menu button cluster
    • Press "System" in the buttons to the right of the screen
    • Then "System Info"
    • Write down the value for "SN"
  2. Get Key
    • Go to the riglol page or n5dux's mirror
    • Enter your serial number, and enter "DSFR" for Options (all options enabled)
    • Click generate.
  3. Enter the Key
    • Press "Utility"
    • Scroll down to "Options"
    • Press "Setup"
    • Press "Editor"
    • Use the intensity knob to enter the key generated above.
    • Press enter!
  4. Confirm Changes
    • "Utility" > "Options"
    • Press "Installed"

Recording Traces

See Ch.11 in the Manual

Set Triggers

Before recording, put the oscilloscope in "auto" trigger mode (the bottom above the trigger position knob), adjust the channels to be recorded by moving and scaling them using the bottom left knob and the "CH#" buttons, then set a trigger using the rightmost pair of knobs. The Trigger menu lets you select what kind of trigger (edge, pulse, slope,. etc), the channel source, and other settings. Each trace will then start at the 0-point (set by the horizontal position knob) and fill the screen.

Setting Memory Depth

The memory depth controls how many samples are recorded in a given trace. The default "auto" collects the number of samples needed to fill the screen at 500MSa/s, but this means we typically can only record a few traces at once. To increase the number of samples we can record, decrese the memory depth as much as you'd like without sacrificing needed measurement precision:

Acquire > Mem Depth, click the "intensity" knob, then select the memory depth you want

Recording

Configure recording in the Utility > Record menu

Click the "down" button to page down the set of options, and then configure recording in the "Record Opt" menu. Configure the sampling interval and then set the number of recordings to make (Set Max takes the maximum number of recordings, given the number of channels to record and the memory depth).

First turn recording mode on by pressing the Record ON/OFF button at the top of the main record menu, and then press the Circular record button. The oscilloscope will then record a trace every time the trigger is activated until it reaches the number of recordings set previously.

You can then review the recorded traces by turning the intensity knob, or else press the "play" button to play all of them.

Network Control

The DS1054Z can be controlled over the network (see the File:DS1000Z-E ProgrammingGuide EN.pdf for the available commands and usage), and we can use the ds1054z package which wraps the communication system.

The DS1054Z class wraps several of the basic functions, but otherwise you use its query() method to write and read from the oscilloscope. Queries that read parameters from the oscilloscope end in a ? where those that set values don't.

Reading All Recorded Traces

As an example included in the Autopilot Paper Plugin, after recording traces, to save all traces to a .csv file/Pandas dataframe:

from pathlib import Path
import pandas as pd
from ds1054z import DS1054Z

def save_all_traces(
        ip:str,
        path:Path=Path('.'),
        base_name:str="OscTrace",
        mode:str="NORM") -> pd.DataFrame:
    """
    Save all traces recorded in the DS1054Z's recording memory
    
    Args:
        ip (str): IP address of oscilloscope
        path (:class:`pathlib.Path`): Directory to save trace in
        base_name (str): Base name of output files. Saved will will be of the form
            f"{base_name}_n.csv" where n increments for each successive call
        mode (str): One of 
            * ``"NORM"`` - just traces on screen
            * ``"RAW"`` - full trace from memory (takes longer)
            * ``"MAX"`` - Tries to get RAW if possible, otherwise NORM
    
    Returns:
        (:class:`pandas.DataFrame`): A dataframe with timestamps (in seconds), 
            voltages per channel, and a trace index.
    """
    osc = DS1054Z(ip)
    start_frame = int(osc.query(":FUNCtion:WREPlay:FSTart?"))
    end_frame = int(osc.query(":FUNCtion:WREPlay:FEND?"))

    traces = []
    for i in range(start_frame, end_frame+1):
        # Move to next trace
        osc.write(f":FUNCtion:WREPlay:FCURrent {i}")

        # Get each displayed channel's samples and timestamps
        data = {}
        data['time'] = osc.waveform_time_values_decimal
        for channel in osc.displayed_channels:
            data[f"CH_{channel}"] = osc.get_waveform_samples(channel, mode=mode)
        data["trace"] = i
        traces.append(pd.DataFrame(data))

    # concat all dataframes
    dfs = pd.concat(traces, ignore_index=True)

    # get a filename that increments in number based on existing files in directory
    current_files = list(path.glob(f'{base_name}*.csv'))
    trace_n = 0
    if len(current_files)>0:
        trace_n = int(current_files[-1].stem.split('_')[-1]) + 1

    out_fn = path / f"{base_name}_{trace_n}.csv"
    dfs.to_csv(out_fn, index=False)
    return dfs

Which creates a .csv like this:

time CH_CHAN1 CH_CHAN2 trace
-0.000102 -0.8 -1.2 2
-0.000101 0 -1.36 2
-0.0001 0 -1.2 2
-0.000099 -0.8 -1.36 2
-0.000098 0 -1.2 2
-0.000097 -0.8 -1.36 2
-0.000096 -0.8 -1.2 2
-0.000095 0 -1.36 2
-0.000094 0 -1.2 2

See Also


References