NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Low Cost USB DAQ Driver for use with Raspberry Pi®

This USB DAQ Driver is compatible with the NI USB-6008/6009 devices and runs on the Raspberry Pi®. It allows the user to acquire data from an analogue input channel in either a continuous or finite manner, whilst streaming this data to a web service compatible with LabVIEW and Data Dashboard for LabVIEW. The driver is also capable of controlling a user selectable digital line from the Web Service.

Message 1 of 21
(22,196 Views)

Hi Mike

Does this mean that it is possible to capture the NI 6009 data inside the Raspberry Pi. I have an application which has no need for  a web service, I can do the control logic inside teh Raspi.

John

0 Kudos
Message 2 of 21
(5,946 Views)

I also would like to do control logic within the Raspberry Pi. That is, NI USB-6009 plus Raspberry Pi combinaton to monitor some signals from the USB-6009 and process them.

0 Kudos
Message 3 of 21
(5,946 Views)

You can capture the data inside the Raspbberry Pi. Each of the command line interfaces allows you to view the data as it happens so that you can pipe this to your program of choice. The web service is merely an optional extra.

0 Kudos
Message 4 of 21
(5,946 Views)

Hi jbrohan,

I am working on a university project, where I have used NI USB-6009 with raspberry pi. I would like to know application you are using to design the control logic within raspberry pi as I do not want to use the web service on my device.

I need this information urgently.If you can help, that would be great.

0 Kudos
Message 5 of 21
(5,946 Views)

Hi Mike

I just installed the executables 'install_ex.tar' and got it to work. However, it just reads in the +-5 Volt range and also only in differential mode. Can I change that?

We also have a great need for setting the voltages on ports AO 0 and AO 1. As far as I can see, I can not do that with two commands.

It would be great if you could provide the same functionality as in the MAX (which is a great piece of software!)

0 Kudos
Message 6 of 21
(5,946 Views)

if anybody is interested, here is the python code to read the ADCs.

Save it as ni600x.py and import it

import subprocess

import numpy as np

def read(channel=0,nrsamples=1):

          cmdstr = "sudo /usr/local/bin/natinst/rpi/aiondemand -c "+str(channel)+" -s "+str(nrsamples)+" -t 1000 -v"

          proc = subprocess.Popen(cmdstr, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)

          return_code = proc.wait()

          data = np.array([])

          for line in proc.stdout:

                    strg = line.rstrip()

                    strg = strg.rstrip(',')

                    try:

                              nr = float(strg)

                              data = np.append(data,[nr])

                    except:

                              pass

          return data

Message 7 of 21
(5,946 Views)

Hi Mike,

               I was trying to install the driver for Ni DAC in pi, but the shell script didnt work inthe first place. it gives an error (expecting then). then I tried to do the steps manually and , the extraction of the tar files was not working. So i manually extracted them. After installing evrything (as per the install.sh script)  when i try to run the to executables, it doesnt run.  Can you help me in this regard  ?

0 Kudos
Message 8 of 21
(5,946 Views)

With regards to the "unexpected end of file: expecting then" error given by install.sh:

The shell script 'install.sh' downloaded from the NI community website appears to be in DOS format, meaning it terminates lines with CRLF (carriage return + line feed), instead of in UNIX format, which terminates lines with just LF. The Linux shell can't correctly parse the file because it's in the wrong format.

To correctly run the shell script first convert it to unix format by running:

    sudo apt-get install dos2unix

    dos2unix install.sh

0 Kudos
Message 9 of 21
(5,946 Views)

Unfortunately, I am having a different problem - running either program results in the error message "segmentation fault". Does anyone have any idea why this might be happening or what I could try to fix it?

0 Kudos
Message 10 of 21
(5,946 Views)