Computerized Measurement...

8
Elektrisk Mätteknik, LTH Computerized Measurement systems 1. Introduction to Computerized measurements systems By Tomas Jansson, some text excerpts from NI application note AN007 regarding signal conditioning, illustrations from ni.com, tektronix.com, apple.com, computerboards.com, and agilent.com Lund 09-08-31

Transcript of Computerized Measurement...

Page 1: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Elektrisk Mätteknik, LTH

Computerized Measurement systems

1. Introduction to Computerized measurements systems

By Tomas Jansson, some text excerpts from NI application note AN007 regarding signal conditioning, illustrations from ni.com, tektronix.com, apple.com,

computerboards.com, and agilent.com

Lund 09-08-31

Page 2: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Introduction Basically, a ``measurement system'' as defined in this course, will consist of a transducer

that senses some physical parameter, and accompanying hard- and software which is needed to produce a simple and comprehensive presentation for the user. Actually, the transducer itself will not be treated here, and we will study the possible paths the so provided electrical signal can take before being presented.

A first example of such a measurement system is shown in Fig. 1. A physical parameter is sensed by a transducer. The purpose of the transducer is to convert the physical quantity into an electrical signal. The signal is then passed through a signal-conditioning unit, which purpose is to optimize for the input range of the data acquisition module. Signal conditioning accessories can amplify low-level signals, and then isolate and filter them for more accurate measurements. In addition, some transducers require voltage or current excitation to generate a voltage output. The data acquisition module can be a plug-in board for a desktop computer, or other devices that hook up to for instance the USB-port. Finally the digitized signal is transferred to the computer for further analysis and presentation. Note how data is only transferred one way.

Figure 1: Basic configuration for a data acquisition system. The example of Fig. 2 is somewhat more complex. Here, external instruments are used to

both generate an exciting signal, and to sense the parameter in question. The example shows ultrasound measurements of blood perfusion, where sound is emitted from the transmitter (“Transm”) and received on the other transducer (“Rec”). It is an example of an experimental setup where the transmitted frequency can be varied, and the result read in on the oscilloscope. The user can set either the frequency, or control setup parameters of the oscilloscope. The two-way communication can be accomplished with a bus system connecting the instruments with the computer, such as GPIB, USB or other systems, which will be discussed later. This text will provide you with an overview of possible ways a measurement system can be configured.

Figure 2: A slightly more complex data acquisition system.

Page 3: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Signal Conditioning As mentioned above, the purpose here is to optimize the input signal to the data

acquisition hardware. Typical examples of necessary steps are given below: Amplification – The most common type of conditioning is amplification. Low-level

thermocouple signals, for example, should be amplified to increase the resolution and reduce noise. For the highest possible accuracy, the signal should be amplified so that the maximum voltage range of the conditioned signal equals the maximum input range of the analog-to-digital converter (ADC). For example, thermocouples have maximum voltage swings over their entire working range that are only in the order of millivolts. Normally, ADCs accept voltages that vary between 0 to 5 Volts. If the ADC have for instance 10 bits, that is convert each voltage level to a 10-bit number, we see that the possible number of levels are 210=1024, meaning that the smallest voltage step that can be distinguished is 5/1024 V, just less than 5 mV. For most thermocouples this voltage change corresponds to a couple of hundred degrees. Thus, without amplification, the thermocouple/data acquisition unit is not very sensitive.

Isolation – Another common application for signal conditioning is to isolate the transducer signals from the computer for safety purposes. The system being monitored may contain high-voltage transients that could damage the computer. An additional reason for needing isolation is to make sure that the readings from the plug-in DAQ board are not affected by differences in ground potentials or common-mode voltages. When the DAQ board input and the signal being acquired are each referenced to “ground,” problems occur if there is a potential difference in the two grounds. This difference can lead to what is known as a ground loop, which may cause inaccurate representation of the acquired signal, or if too large, may damage the measurement system.

Multiplexing – A common technique for measuring several signals with a single measuring device is multiplexing. The ADC samples one channel, switches to the next channel, samples it, switches to the next channel, and so on. Because the same ADC is sampling many channels instead of one, the effective sampling rate of each individual channel is inversely proportional to the number of channels sampled.

