Top Banner
Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01 NI USB-6008 DAQ Device HANSPETTER HALVORSEN, 2013.08.16
24

Ni Usb-6008 Daq Device

Jul 21, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ni Usb-6008 Daq Device

 

Telemark  University  College  Department  of  Electrical  Engineering,  Information  Technology  and  Cybernetics  

Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01

 

 

 

 

 

 

 

NI USB-6008 DAQ Device HANS-­‐PETTER  HALVORSEN,  2013.08.16  

 

 

Page 2: Ni Usb-6008 Daq Device

ii  

 

Table of Contents Table  of  Contents  ....................................................................................................................................  ii  

1   Introduction  ......................................................................................................................................  1  

2   System  Description  ...........................................................................................................................  2  

2.1   Documentation  .........................................................................................................................  3  

3   Configuration  ....................................................................................................................................  4  

3.1.1   Testing  the  USB-­‐6008  in  MAX  ............................................................................................  4  

3.2   Creating  Tasks  ...........................................................................................................................  9  

4   Using  NI  USB-­‐6008  in  LabVIEW  .......................................................................................................  10  

4.1   DAQ  Assistant  ..........................................................................................................................  11  

4.1.1   Analog  Input  .....................................................................................................................  11  

4.1.2   Analog  Output  ..................................................................................................................  18  

 

Page 3: Ni Usb-6008 Daq Device

1  

   

1 Introduction NI  USB-­‐6008  is  a  simple  and  low-­‐cost  multifunction  I/O  device  from  National  Instruments  that  will  be  used  in  Lab  Work  at  Telemark  University  College  (TUC).  

The  NI  USB-­‐6008  is  a  USB  based  data  acquisition  (DAQ)  and  control  device  with  analog  input  and  output  and  digital  input  and  output.    

Page 4: Ni Usb-6008 Daq Device

2  

   

2 System Description NI  USB-­‐6008  is  a  simple  and  low-­‐cost  multifunction  I/O  device  from  National  Instruments.  

 

The  device  has  the  following  specifications:  

• 8  analog  inputs  (12-­‐bit,  10  kS/s)  • 2  analog  outputs  (12-­‐bit,  150  S/s)  • 12  digital  I/O  • USB  connection,  No  extra  power-­‐supply  neeeded  • Compatible  with  LabVIEW,  LabWindows/CVI,  and  Measurement  Studio  for  Visual  Studio  .NET  • NI-­‐DAQmx  driver  software    

 

The  main  features  of  NI  USB-­‐6008  are  as  follows:  

• Analog  input  (AI):  8  inputs  with  referenced  single  ended  signal  coupling  or  4  inputs  with  differential  signal  coupling.  Software-­‐configurable  voltage  ranges:  ±20V,  ±10V,  ±5V,  ±4V,  ±2.5V,  ±2V,  ±1.25V,  ±1V.  Max  sampling  rate  is  48kS/s  (48000  samples  per  second).  12  bits  AD  converter.    

• Analog  output  (AO):  2  outputs.  Voltage  range  is  0  -­‐  5V  (fixed).  Output  rate  is  150Hz  (samples/second).  12  bits  DA  converter.    

• Digital  input  (DI)  and  digital  output  (DO):  12  channels  which  can  be  used  as  either  DI  or  DO  (configured  individually).  These  12  channels  are  organized  in  ports,  with  Port  0  having  lines  0,  ..,  7,  and  Port  1  having  lines  0,  ..,  3.  Input  low  is  between  -­‐0.3V  and  +0.8V.  Input  high  is  between  2.0V  and  +5.8V.  Output  low  is  below  0.8V.  Output  high  is  above  2V.    

Page 5: Ni Usb-6008 Daq Device

3     System  Description  

Lab Equipment: NI USB-6008 DAQ Device

 

• Counter:  32  bits.  Counting  on  falling  edge.    • On-­‐board  voltage  sources  (available  at  individual  terminals):  2.5V  and  5.0V    • Power:  USB-­‐6008  is  powered  via  the  USB  cable.    

 

 

You  may  use  different  Development  Software  when  working  with  the  NI  USB-­‐6008  device,  e.g.,  LabVIEW,  C,  or  Visual  Studio.    

You  may  also  use  the  device  on  different  Platforms,  such  as  Windows,  Mac  and  Linux.    

This  document  will  focus  on  using  LabVIEW  for  Windows.    

2.1 Documentation

The  documentation  for  the  NI  USB-­‐6008  DAQ  device  is  as  follows:  

• NI  USB-­‐6008  Data  Sheet  • NI  USB-­‐6008  User  Guide  • NI-­‐DAQ  mx  for  USB  Devices  

These  documents  are  available  from  www.ni.com  or  from  my  Blog:  http://home.hit.no/~hansha/  

 

Page 6: Ni Usb-6008 Daq Device

4  

   

