VI 4
VI 4
                         Virtual Instrumentation
                                (ICPC-404)
VI lect_ notes #4                                                                      Course Coordinator
Data Acquistion fundamentals
NI-DAQ card , interfacing and LabVIEW                                                    Dr Roop Pahuja
Meas I/O functions                                                                     Associate Professor
Data acq. and generation VI programs
Case studies                                                                              Room No. 507
                                                Virtual Instrumentation (ICPC-404)
                                                          Dr. Roop Pahuja
                                                                                     Contact No : 9988651877
                                                                                                         1
                  Data Acquisition ( DAQ)
  DAQ : An Introduction
• Virtual instrumentation combines hardware and software with industry-
  standard data acquisition and computing technologies to create user-
  defined measurement/control solutions
• Data acquisition is one of the component of a real time VI system
  followed by data analysis and presentation
• In a VI system, data acquisition hardware uses driver software compatible
  with LabVIEW to perform real time measurements.
• National Instruments specializes in developing a PC-based general
  purpose or specialized data acquisition hardware and driver software
  compatible with LabVIEW to develop VI systems for real time monitoring
  or control applications
• A general-purpose PC –based DAQ device acquires or generates different
  types of signals on multiple channels for interfacing to real world devices
  or systems signals.
• It is different from other measurement systems because the software
  installed on the computer performs the actual measurements and
  controls the DAQ system.
• The DAQ device converts the incoming signal into a digital signal and
  format the same using communication protocols for computer interface.
   Process               Real-time VI system schematics
 Inputs ( non                                                LabVIEW programming software
 electrical                                                 and driver software for DAQ device
 quantities)
   sensors
                        Data Acquisition
                                                                 General purpose computing
                             device
                                                                           system
                          Multiple I\0
                                                              ( PC desktop\laptop\embedded
                         AI AO DI DO
                                                                          device)
                          Signal types     Comm interface
                                           Serial port             VI application program
 Actuators                                                                   GUI
                                           Parallel port
                                           PCI bus
                                                                                  Interaction with VI system
Output signals to FCE
                                                                                        user
Basic elements of data acquisition card
                                                   Vref and no. of bits selection
PC comm. port
To PC
In order to digitize an input signal with best of the resolution of DAQ device, it is required to select the
device range (Vin_range) to match the input voltage range. By selecting the device range, the gain of
PGA (G) is set automatically to match the input voltage range to the Vref for ADC as given by the
equation:
 Vin_range x G = Vref for ADC
     Given a DAQ device:
     Vref for ADC is fixed = 5V (unipolar or bipolar)
     For analog input signal measurement:
Vin range is selected by the user during configuration of DAQ so that unknown signal is within the
range selected. Then driver software sets value of G for PGA so that the selectable device range
should best match the Vref for ADC
The code width with which the unknown voltage is digitized is given by:
 code_ width = Vref/(G. 2n )
                = device range /2n
                                                   where, device range = Vref/(G)
Q. 1 A typical DAQ uses 10bit ADC with ref of ±5V with bipolar/unipolar selection. The
PGA has gain setting of 0.5, 1, 2, 5,10.
The DAQ software provides the user with selectable unipolar and bipolar signal ranges of
0-10V, 0 to 5V, 0 to 2V, -5 to 5V.
If the system is used to measure the signal that varies in the range 0 to 2 V, find the
appropriate selectable signal range and gain setting of PGA. Also find the code width of
the signal.
    VISA is Standardized software interface to communicate with DAQ hardware using any communication protocol.
Procedure for PC –based data acquisition/measurement in LabVIEW
  Shows the procedure of data acquisition to measure real world signals using DAQ device and LabVIEW
  software: Use of NI DAQ hardware + MAX (utility software) + Driver software + LabVIEW application
  software to acquire/generate data in LabVIEW to interact with real world phenomenon.
                                                                                                 1. Interface
                                                                                             DAQ to PC and signals
                                    2. Test DAQ
                                        MAX
                                       3. Prog DAQ
                                        layer using
                                           driver
                                         functions
                                            DAQ
                                         Assistant
                                          (VI DAQ
                                         program)
Steps for data acquisition in LabVIEW using NI DAQ hardware
Open LabVIEW
 Go to Tool menu
     select MAX to detect and test the device
Open MAX : LabVIEW  Tools  MAX
• Pin configuration of typical DAQ (6015)
    DATA ACQUISITION IN LabVIEW
                   using
    General purpose NI DAQ devices
(NI 6015 (USB); NI 6009 (USB); NI 6221 (PCI))
            and DAQ Assistant
NI-DAQ 6015
Important specifications
 Analog CHs : 16 SE ( signal line +S and Agnd),
                     8 differential ( + S, -S, Agnd)
   Analog output : 2 CHs
   Digital I/O ports : 2 ports , 16 lines ( I/P or O/P).
   Max signal range =  10V, (other selectable ranges) 0-10,  0-5V, 0-5V, 0-1V,
   PGA with different gain settings (0.5 , 1, 2, 5, 10 ), unipolar /bipolar
   ADC Vref =  5V,
   Sampling rate = 200KS/s
   Multifunctional USB based
                                      Analog Inputs   Use AI 0 and AI Gnd for SE connection
Digital lines at port
                                                      Use AI 0 (+)and AI 8 (-) with Agnd for diff
                                                      connection on CH AI 0
                                                        Analog outputs
                        Onboard exc
