Skip to main content

Python PCB Assembly Test Toolkit

Project description

Info

A python based package providing a set of generation, measurement and communication building blocks, that can be used to perform PCB Assembly tests.

Author

National Instruments

About

The nipcbatt package provides APIs (Application Programming Interface) for interacting with the NI_DMM, NI-SWITCH, NI-DAQmx driver and with LabVIEW runtime to perform measurement, generation and communication operations. The package is implemented in Python, as a highly object-oriented package.

Python PCB Assembly Test Toolkit or nipcbatt is a collection of Measurement Library, Automation Examples, Test Demo Example developed in Python along with Documentation for PCB Assembly electrical functional test.

nipcbatt package is focused on NI DAQ, DMM, and SWITCH devices, and compatible with NI PC Based DAQ, CompactDAQ, NI-DMM, TestScale and high level enough to be applicable or scalable for other instruments with similar functionality and resources on any platform.

Documentation

Refer to the Python PCB Assembly Test Toolkit - Getting Started guide for getting started steps including installation and setup procedures, and steps to run example test sequences. Refer to the User Manual for an overview of Toolkit concepts and measurement fundamentals, including a brief overview of each library and automation sequences.

Supported Features

Feature name

Description

Acronym

DMM Measurement Libraries

A collection of methods to perform DMM measurements using NI-DMM driver.

dmm

DAQ Measurement Libraries

A collection of methods to perform measurements using NI-DAQmx driver.

daq

SWITCH Measurement Libraries

A collection of methods to control Switch hardware, and switch paths using the NI-SWITCH driver.

switch

DMM Scan Measurement Libraries

A collection of methods to perform measurements using NI-DMM and NI-SWITCH driver.

dmm_scan

Communication Libraries

A collection of methods to perform communication operations (for example I2C, SPI, and serial) using NI-845x and NI-VISA drivers.

comm

Library imports and migrations

In this release the instrument-specific measurement libraries are exposed as subpackages under the top-level nipcbatt package. Example usage:

from nipcbatt import daq
drvg = daq.DcVoltageGeneration()
drvg.initialize(analog_output_channel_expression="Sim_PC_basedDAQ/ao0")

Few classes remain accessible directly from nipcbatt (for example nipcbatt.MeasurementExecutionType). However, explicit subpackage imports are the recommended approach for all new code. To migrate existing code, update imports and references from:

# Not recommended ❌
import nipcbatt
drvg = nipcbatt.DcVoltageGeneration()

to the explicit subpackage form:

# Recommended ✅
from nipcbatt import daq
drvg = daq.DcVoltageGeneration()

See Migration Guide for nipcbatt 2.0.0 for a complete list of class mappings, and all available subpackage classes.

Required Drivers

  • NI-DMM: 2023 Q4 and above

  • NI-SWITCH: 2023 Q4 and above

  • NI-DAQmx: 2023 Q3 and above

  • LabVIEW Runtime: 2022 Q3 and above (64 bit)

  • NI-845x: 2022 Q3 and above

  • NI-VISA: 2023 Q2 and above

  • NI-Serial: 2023 Q2 and above

Visit ni.com/downloads or visit NI Package Manager to download the Required Drivers.

Supported Hardware

  • DMM devices compatible with the NI-DMM driver

  • Switch devices compatible with the NI-SWITCH driver

  • Any DAQmx devices with similar functionality and resources

  • NI PC-Based DAQ

  • CompactDAQ

  • TestScale

Operating System Support

nipcbatt supports Windows 10 and 11 systems where the supported drivers are installed. Refer to NI Hardware and Operating System Compatibility for which versions of the driver support your hardware on a given operating system.

Python Version Support

nipcbatt supports Python 3.9 to 3.12 (64 bit)

Installation

You can use pip to download nipcbatt from PyPI and install it:

$ python -m pip install nipcbatt

Getting Started

In order to use the nipcbatt package, you must have at least one DAQ (Data Acquisition) device installed on your system. Both physical and simulated devices are supported. The examples below use PC based DAQ device (PCIe-6353). You can use NI MAX or NI Hardware Configuration Utility to verify and configure your devices.

Finding and configuring device name in NI MAX:

NI-MAX

Finding and configuring device name in NI Hardware Configuration Utility:

Hardware Config

Then refer to the Validation examples and Automation sequences to start testing. Refer to the Getting Started Guide for information.

Key Concepts in Python PCBATT

1. Libraries

All the measurement libraries consist of three main methods which have to be used in the following order:

  • Initialize:

    Used to initialize a measurement instance (for DAQmx use either physical or global virtual channels to perform the respective task).

    This is done by calling the initialize() method on the class instance.

Example code to initialize an instance of DC RMS voltage measurement:

