Skip to main content

Library for interfacing with NIDAQ devices

Project description

NIDAQ-driver

Python library for NI DAQ modules

To use, include NIDAQClient.py in your project.

Example

from NIDAQClient import NIDAQVoltage
from NIDAQClient import NIDAQThermo

# Create an instance of the client for thermocouple reading.
# This thermocouple module is installed in position 2 in the NI DAQ cage:
daq = NIDAQThermo(position=2, thermocouple_type='J')
daq.start()

# Here, use the `read_samples` method whenever you need to read from the channels.
data = daq.read_samples()

# Print the data here in the console
print("Received Thermocouple Data:")
print(data)

daq.stop()
daq.close()



# Now, read a voltage sensor installed in the NI cage in position 4:
daq = NIDAQVoltage(position=4)
daq.start()

# Here, use the `read_samples` method whenever you need to read from the channels.
data = daq.read_samples()

# Print the data here in the console
print("Received Voltage Data:")
print(data)

daq.stop()
daq.close()

The output will look something like this:

Received Thermocouple Data:
[1376.34 1376.34 1376.34 1376.34 1376.34 1376.34 1376.34 1376.34]
Received Voltage Data:
[3.27506 3.27454 3.31136 3.29971 3.32641 3.30917 3.33307 3.3026  3.16697
 3.15747 3.18815 3.15947 3.19679 3.17848 3.19905 3.16965 3.25606 3.25605
 3.29187 3.28341 3.30896 3.29355 3.31831 3.29019 3.16315 3.15645 3.18703
 3.16075 3.19613 3.17977 3.19904 3.1716 ]

Usage

The NI DAQ 'cards' must be addressed by their position in the cage. The cage positions are represented in the ASCII art below:

-----------------------------------------------
|             |       |       |       |       |
|  National   |   P   |   P   |   P   |   P   |
| Instruments |   O   |   O   |   O   |   O   |
|             |   S   |   S   |   S   |   S   |
|   NI cDAQ   |   I   |   I   |   I   |   I   |
|             |   T   |   T   |   T   |   T   |
|             |   I   |   I   |   I   |   I   |
|             |   O   |   O   |   O   |   O   |
|  []  USB    |   N   |   N   |   N   |   N   |
|  []  Power  |       |       |       |       |
|             |   1   |   2   |   3   |   4   |
|             |       |       |       |       |
-----------------------------------------------

For example if a thermocouple card is inserted in position 3, you must initalize the reader as

daq = NIDAQThermo(position=2, thermocouple_type='J')

You can read the samples from the card with the following:

data = daq.read_samples()

This code will return a list of values from the card. Thermocouple cards will return eight values, relating to thermocouple channels 0 through 7. Voltage cards will return thirty-two values, relating to channels 0 through 31. You can pull these values into the rest of your code to save or transmit to other parts of your code.

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

NIDAQUSBDriver-0.11.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

NIDAQUSBDriver-0.11.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file NIDAQUSBDriver-0.11.0.tar.gz.

File metadata

  • Download URL: NIDAQUSBDriver-0.11.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for NIDAQUSBDriver-0.11.0.tar.gz
Algorithm Hash digest
SHA256 4887547f1853c8b1879783ebd5df3bc65089ae6ad3d0200d25b93e8e60de6744
MD5 a9a8dbebd4c3b4f318e0581a76b16f38
BLAKE2b-256 20f4853c3aa22f122526f0deb106df708ed7f49c0ec81bc27fd288f1837818fe

See more details on using hashes here.

Provenance

File details

Details for the file NIDAQUSBDriver-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for NIDAQUSBDriver-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c27e578291ec0aca4a2229b73d50b2cbb45590f640b8fbf875b3ea24d38b6418
MD5 846247556d756fb5664b1a9efaba976f
BLAKE2b-256 f994fc37732298cfa21825b596293d7582392b7812ea27f58ecbd643100c79ea

See more details on using hashes here.

Provenance

Supported by

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