Getting Started

Installing the Python Automation API package

To get started, you will need the latest build of the Logic 2 Software (2.3.56+), the logic2-automation python package, and python 3.9 or newer.

First, let’s install the logic2-automation package. Download the package zip file, and install it like so:

Download the package: _static/logic2_automation-0.0.1-py3-none-any.whl

And install it via pip:

pip install path/to/logic2_automation-0.0.1-py3-none-any.whl

Launching Logic2

Because this feature is pre-release, the automation functionality is not available in the software by default. To activate it, the software needs to be launched with an environment variable:

# cmd.exe
# bash
# powershell

With this flag set, the automation interface can now be enabled in the software UI. Open the preferences dialog from the main menu, and scroll to the bottom.


When the checkbox is checked, the automation server will start running in the Logic 2 software on the default port, 10430.

Using the Python Automation API

Next, let’s run a simple example. You don’t need to have a device connected for this. This example uses a demo device, if you would like to use a connected device follow the steps here to find your device’s serial number and replace the demo value in the example.

Create a new python file called, and paste in these contents:

from saleae import automation
import os
import os.path
from datetime import datetime

# Connect to the running Logic 2 Application on port `10430`
manager = automation.Manager(port=10430)

# Configure the capturing device to record on digital channels 0, 1, 2, and 3,
# with a sampling rate of 10 MSa/s, and a logic level of 3.3V.
device_configuration = automation.LogicDeviceConfiguration(
    enabled_digital_channels=[0, 1, 2, 3],

# Record 5 seconds of data before stopping the capture
capture_configuration = automation.CaptureConfiguration(

# Start a capture - the capture will be automatically closed when leaving the `with` block
# Note: We are using serial number 'F4241' here, which is the serial number for
#       the Logic Pro 16 demo device. You will need to use your device's serial number
#       to use a real device. Please see the "Finding the Serial Number of a Device" section.
with manager.start_capture(device_serial_number='F4241',
                           capture_configuration=capture_configuration) as capture:

    # Wait until the capture has finished
    # This will take about 5 seconds because we are using a timed capture mode

    # Add an analyzer to the capture
    # Note: The simulator output is not actual SPI data
    spi_analyzer = capture.add_analyzer('SPI', label=f'Test Analyzer', settings={
        'MISO': 0,
        'Clock': 1,
        'Enable': 2,
        'Bits per Transfer': '8 Bits per Transfer (Standard)'

    # Store output in a timestamped directory
    output_dir = os.path.join(os.getcwd(), f'output-{"%Y-%m-%d_%H-%M-%S")}')

    # Export analyzer data to a CSV file
    analyzer_export_filepath = os.path.join(output_dir, 'spi_export.csv')

    # Export raw digital data to a CSV file
    capture.export_raw_data_csv(directory=output_dir, digital_channels=[0, 1, 2, 3])

    # Finally, save the capture to a file
    capture_filepath = os.path.join(output_dir, 'example_capture.sal')

# Close the connection

With the software is running, and the automation interface enabled (as shown above), run the script:


There you have it! Take a look at the documentation for Manager and Capture to see how the functionality all works!

Also, for most automated applications, you won’t want to start the software manually. See this section for more information about different ways to launch the Logic software, including through this python library.

Finding the Serial Number of a Device

To find the serial number of a connected device, open capture info sidebar and click the device dropdown in the top right:


If the device you want the serial number for is not selected, select it. Then click “Device Info” - this will open a popup with information about your device, including its serial number.


You can copy the serial number from here and use it in your Python script.