Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Lab 2A: Introduction to Sensing and Data Acquisition Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at Austin June 12, 2014 ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A 1 Lab 2A 2 Sensors 3 DAQ 4 Experimentation 5 Summary 6 Pre-Lab 2A Sensors DAQ ME 144L Dynamic Systems and Controls Lab (Longoria) Experimentation Summary Pre-Lab 2A Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Lab 2A Overview In this laboratory, you will experiment with a compound pendulum setup equipped with a potentiometric sensor to measure rotational displacement about a fixed support shaft. Sensor and digital data acquisition (or ‘DAQ’) concepts are introduced. Learning LabVIEW continues, now programming to control DAQ hardware for signal analysis. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A When released from an initial angle, the pendulum oscillates and eventually stops. If the pendulum decays, there must be significant friction in the pivot and/or in the air that dissipates energy. Can you determine which dominates? We will investigate this by making measurements from the angle sensor and later using modeling and simulation. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Lab 2A Specific Objectives 1 Learn sensor concepts, using sensors, and signal conditioning 2 Become familiar with the National Instruments myDAQ data acquisition hardware 3 Continue learning how to program in LabVIEW, now for data acquisition 4 Develop a LabVIEW program to measure sensor signals using myDAQ 5 Calibrate rotational potentiometer for angle measurement 6 Write LabVIEW programs that analyze signals to generate useful data 7 Run experiments with the compound pendulum and save angular position measurements over time as the pendulum comes to rest after being released. 8 Use measured data to answer questions about the system (e.g., estimate system parameters, system energy stored or dissipated, etc.) ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Most modern sensors are electromechanical We can classify by the sensing mechanism. Resistive (potentiomers, strain gauges, thermistors, light, etc.) Capacitive (Very common in MEMS; accelerometers, stud sensors, etc.) Inductive and Magnetic (proximity, distance, ...) Piezolelectric (force, ...) ME 144L Dynamic Systems and Controls Lab (Longoria) Summary Pre-Lab 2A Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Resistive sensors rely on changes in resistance The resistance of a uniform conductor is given by, R = ρL/A, with ρ the resistivity, L the length and A the constant cross-sectional area through which current flows. Resistance changes either by a geometric (A, L) or material change (ρ) in the resistive element. Resistance can be directly measured (by an ohmmeter) or through a signal conditioning circuit (e.g., a voltage-divider) ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Signal conditioning for resistive sensors converts resistance change to voltage change Signal conditioning refers to the devices and processes we use to modify and/or improve the nature of a sensor signal. Examples include filters, amplifiers, etc. Consider a basic voltage divider, where R2 vin vout = R1 + R2 ME 144L Dynamic Systems and Controls Lab (Longoria) By using a voltage divider, we can transform the resistance change into a voltage change which is more readily measured. Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Calibration of the potentiometric sensor Effectively, the potentiometric sensor is configured like a voltage divider where the output voltage is related to the change in shaft position. Calibration builds a relation between the output voltage and angular position. We seek relation θ = f (vout ), where vout is the measurable output voltage. It is desirable to have a sensor that has a linear relation between the measurand (here θ) and the measured voltage. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Why we like linear sensor models Linear model relations between measured voltages, say vm , and a measurand of interest, ym , make it easy to represent calibration with a single constant or line (e.g., from regression), ym = K · vm Another advantage is that if the relation between a measured voltage signal and the measurand is linear then when you look at the temporal trends in the measured signals these are the same for the actual physical variable(s) of interest. Having a nonlinear sensor is tolerable, especially since modern computing can easily represent the model. NOTE: It is expected that when calibrations are conducted, the regression may introduce a ‘y-intercept’ (i.e., ym = K · vm + b). This model is more generally called affine, meaning there is a linear relation with some translation (or rotation). ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Most modern voltage measurements are made using A/D converters Most basic electrical measurements rely on an analog-to-digital (A/D) converter, which are even included as part of modern microcontrollers. ME 144L Dynamic Systems and Controls Lab (Longoria) In a DMM, signal conditioners infer other electrical quantities from a measurement of voltage. Note the signal conditioners needed to allow measurement of current and resistance. Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A For more general purpose measurement and instrumentation applications, data acquisition devices offer more functionality Analog Output (AO) I I Generate DC Voltages General waveforms (Function Generator) Digital I/O I I General low (0V) and high (5V) pulses Read digital pulses Timing I/O I I Generate pulse trains (square waves) Read frequency, time values Always critically evaluate DAQ specifications to determine if your needs can be met by a particular DAQ device. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation The NI myDAQ connects via USB Form factor: ME 144L Dynamic Systems and Controls Lab (Longoria) Connections: Summary Pre-Lab 2A Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A What should you know about A/D conversion? General concepts: Resolution and range How fast to sample How many times to sample Hardware specific: Device and configuration (using NI MAX) Connecting signals the right way What channels to sample How to deal with the data There are many different types of software and hardware commercial products for DAQ. National Instruments products have seen increased application and adoption in industry, research, etc., including areas that were once considered the domain of very ‘high-end’ systems. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Analog-to-Digital (A/D) Conversion The A/D converter (ADC) converts an analog voltage into a binary number through the process of quantization. The ADC will have a full-scale voltage range (VF S ) over which it can operate. Example: For the NI myDAQ device, there are two analog inputs with different FS range. What is difference between DC and AC coupled? The number of bits dictates how many discrete levels will be used to represent measured voltages. Example: An 8-bit converter with a VF S = 10 V gives a resolution of 10V/256 = 39.1 mV. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A A/D Conversion: Quantization A signal entering a computer must be discretized in amplitude and time (sampling). Amplitude quantization depends on the number of bits in the A/D converter. Comparing A/D resolution for n = 3 vs 16: ∆n=3 = VF S /23 = 1.25 V compared to ∆n=16 = VF S /216 = 0.15 mV ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Choosing a sampling or scan rate (scans/sec, or Hz) The ADC samples according to a scan rate. How fast you sample should minimally satisfy the Nyquist sampling theorem. Nyquist: the sampling rate should be at least two times the highest frequency present in the signal. Satisfying the Nyquist criterion helps ensure the signal can be reconstructed properly. You need to balance how fast you sample, how many samples you store, etc. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A In selecting a sample rate, think about time resolution also Depending on your objective, you might choose scan rate to satisfy Nyquist criterion, but remember accuracy in time measurements. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A “All grounds are not the same the world ’round.” Understanding grounds is important in making proper signal connections. Can you connect them? Circuit or signal common Earth ground Chassis ground ME 144L Dynamic Systems and Controls Lab (Longoria) Ground symbols: Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Types of signal sources Grounded source: Referenced to system ground (e.g., earth, building) Share a common ground with a DAQ board, oscilloscope, etc. Floating source: Isolated from absolute reference such as earth or building ground Neither terminal is connected to a ground Some signal generators, power supplies Batteries and battery-powered sources, many sensors such as thermocouples, etc. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Types of Measurement Systems You may see these connection options on DAQ hardware. 1 Differential measurement system 2 Referenced single-ended (RSE) 3 Non-referenced single-ended (NRSE) Example: myDAQ analog input ME 144L Dynamic Systems and Controls Lab (Longoria) Pre-Lab 2A Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Experimentation and modeling Before closing, consider the experimental setup and what kind of tests can be run (without building a formal model). What can be found out by practicing use of sensors and DAQ? Here are some suggestions: estimate pendulum moment of inertia - see next slide show that for large oscillations, the pendulum period depends on amplitude of oscillation - it is known that as amplitude increases, then so must period estimate stored energy, and how energy decreases after each cycle estimate the total energy over time - this requires that you estimate the potential energy as well as the kinetic energy. Estimating kinetic energy requires estimating the velocity from the measured position. Any one of these motivates the need to analyze the signals and the data in a certain way. ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Example: experimentally determining pendulum moment of inertia The model for a compound pendulum was previously derived (see Introduction slides) as a 2nd order ODE, J0 θ̈ + mglC sin θ = 0. with J0 the (mass) moment of inertia about the axis of rotation (or pivot), 2 O, J0 = J + mlC , m is the total mass, and lC the distance from the pivot to the CG. If the angle of oscillation about θ = 0 remains small (< 10 degrees), sin θ ≈ θ and the ODE becomes linear, ME 144L Dynamic Systems and Controls Lab (Longoria) J0 θ̈ + mglC θ = 0. In standard 2nd order form, θ̈ + ωn2 θ = 0, p where, ωn = mglC /J0 is the undamped natural frequency, the frequency of oscillation when there are no applied forces. The undamped natural period is then, Tn = 2π/ωn , so if Tn is measured, then J0 can be estimated experimentally. Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Comments and ranting Make notes on how to connect power, sensors, and measured signals properly. Simple circuit knowledge is all that is needed, and it can help you make sure you collect the signals correctly and don’t damage equipment. Keep separate issues of software from hardware, but understand they work together. LabVIEW does not measure signals – instruments do that. Rant: LabVIEW is software that controls hardware. The hardware does the actual data collection. Similarly, we’ll use LabVIEW to numerically solve equations, but LabVIEW does not “model a physical system”– you do that! ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Summary Build experience using simple sensors Use a known physical problem for purposeful learning of DAQ usage, signal processing, etc. Take opportunity to experiment with very basic LabVIEW VI for data collection. Experiment with myDAQ for quick data acquisition, testing, and model improvement Use LabVIEW for ‘signal processing’ (peak detection) ME 144L Dynamic Systems and Controls Lab (Longoria) Outline Lab 2A Sensors DAQ Experimentation Summary Pre-Lab 2A Summary of Pre-Lab 2A – see the clog for details 1 Build a LabVIEW VI with a simulated DAQ device. 1 2 3 Create a NI-DAQmx Simulated Device. Use the NI-DAQmx Simulated Device This example should simulate collection of 2 channels of data; when the “while” loop is stopped the data should be saved to a LabVIEW measurement file. 2 Review the sensing circuit (potentiometer) discussed in lecture/slides. Submit a description in words, diagrams, and equations, as needed, of how the basic potentiometric circuit is used to measure pendulum angular position. You should walk into lab knowing how you will hook up the potentiometric sensor (without damaging). 3 Do some thinking about experiments you may want to run. Come to lab with at least one idea you want to try out. ME 144L Dynamic Systems and Controls Lab (Longoria) NI myDAQ Specifications Two Differential Analog Input and Analog Output Channels (200 kS/s, 16 bit, +/- 10 Volts) Access matched analog input and output channels in a +/- 10 volt range through the screw terminal connectors or +/- 2 volt range through the 3.5mm audio jacks. +5 , +15, and -15 Volt Power Supply Outputs (up to 500m Watts of Power) USB powered for maximum mobility, myDAQ supplies enough power for simple circuits and sensors. Eight Digital Input and Digital Output Lines (3.3 Volt TTL-Compatible) Use software-timed digital lines for interfacing both Low Voltage TTL (LVTTL) and 5 volt TTL digital circuits. Each line is individually selectable for input or output. 60 Volt Digital Multimeter (DMM) for Measuring Voltage, Current, and Resistance The isolated DMM includes the capability to measure both AC and DC voltage and current as well as resistance, diode voltage, and continuity. ME 144L Dynamic Systems and Controls Lab (Longoria) NI myDAQ block diagram ME 144L Dynamic Systems and Controls Lab (Longoria)