NI Labs Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

Low Cost USB DAQ Driver for use with Raspberry Pi®

Introduction

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.

Requirements

  • NI USB-6008/6009 running the DAQmx Base Firmware (Instructions available here)
  • Powered USB Hub (if using a model before the 512MB version of Raspberry Pi® for the NI USB-6008/6009)
  • Raspberry Pi® running Wheezy Raspbian

Installation Instructions

  1. Copy the attached files to your home directory on the Raspberry Pi®, preferably via FTP or a USB stick
  2. Ensure your Raspberry Pi® is connected to the internet, it requires Lighttpd to run the web services which it must download and configure
  3. Run “sudo sh install.sh”
  4. Connect your USB-600x to the Raspberry Pi®, you may require a powered hub to provide enough power (unless you have the 512MB revision)

Note: If you are already running  a web server on your Raspberry Pi®, you will need to set Lighttpd to run on a port other than 80, edit this in the lighttpd.conf file on the line server.port = 80.

Please note that you will have to change the discovery port when you use Data Dashboard for LabVIEW if this is the case.

Running

Run the programs located in /usr/local/bin/natinst/rpi, you must run these as root:

     a.     ./600x – Allows you to select the analogue channel you wish to continuously read from and the digital out line you want to control the output of. This is the demo shown at NIDays UK 2012

Usage: ./600x -c 0 -t 10000 -l 6

         -c : Channel Number, 0 indexed that you wish to read from

         -t : Timeout in ms, timeout of the device before erroring

         -l : Digital line to output on, 1 indexed for Port 0 only

Example: ./600x -c 0 -t 10000 -l 6

Acquire data on channel 0 and link to the digital line 6 on port 0

     b.      ./aiondemand – Allows you to read a set number of samples on demand and output to the console and web services as requested.

Usage: ./aiondemand -c 0 -s 500 -t 10000 -v -w

         -c : Channel Number, 0 indexed that you wish to read from

         -s : Samples to fetch, limited to 500 or less when on demand

         -t : Timeout in ms, timeout of the device before erroring

         -v : Verbose, output to terminal window

         -w : WebServices, output to Web Service for Data Dashboard

Example: ./aiondemand -c 0 -s 500 -t 10000 -v -w

Acquire 500 samples on demand on AI channel 0 and output this to Terminal and Web Services


Run Data Dashboard on the iPad and add a new Web Service. Add in the IP Address of your Raspberry Pi® and select port 80 (if you changed the port in the Lighttpd conf file, change it here too)

There is an example Data Dashboard file included here (the one used at NIDays UK 2012).

rpiscreenshot.png

Raspberry Pi® is a trademark of the Raspberry Pi® Foundation

Applications Engineer
Comments
dsehguht
Member
Member
on

will this work without internet connection? 

I would rather do a direct ethernet connection from RPi to my PC.

ccrainutk
Member
Member
on

Sudo sh install.sh runs, but after "Checking Permissions..." I get the syntax error "end of file unexpected (expecting "then")

Any clue what would cause this and how to fix it?

 

nm... Just opened up the file and ran the commands manually

now I'm getting a Segmentation fault when running the programs

wegunterjr
Member
Member
on

What are the chances this can work with http://www.ni.com/en-us/support/model.usb-6001.html    Is this driver open source?   Can I make any mods to it if needed?

mustermaxmann
Member
Member
on

Would love to get an answer to the question above!

ste.woods
Member
Member
on

I have followed all the step on my R PI 3

 

I am using the USB-6009

 

When rinning the command: ./600x -c 0 -t 10000 -l 6

 

it returns with

 

Detected NI USB Devices

---------------------------------------------

 

Confirm:           USB0::0x3923::0x0000::::RAW

Segmentation fault

 

Can anyone help me get this working. 

Thanks

 

 

william612
Member
Member
on

@ste.woods

I followed the step, and succeed. There is some tips for you. I hope that might be helpful.

Firstly, connect USB-6009 to a USB HUB which has extra power. This could solve the problem,  which is cause of  low current.

 

Then, make sure the firmware of USB-6009 is NI-DAQmx Base version, generally that would be NI-DAQmx version. The Instruction is as follows: http://digital.ni.com/public.nsf/allkb/1448A8AC665EE0EA8625703F004A4410?OpenDocument

 

hannesa
Member
Member
on

 Hi,

I just got the NI USB-6009 working with an RPi3 under "Stretch". The biggest problem I had was updating the Firmware to NI-DAQmx Base. My Laptop showed the 6009 as NI-DAQmx Base Device, but it did not work, i had to update the firmware (The tools in the linked article did not work [Error 7 if I remember right], but you will find another version of the tool in your installation direction [same name, different size]. With this tool I got the Firmware updated).

 

Where do I change the Input mode between DIFF and RES? Do i have to set it up at my laptop or are you only able to use on of the modes with the raspberry? Which mode can I use?

 

And is there any more work done on the driver for the raspberry pi? I am missing an option to set the scan rate and read more channels simultaniously. (I am not really hopefull, since the article was last updated in early 2017).

 

Thanks and regards!

 

 

mariana_guez
Member
Member
on

Can I edit the programs? or Make my own program? Which programming language is? I want to send the continuously read to the serial port or just know where can I take the digital data to use into other code?. Thank you.

TheTimon
Member
Member
on

I am hoping someone is actually looking at these forums. I am trying to use Raspberry Pi as a master which can control the NI DAQ(NI 6341 USB). Is this still an active thread? Looks like it was from 2012 and updated on 2017. Is this the only documentation that NI Provides for arm based linux platforms(RPi)? I hope someone from NI looks at this and give us some clear direction.


Thank you.

Contributors