Filtering – The purpose of a filter is to remove unwanted signals from the signal that you are trying to measure. A noise filter is used on DC-class signals such as temperature to attenuate higher frequency signals that can reduce the accuracy of your measurement. Typically, for such measurements, 4 Hz to 10 kHz lowpass filters are common to eliminate noise before the signals are digitized by the DAQ board. AC-class signals such as vibration often require a different type of filter known as an antialiasing filter. Like the noise filter, the antialiasing filter is also a lowpass filter; however, it must have a very steep cutoff rate, so that it almost completely removes all frequencies of the signal that are higher than the input bandwidth of the board. If the signals were not removed, they would erroneously appear as signals within the input bandwidth of the board. Normally, anti-aliasfilters are not built into data acquisition modules, but must be provided separatly in signal conditioning units.

Excitation – Signal conditioning also generates excitation for some transducers. Strain gauges, thermistors, and RTDs, for example, require external voltage or current excitation signals. Signal conditioning modules for these transducers usually provide these signals. RTD measurements are usually made with a current source that converts the variation in resistance to a measurable voltage. Strain gauges, which are very low-resistance devices, typically are used in a Wheatstone bridge configuration with a voltage excitation source.

Linearization – Another common signal conditioning function is linearization. Many transducers, such as thermocouples, have a nonlinear response to changes in the phenomena being measured. This can be done either in hardware or software. It is important to understand the nature of your signal, the configuration that is being used to measure the signal and the affects of the surrounding environment. Based on this information you can easily determine whether signal conditioning will be a necessary part of your DAQ system.

Page 4: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Bus control of traditional instruments

GPIB Up until recently, traditional dedicated measurement instruments dominated the market.

If you took a measurement and wanted to use the data in a larger context, for instance performing statistics on many data points, the data had to be transferred to a computer. Virtually all instruments had a special port called the GPIB-port, which was the hardware connection for a special instrumentation bus. The acronym GPIB stands for General Purpose Instrumentation Bus, and was specially designed to transfer measurement data from instruments. The computer at the other end had to have a special plug-in board so that the connection could be made.

The GPIB standard was first introduced in 1965, but is still very important as an instrumentation bus, even though newer bus standards such as USB are becoming increasingly popular. It has eight parallel data lines and is capable of a data transfer rate of 1 Mbyte/s. The total number of instruments that can be connected is 15, with a maximum cable length of 20 m. From the latter constraint follows that the system is mainly thought to be used in a laboratory environment, and not for a larger factory, for instance.

Figure 3: Examples of interfaces on an Agilent frequency generator. With the introduction of newer interfaces like USB and LAN on current instruments, the

use of GPIB will probably decline, but still it is an important instrumentation bus. Agilent states on their webpage that “GPIB/IEEE 488 is very well established and qualified in the test and measurement industry and there is no indication that it will be obsolete in the near future. However, there are indications that it will most likely be replaced slowly by other standard means of interfacing over many years. Currently standard PC interfaces, such as LAN and USB, are emerging as alternatives, rather than replacements. Most newly introduced Agilent products have had either LAN or USB, or both integrated into the I/O along with GPIB to support these alternatives.” See the figure above for example.

Serial buses

Today, instruments come in a large variety of flavors, and for instance it is possible to buy what essentially looks like an oscilloscope probe with a USB plug. With the appropriate software in the computer, the probe behaves much like an oscilloscope. Usually these instruments have limited bandwidth, and normally a dedicated instrument is chosen. Emerging bus interfaces on these are, as mentioned above, USB and LAN interfaces. Previously both USB and Firewire (IEEE-1394) was not thought to be used as instrumentation buses for several reasons, some of them being that the connectors had no locks and thus could unplug by accident. Also, the cables were not specified for use in industrial environments.

Page 5: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Both USB and Firewire are serial standards, but prior to them a number of standards were available, such as RS-232 (previously the standard bus on PCs, used for instance for the mouse), and RS 485. The latter differs from the first, mainly in that it is a balanced bus, meaning that the two signal lines shift polarity when transmitting a logical ‘0’ and a logical ‘1’. I.e. one of the lines may be at 0 V, and the other at 5 V for a ‘0’, and the first 5 V and the second 0 V for a logical ‘1’. RS232 has one “ground” line and one “signal” line that alternates between 0 and 5 V. The practical difference is that RS485 is less susceptible to noise, and is common in industrial environments.