3 Configuration Configuring  and  testing:  USB-­‐6008  can  be  configured  and  tested  using  MAX  (Measurement  and  Automation  Explorer),  which  is  installed  with  the  NI-­‐DAQmx  Driver  Software.    

The  first  time  you  connect  the  USB-­‐6008  to  the  PC,  the  Windows  Hardware  Installer  Wizard  will  open.  

The  wizard  searches  the  PC  for  the  necessary  driver  software  for  the  USB-­‐6008.  This  driver  software  was  installed  along  with  the  installation  of  the  NI-­‐DAQ  software.  When  the  wizard  has  finished  the  installation  of  the  driver  software,  the  USB-­‐6008  is  ready  for  use.  

3.1.1 Testing the USB-6008 in MAX

Before  you  start  to  use  the  USB-­‐6008  in  an  application,  you  should  test  the  device  in  the  Measurement  and  Automation  Explorer  (MAX).  

 

 

In  the  MAX  window,  expand  the  “Devices  and  Interfaces”  node  and  then  “NI  DAQmx  Devices”.  Right-­‐click  on  the  NI  USB-­‐6008  device  and  select  “Self-­‐Test”.  

Page 7: Ni Usb-6008 Daq Device

5     Configuration    

Lab Equipment: NI USB-6008 DAQ Device

 

Hopefully  the  self-­‐test  passes  without  errors.  Then,  you  should  test  the  individual  channels  of  the  USB-­‐6008  to  check  that  the  input  signals  are  detected  correctly  by  the  USB-­‐6008,  and  that  the  output  signals  generated  by  the  USB-­‐6009  have  correct  values.  This  I/O  can  be  tested  in  several  ways,  depending  on  which  channels  you  actually  want  to  test.    

We  will  perform  a  simple  loopback  test:  

Here,  let  us  test  analog  output  channel  0  (AO0)  and  the  analog  input  channel  0  (AI0)  to  see  if  they  work  correctly.  We  will  perform  a  very  simple  test,  which  is  sufficient  if  we  are  to  check  that  both  AO0  and  AI0  work  correctly.  The  test  procedure,  which  is  denoted  loopback,  is  to  connect  the  AI0  channel  to  the  AO0  channel.  Then  we  generate  some  legal  voltage  at  AO0.  If  AI0  detects  the  same  voltage,  we  know  that  both  AO0  and  AI0  work.  (We  may  then  repeat  this  procedure  for  other  channels.)  If  for  some  reason  AI0  detects  some  other  voltage  than  the  value  we  set  for  AO0,  then  there  is  an  error  in  either  the  AI0  channel  or  in  the  the  AO0  channel,  and  further  investigations  are  necessary.  

To  prepare  for  the  loopback  test,  we  wire  together  AI0  and  AO0.  To  see  the  terminals  of  the  USB-­‐6000,  select  “Device  Pinouts”  from  the  right-­‐click  menu.  

Page 8: Ni Usb-6008 Daq Device

6     Configuration    

Lab Equipment: NI USB-6008 DAQ Device

 

The  Figure  shows  the  AI0  and  AO0  channels  wired  together.  

Page 9: Ni Usb-6008 Daq Device

7     Configuration    

Lab Equipment: NI USB-6008 DAQ Device

 

To  actually  perform  the  loopback  test,  right-­‐click  on  the  NI  USB-­‐6008  device  in  MAX,  and  then  select  “Test  Panels..”  in  order  to  open  the  Test  Panels.  In  the  Test  Panels  window,  select  the  Analog  Output  tab.  

 

Figure 11: The Voltage Output dialog window in the Test Panels window

In  the  Analog  Output  tab,  select  any  voltage  between  0V  and  5V.    

Next,  click  the  Analog  Input  tab  in  the  Test  Panels  window.  

Page 10: Ni Usb-6008 Daq Device

8     Configuration    

Lab Equipment: NI USB-6008 DAQ Device

 

The  Analog  Input  tab  should  indicate  the  same  (or  almost  the  same)  voltage  as  is  set  out  on  AO0.  There  may  be  a  small  difference  between  the  values  due  to  the  limited  resolution  in  the  DA-­‐converter  (digital-­‐to-­‐analog)  and  in  the  AD-­‐converter  (analog-­‐to-­‐digital).  

   

Page 11: Ni Usb-6008 Daq Device

9     Configuration    

Lab Equipment: NI USB-6008 DAQ Device

 

3.2 Creating Tasks

In  general,  a  task  represents  the  configuration  of  the  signal  input  or  signal  output  operation  to  be  executed  by  the  I/O  device.  Creating  tasks  is  a  general  feature  of  the  MAX  utility,  i.e.,  tasks  are  used  also  for  configure  other  I/O  devices  than  the  USB-­‐6008.  