>>> from nipcbatt import dmm
>>> dmm_voltage_measurement = dmm.DcRmsVoltageMeasurement()
>>> dmm_voltage_measurement.initialize("Sim_DMM", 50)
  • Configure and Generate/Configure and Measure:

    Configures and executes measurement or generation tasks. For measurements, this method can return both raw data for custom analysis and processed results from built-in analysis functions (configurable via measurement options).

    This is done by calling the configure_and_measure()/configure_and_generate() method on the class instance.

Example code to configure and measure DC voltage using the class instance:

>>> measurement = dmm_voltage_measurement.configure_and_measure(
>>>   configuration=dmm.DEFAULT_DC_RMS_VOLTAGE_MEASUREMENT_CONFIGURATION
>>> )
... # Default voltage measurement configuration
  • Close:

    Closes the measurement or generation session and releases hardware resources.

    This is done by calling the close() method on the class instance.

Example code to close the session and clear resources:

>>> dmm_voltage_measurement.close()

1. Features and Utilities

  • Virtual Channels

    Virtual channels, or sometimes referred to generically as channels, are software entities that encapsulate the physical channel along with other channel specific information (e.g.: range, terminal configuration, and custom scaling) that formats the data. A physical channel is a terminal or pin at which you can measure or generate an analog or digital signal. A single physical channel can include more than one terminal, as in the case of a differential analog input channel or a digital port of eight lines. Every physical channel on a device has a unique name (for instance, cDAQ1Mod4/ai0, Dev2/ao5, and Dev6/ctr3) that follows the NI-DAQmx physical channel naming convention. Refer to NI-DAQmx Channel for more information.

  • Logger

    The logger is a feature which comes along with the package as a part of PCBATT Utilities and helps in storing configuration details and results for every run of the sequences. It can be used to store results in the .txt or .csv file formats. The logger stores results for every run in the same file. Example usage of the logger can be found in the automation sequences.

  • Save Traces

    This Utility works in a similar manner as the logger but it saves configuration settings and results for each run in separate files. Example usage of the save_traces module can be found in the validation examples.

Usage

1. Validation Examples

Validation examples are created as examples for testing and validating a pair of libraries together, where one library is used for generation and another for measurement. The validation examples can be found in this location pcbatt_validation_examples.

The following images shows sample results for Signal Voltage Generation to Frequency Domain Voltage Measurement Validation example which is located at “/pcbatt_validation_examples/PC_Based_Examples/PC_SVG_FDVM.py”:

SVG_to_FDVM_Results

2. Automation Sequences

Automation sequences are examples of using libraries for real time scenarios like microphone tests, LED tests and so on. Automation sequences are tested in simulation mode.

Following is the list of Automation Sequences provided as a part of the package.

  1. action_button_tests

  2. audio_tests

  3. communication_tests

  4. digital_io_tests

  5. led_tests

  6. microphone_tests

  7. power_supply_tests

  8. sensor_tests

  9. synchronization_tests

The Automation Sequences can be found in this location pcbatt_automation.

3. Functional Test Demo Sequence

FT demo sequence is an example for creating a test sequence using libraries with applying test limits on the results to determine whether the test is a pass or a fail.

Please refer to the FT Demo Sequence in the location pcbatt_ft_demo_test_sequence.

Bugs / Feature Requests

To report a bug or submit a feature request, please use GitHub Issues.

License

nipcbatt is licensed under an MIT-style license. Other incorporated projects may be licensed under different licenses. All licenses allow for non-commercial and commercial use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nipcbatt-2.0.0.tar.gz (15.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nipcbatt-2.0.0-py3-none-any.whl (16.1 MB view details)

Uploaded Python 3

File details

Details for the file nipcbatt-2.0.0.tar.gz.

File metadata

  • Download URL: nipcbatt-2.0.0.tar.gz
  • Upload date:
  • Size: 15.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.13 Windows/10

File hashes

Hashes for nipcbatt-2.0.0.tar.gz
Algorithm Hash digest
SHA256 35457d00852f8c3840c6132a941e07edcfbfe29c58409beec4a6d4f64fed3605
MD5 6b2adb3cf28aa07f097e7de3be13aad2
BLAKE2b-256 402c33c1eb1c77e448566d9de1fdbf9964b8a1b41d056e5d165c4de98c01683d

See more details on using hashes here.

File details

Details for the file nipcbatt-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: nipcbatt-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.13 Windows/10

File hashes

Hashes for nipcbatt-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86e7b8e7e1c70b96fd5ccab6861871d4602226166f9e4e2df673345e1ac98659
MD5 a21ef5f9e0f46e1567b4119323b1fba3
BLAKE2b-256 fc8c8be80f7a7ad8ba6955812d35f99e1a65f1ad8525010d03eed8b77254745f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page