More and more vendors tend to develop an increasing number of data acquisition products aimed for the USB-bus.

Data acquisition boards A data acquisition board (DAQ-board for short), has traditionally been a plug-in board for

a desktop computer, but the trend is that these look more like plugin-units for the USB-bus, provided the data transfer rate is acceptable.

Figure 4: Traditional plugin-board for the PCI-bus (Computerboards, left), and a modular

USB-system (National instruments). Basically this is an A/D-converter that samples an analog signal, and it can also have

options for outputting analog voltages, set by the computer program. A multitude of these boards exist, and it can be a delicate task to find the correct board for your measurement, which at the same time shall be cost effective, and have software modules that are easy to program, and can fir the rest of the program structure at your company.

Rack-based instruments The demand for physical size reduction, tighter timing and synchronization between

multiple instruments, and faster transfer rates than the 1 Mbytes/s rate of the 8-bit GPIB, initiated vendors to agree on a rack-based standard named VXI (VME-bus extensions for Instrumentation). The rack (see below) has a backplane where

Page 6: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

instrument modules may be plugged in. It is based on the, now fairly outdated, VME-computer-bus, but adds timing and synchronization lines that allows data acquisition and triggering to be performed with high precision. A newer variant is the PXI-system based on the PCI-bus.

Figure 6: A modular PXI-system with a data acquisition module, a temperature sensor

module, and an oscilloscope-like module. Connections in the center of the module are connectors for the controller (computer, industrial PC that controls the module).

It has recently been superseded by the PXIe system, based on the PCI express bus that

currently resides in PCs. Figure 7: The PXIe rack system from National Instruments. This system allows data transfer rates of up to 6.6 Gbytes per second, and available

instruments are for instance test systems for the mobile phone industry.

Field buses In industries, control and measurement problems are usually connected with relatively

large distances. A multitude of measurement sensors are also involved in controlling for instance a paper mill. Traditionally all transducers are connected to the controller by individual cables. Sometimes these cables are also rerouted, and need to be cross-coupled. An alternative is to distribute the intelligence from the controller, so that the sensors also have some basic capacity to send and receive datapackets via a data bus, and to A/D convert the measurements value. Sometimes also calibrations information can be stored in the sensor unit.

Page 7: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Figure 8: Conventional cabling (left) and the fieldbus approach (right). A number of fielbus standards exist, among them Profibus as shown in the figure. Note that

this standard actually uses the RS485 serial bus fro communication. This may be confusing, but RS485 is the electrical specifications of the physical bus, and Profibus the standard that defines what will be sent, in what order, how units will respond etc.

Fieldbuses are very common today, not only in industrial environments, but can be found in elevators, cars, copying machines, toys…

Presentation and control To control your data acquisition, a software is needed. It can be either commandline based

languages like C++ or Matlab, or graphical languages like LabView. To connect with an instrument under Matlab, an object g associated with an instrument at

the bus is created g=gpib('ni',0,1). A suitable command string can then be written to the instrument, for example: fprintf(g,'MEASUREMENT:MEAS1:VALUE?') , meaning that the controller (the program) requests the instrument represented by g to put a measurement value in the stack. These were very simple examples of command lines in Matlab.

A different approach is programming in a graphical programming language. Variables and functions are represented by boxes, and datalines connect them. Execution order is from left to right, and no functions can execute, unless there is data on all input lines. The user only sees the front panel where the programmer can decide exactly which parameters can be controlled in an instrument, and how the data should be presented.

This is exemplified in an ancient program of mine, where a spectrum analyser and a frequency generator were controlled. On the front panel, the acquired spectrum is seen together with settings for the frequency generator (below).

Page 8: Computerized Measurement systemsbme.lth.se/fileadmin/biomedicalengineering/Courses/Datorbaserade_… · Computerized Measurement systems 1. Introduction to Computerized measurements

Figure 9: Front panel of a Virtual instrument. The actual program is seen in the diagram window: This is actually not a very good example of a program, as the structure of the program is

not the best. The possibility to draw the datalines completely as desired, can make the program totally unreadable, as do the sequence structures (the boxes akin to film frames) in the program above. One of the main objectives of this course is to provide you with the tools to create structured LabView programs, at the same time offering an overview over possibilities for data acquisition and instrument control.