DAQ device Pin Nos. and Signal names: Pin configuration table represents pin no. and associated signal name
representing signal type and CH no.
AO : Analog o/p
  AO 0 to AO 1
 Exc : 5V , 2.5 V
               Study of driver layer functions for data acquisition in LabVIEW
(a) DAQ Assistant (express VI) Fn. Palette  Meas I/O  DAQmx  DAQ Assistant
Is a driver layer function available as an express VI that allows one to configure the connected DAQ device to read or write
signals from specified channel/s. Common configuration parameters are: DAQ device no., signal type (analog or digital),
mode (data read or write) , CH no. (one or add multiple channels), voltage range, timing parameters.
Converts the dynamic data to numeric or Boolean scalar/array data types for use with other VIs
  Converts the numeric , Boolean data to dynamic data types for use with express VI for data
  acquisition DAQ
DAQ VI programs : Reading and writing signals to different CH of DAQ
               V Power
                supply
                   +    -
       Analog voltage
Device connected
(ii) To make a VI : Place DAQ Assistant on BD and configure it
 Select Device : Daq 6015 (dev1)
 Select acq mode : Acquire or generation
signal type : Analog input
 Select Ch no. : AI 0
Select CH mode : RSE
Voltage range : ± 10V
 Select sample mode : Sample on demand
      Click OK….. Wait …… DAQ Ass builds…. Data
       Terminal is available
(iii) Complete VI program with while loop, voltage
      indicator and a waveform chart
   Voltage
   Indicating
   meter
                -   +
 (ii) To make a VI : Place DAQ Assistant on BD and configure
it
 Select Device : DAQ 6015 (dev1)
Select acq mode : Generation
 Select signal type : Analog output
 Select Ch no. : A0 0
 Voltage range : 0 to 10V
 Select sample mode : Sample on demand
       Click OK….. Wait …… DAQ Ass builds…. Data
        Terminal is available
(iii) Complete VI program :
     Generate analog output voltage at output
+ 250ohm
Mechanical switch
5V
• To read mixed signals from DAQ, Use DAQ Assistant for each signal type .
  ADD Chs if multiple signals of same signal type are required.
• If the operation is not providing sequencing in the use of DAQ Assistants
  for different signals types then use of Sequence structure for different
  DAQ Assisstant (example reading AI and DI) , otherwise don’t use
  sequence. ( AI and DO)
(e) Make a VI program that reads multiple analog inputs from different channels.
 Then go to < ADD channel> tab and select another channel .. Ai1 etc ---- , click OK
Use AI0 and AI2 Chs reading SE signal but configured as diff
         +
   V1
         +
    V2
Make a VI program that reads SE analog voltage signal from channel AI0 of DAQ NI-
6009 . If the signal value exceeds the alarm limit of 6V, LED alarm connected to
DAQ channel P0.1 is activated. Show the physical connection diagram and DAQ
configuration
Q.2 Make a VI program to read voltage from analog input channel AI0, AI1, AI2
after 5s of time interval until STOP button is pressed and display time- variations of
voltages on a chart. Also log the voltage samples in a file.
Q.3 Make a VI program to blink LED connected to PO.2 digital line of DAQ NI-6009.
    The blinking rate is selected by the user through the front panel.
• Industrial Application
• CASE Study 1: PC based VI system for
                Temperature Monitoring and
                  Logging
Problem 1
Make a VI program to continuously monitor room temperature until STOP button is pressed using LM35
smart temperature transducer. Interface the temp sensor with NI-6015 DAQ card and draw the
interfacing diagram.
Display the temperature variations on chart and log the readings
      Procedure:
      Do physical interfacing : Provide excitation of 5V to sensor from
       DAQ AO0 and connect sensor output to analog input channel AI2
      Make VI program
      Use three frame sequence structure VI :
       Seq structure : Frame 1 : Configure DAQ Asst. to write analog
       voltage value of 5V to AO0
       Seq structure : Frame 2 : Use wait fn with 20ms wait time to
       stabilize excitation signal for sensor to take reading.
• Seq structure : Frame 3 : Configure DAQ Asst. to read sensor
  voltage signal at ch AI0
    Convert sensor voltage to Temp in C using S value of 10mV/C.
        Display temp
        log time-temp data in file,
        Analyse temp value for to activate alarms .
        Display alarms
       For continuous monitoring use outer while loop with time interval of 1s
       and Stop button
Interfacing LM 35 to NI DAQ card using excitation signal from DAQ
                                                         AI0
                                                         AI0
                                                         AI8
                                                        Agnd
                                          +5 V          AO0
                                                        AO gnd
                                          Gnd
                                                       DAQ 6015
Exc from DAQ A0 0
SubVI
Problem (contd..)
      Main VI
          Problem (contd..)
Main VI
Web Publishing Tool In LabVIEW
Use the Web Publishing Tool to create an HTML document and embed
static or animated images of the VI front panel so a client
• computer can view and monitor the front panel remotely.
• embed a front panel in an HTML document so a client computer can
  view and control the front panel remotely.
To link this VI front panel to a web broswer --- follow the procedure as shown in the screen shots
Step first is to open LabVIEW web server
• To view or control a VI on a web browser, a Web Sever must be
  configured appropriately and a HTML file must be generated. The
  following steps show how this can be done:
  If the VI is running on the host PC…….the value of random temperature are appended on the chart as seen
Use the URL of the VI and enter in web Browser
• This opens VI front panel html dynamic page – data is updated
• Note : At times there may be plug in error if web browser is viewed
  using WiFi