In  general,  a  task  can  contain  one  or  more  global  or  local  virtual  channels,  and  one  such  virtual  channel  is  based  on  one  physical  channel  (having  e.g.  a  screw  terminal  on  the  I/O  device).  A  local  virtual  channel  exists  only  within  its  parent  task,  while  a  global  virtual  channel  may  be  used  in  several  tasks.  If  a  global  channel  is  reconfigured,  all  tasks  which  involve  that  global  channel  are  updated  accordingly.  

In  the  following  it  described  how  to  create  tasks  for  the  analog  input  and  the  analog  output  operations.  These  tasks  may  be  referred  to  in  the  application  program,  e.g.  LabVIEW.    

 

 

Page 12: Ni Usb-6008 Daq Device

10  

 

4 Using NI USB-6008 in LabVIEW

In  order  to  use  the  NI  USB-­‐6008  in  LabVIEW  you  need  to  use  the  DAQmx  functions,  see  Figure  below.  

 

 

DAQmx  –  Data  Acquisition  palette:  

Page 13: Ni Usb-6008 Daq Device

11     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

4.1 DAQ Assistant

The  easiest  ways  is  to  use  the  DAQ  Assistant.  

4.1.1 Analog Input

When  you  drag  the  DAQ  Assistant  icon  on  your  Block  Diagram,  the  following  window  appears:  

 

In  this  window  you  need  to  select  either  “Acquire  Signals”  (i.e.,  Input  Signals)  or  “Generate  Signals”  (i.e.,  Output  Signals).  

Page 14: Ni Usb-6008 Daq Device

12     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

Select  Acquire  Signals  →  Analog  Input  →  Voltage.  

 

In  the  next  window  you  select  which  Analog  Input  you  want  to  use.  Select  ai0  (Analog  Input  channel  0)  and  click  Finish.  

 

The  following  window  appears:  

Page 15: Ni Usb-6008 Daq Device

13     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

In  the  Timing  Settings  Select  “1  Sample  (On  Demand)”.  

Page 16: Ni Usb-6008 Daq Device

14     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

 

The  next  step  is  to  select  the  Signal  Input  Range.  A  common  signal  is  0-­‐5V.  

 

 

You  may  also  rename  the  name  of  the  channel  (right-­‐click  on  the  name):  

Page 17: Ni Usb-6008 Daq Device

15     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

 

 

You  are  now  finished  with  the  configuration.  Click  OK  in  the  DAQ  Assistant  window  The  DAQ  Assistant  icon  appears  on  the  Block  Diagram:  

 

 

 

 

Page 18: Ni Usb-6008 Daq Device

16     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

Example:  

Wire  the  data  output  to  a  numeric  indicator  like  this  (and  hit  the  Run  button):    

 

Then  numeric  indicator  will  show,  e.g.,  the  following  value:    

 

 

Example:  

If  you  want  a  continuous  acquisition,  put  a  While  loop  around  the  DAQ  Assistant  like  this:  

 

However  you  should  not  use  the  DAQ  Assistant  inside  a  loop  because  of  the  lack  of  performance.  The  following  is  therefore  better:  

Page 19: Ni Usb-6008 Daq Device

17     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

In  this  example  we  have  used  some  of  the  other  Vis  in  the  DAQmx  paletter  as  well.  

The  Front  Panel  may  loook  like  this.  

 

In  this  example  we  assume  that  we  connect  wires  for  Analog  Out  and  Analog  In  together  like  this  (a  socalled  loopback  test):  

Page 20: Ni Usb-6008 Daq Device

18     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

 

An  alternative  method  without  using  the  DAQ  Assistant  is  follows:  

 

For  more  advanced  applications  this  is  the  recommended  approach.  

[End  of  Example]  

4.1.2 Analog Output

Analog  Output  is  similar.  

Page 21: Ni Usb-6008 Daq Device

19     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

 

 

 

Page 22: Ni Usb-6008 Daq Device

20     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

Example:  

 

Or  inside  a  loop:  

Page 23: Ni Usb-6008 Daq Device

21     Using  NI  USB-­‐6008  in  LabVIEW    

Lab Equipment: NI USB-6008 DAQ Device

 

 

An  alternative  method  without  using  the  DAQ  Assistant  is  follows:  

 

For  more  advanced  applications  this  is  the  recommended  approach.  

[End  of  Example]  

 

Page 24: Ni Usb-6008 Daq Device

 

 

 

 

 

Telemark  University  College  

Faculty  of  Technology  

Kjølnes  Ring  56  

N-­‐3918  Porsgrunn,  Norway  

www.hit.no  

 

 

 

Hans-­‐Petter  Halvorsen,  M.Sc.  

Telemark  University  College  

Faculty  of  Technology  

Department  of  Electrical  Engineering,  Information  Technology  and  Cybernetics  

 

 

E-­‐mail:  [email protected]  

Blog:  http://home.hit.no/~hansha/  

Room:  B-­‐237a