Skip to main content

Python library for connecting with Nextech force gauges over USB Serial

Project description


Nexgraph Python

Description:

NexGraph Python is a Python library implementation of the NexGraph software which works with force gauges and torque testers manufactured by Nextech. It connects to a device over USB serial and enables you to operate the device using Python. Download data from your devices, execute commands, and read data. Device data can be output in raw and CSV format. A bar chart can also be generated. Compatible Devices:

  • Nextech:
    • DFS Series
    • DFT
    • CTS
    • DTS
    • DTT
  • Sauter:
    • FL Series
    • DA
    • DB

Requirements:

Tested on Python versions 3.10+

Installation:

pip install nexgraphpy

Examples:

Import the library:

from nexgraph import NexGraph

Create a new instance:

DFT_DEVICE = NexGraph()

Find and connect to a Nextech force gauge over USB serial port:

Nextech Force Gauges:

if DFT_DEVICE.find():
    if DFT_DEVICE.connect():
        print(DFT_DEVICE.get_info())
        DFT_DEVICE.disconnect()
        DFT_DEVICE = None
    else:
        print("Unable to connect")
        exit()
else:
    print("No device found.")
    exit()

Other force gauges using lower baud rate:

if FL_DEVICE.find():
    if FL_DEVICE.connect("low"):
    ...

Connect to a Nextech force gauge directly:

# Initialize with device the path
DFT_DEVICE = NexGraph("COM3")

# Or set the device path after initializing
DFT_DEVICE.device_path = "COM3"

# Connect to device after setting the path
if DFT_DEVICE.connect():
    ...

Basic device serial operations:

Returns boolean value

# Change device modes, peak and tracking
DFT_DEVICE.mode()

# Change the units on device
DFT_DEVICE.unit()

# Reset the current device value
DFT_DEVICE.reset()

# Zero (Tare) the value on device
DFT_DEVICE.zero()

Returns string value

Download data from device memory
# Get data with no formatting
DFT_DEVICE.download()

# Get data in CSV format
DFT_DEVICE.download("csv")

# Get data as CSV and generate a chart
DFT_DEVICE.download("csv", True)

# ** Chart is saved in the script directory as "memory-data-yyyymmdd-HHMMSS.png"
Read and print values from the device
# Print value
DFT_DEVICE.print_value()

# Peak compression value
DFT_DEVICE.peak_compression()

# Peak tension value
DFT_DEVICE.peak_tension()

# Different formatted values
DFT_DEVICE.long_output()
DFT_DEVICE.short_output()
DFT_DEVICE.mini_output()

Output live data of 100 rows:

Note: The output rate is roughly 10 data points per second. 100 data points is approximately 10 seconds of testing.

i = 0
while True:
    print(DFT_DEVICE.long_output())
    i += 1
    if i >= 100:
        break

Find and connect to a Nextech torque tester over USB serial port:

if DTT_DEVICE.connect(False):
    # Output unformatted data:
    print(DTT_DEVICE.read_torque_data())
     # Output data as CSV format
    print(DTT_DEVICE.read_torque_data("csv"))
     # Output unformatted data and generate a chart
    print(DTT_DEVICE.read_torque_data("raw",True))
    ...

# ** Chart is saved in the script directory as "torque-data-yyyymmdd-HHMMSS.png"

Documentation

Nexgraph Python Docs https://python.nexgraphapp.com/

NexGraph Desktop Application

The latest version of the NexGraph desktop application with features such as live graphing, and pass/fail data highlighting is available now for Windows. Get it from: https://nexgraphapp.com.

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

nexgraphpy-2.1.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

nexgraphpy-2.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file nexgraphpy-2.1.0.tar.gz.

File metadata

  • Download URL: nexgraphpy-2.1.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nexgraphpy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 20e6cde478a006afba5a44d3fb17426228e4d3893172c22669e5a326c047df78
MD5 1ed3d4dfc9b05ab798c225039aeba593
BLAKE2b-256 f11ca68b683ab7e71ca41afa47fa0c4b43f5199b0823f6f9e3acc2164ce5f2f6

See more details on using hashes here.

File details

Details for the file nexgraphpy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexgraphpy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nexgraphpy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b04d36610f8376db4af52b885ee00ac5867b3e20856e4caa1a60e25fba8d1998
MD5 e855a2eaff6a2274a42074ea7a3ae15a
BLAKE2b-256 24a40dff1eddb3a49d1a3df08fed9e8fec8f1061c39c390e82223970016641d8

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