LabView instrumentoinnissa, 55492,...

37
Course contents 1. Labview basics virtual instruments, data flow, palettes 2. Structures for, while, case, ... editing techniques 3. Controls&Indicators arrays, clusters, charts, graphs 4. Additional lecture State machines, SubVIs, MainCluster 5. Modular programming + recording SubVIs File I/O Analysis Signal processing Communication between loops 6. Instrument control DAQ , Data collection, GPIB, Serial 7. Additional lecture Data Acquisition, Instrument control

Transcript of LabView instrumentoinnissa, 55492,...

Page 1: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Course contents

1. Labview basics– virtual instruments, data flow, palettes

2. Structures– for, while, case, ...– editing techniques

3. Controls&Indicators– arrays, clusters, charts, graphs

4. Additional lecture– State machines, SubVIs, MainCluster

5. Modular programming + recording– SubVIs– File I/O– Analysis– Signal processing– Communication between loops

6. Instrument control– DAQ , Data collection, GPIB, Serial

7. Additional lecture– Data Acquisition, Instrument control

Page 2: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •
Page 3: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •
Page 4: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •
Page 5: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Most common signal conditioning

• Amplification

Page 6: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Signal Sources

• Grounded Signal– referenced to system ground (earth, building ground)

– example: devices that plug into building ground through wall outlets (e.g. signal generator)

– be aware of ground loops: Two independently grounded signal sources are generally not at the same potential

Page 7: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Signal Sources

• Floating signal– not referenced to any common ground

– for example batteries, thermocouples

Page 8: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Measurement systems

• Differential measurement– measuring with respect to floating

ground

– neither of the inputs tied to fixed reference (building ground)

Page 9: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Measurement system

• Referenced single-ended– measurement with respect to building ground

Page 10: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Measurement system

• Nonreferenced single-ended– all measurement with respect to a common reference

Page 11: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

What system to use?

• In general, differential measurement system is preferable

• Differential measurement rejects ground loops and noise from the environment

• Single-ended measurements allow twice as many channels as differential

• Use single-ended only if you have all of the following:– high-level signals (normally, greater than 1V, so that the induced errors

are lower than the required accuracy)

– short or properly-shielded cabling (normally, less than 3 m)

– all signals can share commmon reference signal at the source

• Do not use referenced single-ended connections with ground-referenced signal sources (ground loops!)

Page 12: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

What system to use?

• The noise rejection with non-referenced single-ended mode is better than referenced single-ended

• Differential is better than non-referenced single-ended mode (AISENSE connection is shared with all channels)

Page 13: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Connections

• See the user manuals for more information– e.g. USB-6210

http://www.ni.com/pdf/manuals/371931f.pdf

Page 14: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

• Differential • Referenced single-ended

• Non-referenced single-ended

Page 15: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Multichannel scanning considerations

• Multiplexer switches from one AI channel to the next

• Instrumentation amplifier has to settle to the new input range

• Settling time: time it takes the amplifier to amplify the input signal to the desired accuracy before it is sampled

Page 16: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

For fast settling times:

• Use low impedance sources– accumulated charge in multiplexer capasitor leaks through from

previous to the next channel when switching between channels (ghosting)

• Carefully choose the scanning order– avoid switching from large to small input range

– scan grounded channel between signal channels: improves settling time

– even with the same input range selected, if you know the expected signal levels, group the similar expected ranges together in your scanning list

– If it’s not necessary to switch between channels, scan for example 100 samples from the first channel and only then switch to second channel and scan 100 samples

Page 17: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

For fast settling times:

• Avoid scanning faster than necessary– more time to settle

– example: You need to scan 10 channels over a period of 20 ms average the result. Even if scanning with 250 kS/s gives more samples and therefore improves the standard error of the mean, scanning with 125 kS/s gives more settling time and can in some cases give more accurate results.

Page 18: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Analog input circuitry

Page 19: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Analog-to-Digital Converter (ADC)

• Resolution – number of bits in your ADC– Example: 3-bit ADC divides the measurement range to 23 = 8 divisions

With 16-bits you have 65536 divisions

Page 20: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Analog-to-Digital Converter (ADC)

• Device Range– minimum and maximum analog signal levels the device can digitize

Page 21: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Analog-to-Digital Converter (ADC)

• Code Width– smallest detectable change in the signal, i.e. resolution

– for example: 16-bit resolution, range from -10 to +10V

code width = 20 V/2^16 = 305 µV

– Nominal resolution is worse due to the calibration method of the device

(bits) resolution2

range device width code

Page 22: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Sampling rate

• How often A/D conversion takes place

• Aliasing is a result of too low sampling rate

• Nyquist theorem– sampling rate has to be at least twice the measured frequency to

accurately represent the signal

– Nyquist frequency = Sampling frequency/2

Page 23: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Sampling rate

• Example: Sampling rate 100 S/s; signal at 25 Hz is measured correctly but signals at 70 Hz, 160 Hz and 510 Hz are aliased to 30 Hz, 40 Hz, and 10 Hz

Page 24: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Hardware vs Software timing

• Timing source can be on hardware or on software– on hardware a clock on the device determines the timing

– on software the program loop determines the timing

• Hardware timing is more accurate and faster

Page 25: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Analog output

• Digital-to-Analog conversion

– generate analog signal from computer

• Single point update

– software timed generation

– change the output value everytime the program calls the VI

• Buffered analog output

– hardware timed generation

– upload a waveform to the device and set the update rate of the device to go through the points

Page 26: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Digital I/O

• Two states: – high and low

• Control digital or finite state devices– switches, LEDs

• Program devices or communicate between devices– Example: Digital frequency generator takes 30-bit control word which

defines the generated frequency – use digital output ports of a DAQ-device to generate this word

Page 27: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Wirings

• USB-6008

Page 28: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Instrument Control

• GPIB

• Serial port

• Image Acquisition

• USB

• Ethernet

• Parallel port

Page 29: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

GPIB

• General Purpose Interface Bus (GPIB)– a.k.a HP-IB, IEEE 488

• GPIB is usually used in stand alone bench top instruments to control measurements and communicate data– supported by many instrument manufacturers

• Digital, 24-conductor, 8-bit parallel communication interface

• 16 signal lines, 8 ground return lines– 8 data lines: data sended in bytes

– 3 handshake lines: control the transfer of messages

– 5 interface management lines

• Data transfer rate typically 1Mbyte/s

• IEEE 488.1 and 488.2 define standards for GPIB

Page 30: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

GPIB

• GPIB configurations– you can have multiple devices

connected to the same computer

• Device groups– Talker

– Listener

– Controller

Page 31: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

GPIB

• GPIB has one (active) controller that controls the bus– usually this is the computer

– it connects the talkers to listeners

• Physical requirements– maximum separation between two devices 4 m (for high-speed use

only 1 m)

– maximum total cable length 20 m

– maximum of 15 devices on a bus (at least 2/3 turned on)

Page 32: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Serial Port Communication

• Communicate with only one device

• No need to buy additional hardware like with GPIB (although modern computers don’t always have RS-232 port anymore)

• Send data one bit at a time– you can have long distance between devices

– data transfer rate is low

Page 33: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Serial Port Communication

• Before communication you need to define– baud rate

– number of data bits for a character

– parity bit

– number of stop bits

• Two voltage stages– positive > 3V

– negative < -3V

– area between +3V and -3V is designed to absorb noise

Page 34: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Instrument Drivers

• Software to control a particular instrument

• VISA – Virtual Instrument Software Architecture– library for controlling GPIB, serial, Ethernet, USB, or VXI instruments

• Example: Agilent 34401 Digital Multimeter

Page 35: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Instrument Drivers

• Download from ni.com

• Help >> Find Instrument Drivers– requires login

Page 36: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Instrument Drivers

• After installation the drivers can be found from functions palette

Page 37: LabView instrumentoinnissa, 55492, 3opelectronics.physics.helsinki.fi/wp-content/uploads/2011/... · 2017. 3. 16. · resolution2 (bits) device range code width . Sampling rate •

Links

• User manual for M-series USB-621x– http://www.ni.com/pdf/manuals/371931f.pdf

• Labview data-aquisition manual– www.ni.com/pdf/manuals/320997e.pdf

• Labview Measurement Manual– http://www.ni.com/pdf/manuals/322661b.pdf

• Understanding Instrument Specifications– http://zone.ni.com/devzone/cda/tut/p/id/4439#2

• Ghosting in multichannel sampling– http://digital.ni.com/public.nsf/allkb/73CB0FB296814E2286256FFD00

028DDF?OpenDocument