LAB 9: VIBRATION AND TILT MEASUREMENTS SPRING 2013 MENG 483L Group#: XX NAMES: XXXX, XXXX OBJECTIVES The objective of this laboratory exercise is to explore various applications of the accelerometer sensor. In particular, vibration measurements are performed and the frequency response function of a metallic beam is calculated. The same accelerometer can be used as a tilt sensor and serve as an inclinometer. Analog and digital measurements will be made, allowing for comparison of the analog and digital data. THEORETICAL BACKGROUND VIBRATION MEASUREMENTS A need for vibration analysis arises in many engineering applications. Two vibration parameters dominate practical considerations: the amplitude and frequency of vibration. The amplitude of vibrations is presented in terms of displacement, velocity, or acceleration, and the frequency is associated with the rate of change of these quantities. In a typical time-domain vibration record, the amplitude is obtained as a difference between the maximum and the minimum values of the signal, and the vibration frequency can be calculated from the period determined as a distance between two neighboring amplitude peaks. In reality, a vibration record most likely will feature not just one, but multiple frequencies and this simple analysis may not yield adequate results. Therefore, a detailed Fourier analysis of a waveform is needed. This analysis can be accomplished either analytically using a Fourier integration scheme, or numerically by employing the Fast Fourier transform (FFT). We will use the latter approach. To determine the natural frequencies of a structural system one needs to excite it mechanically and measure a response to the applied excitation. By exciting the system in a range of frequencies, it is possible to determine a frequency dependent response or frequency response function – one of the main dynamic characteristics of a structural system. To calculate a frequency response, it is necessary to know spectral density functions of the input Syy and output Sxx signals and their cross-spectral densities Sxy, Syx. A Fast Fourier Transform is used to obtain the spectral densities. F1=fft(x); F2=fft(y); Sxy=F2.*conj(F1); Sxx=F1.*conj(F1); Syy=F2.*conj(F2); Syx=F1.*conj(F2); Lab 9, Group # XX, Names: XX, XX MENG 483L Where conj means a complex conjugate of a function. After the spectral densities are determined, calculation of the frequency response function is straightforward. H (i ) S yx ( ) S yy ( ) S xx ( ) , S xy ( ) (1) It should be noted that according to expression (1), two different paths can be followed to obtain H(iω). This fact allows us to verify the adequacy of the measurement and calculation procedures. A coherence function can be defined to quantify the noise contamination of the signal. Coh S xy ( ) 2 S yy ( ) S xx ( ) , (2) For the signal containing a random noise, Coh = 0, the consistent measurements unaffected by noise will yield the Coh value close to unity, i.e. 1. WHAT DO FREQUENCY RESPONSE AND COHERENCE FUNCTIONS REPRESENT? 0.5 POINTS CALCULATION OF NATURAL FREQUENCIES OF THE METALLIC BEAM In the vibration measurements considered in this laboratory exercise, the aluminum 2024-T3 beam is employed. Properties of the 2024-T3 aluminum are given below: Modulus of Elasticity (E) = 73.1 GPa Density (ρ) = 2.78 g/cc = 2780 kg/m3 The dimensions of the beam are as follows: Length (l) = 11” = 27.94cm = 0.2794m Width (b) = 1” = 2.54cm = 0.0254m Height (h) = 1/10” = 0.254cm = 2.54e-3m 2 Lab 9, Group # XX, Names: XX, XX MENG 483L In the experimental setup, one end of the aluminum beam is clamped and the other end is free. Therefore, the theoretical natural frequencies of the beam are calculated for the clamped-free boundary condition. Table 1 provides information on weighted natural frequencies (βnl ) and the characteristic equation for this type of boundary conditions. Table 1 Weighted natural frequencies and the characteristic equation for clamped-free Euler-Bernoulli beam. Vibration Mode (n) βnl and characteristic equation 0 1.87510407 1 4.69409113 2 7.85475744 3 10.99554073 4 14.13716839 for n>5 (2n - 1)*π/2 The natural frequencies of an Euler-Bernoulli beam are calculated using the following formula: f n n2 EI A 2 , (3) where A is the cross-section area (b∙l) and I is the area moment of inertia determined as: I b h3 12 3 (4) Lab 9, Group # XX, Names: XX, XX MENG 483L EQUIPMENT CSM12D module (MCU) Freescale Project Board USB cable RS-232 Serial cable (DB9 connector) Microphone 2 1/2" Drill Press Angle Vise Aluminum 2024-T3 beam 6.5” 15W Speaker 3k resistor Protractor LIS2L02AL accelerometer Alligator clips 4 Lab 9, Group # XX, Names: XX, XX MENG 483L PROCEDURES VIBRATION MEASUREMENTS EXERCISE #1: In this laboratory exercise you will be measuring a dynamic response of an aluminum beam to the applied impulse excitation. The excitation is exerted using a speaker positioned underneath the beam. The response of the beam is measured via the accelerometer attached to the beam. The input excitation signal is measured via a microphone without an amplifier. Figure 2. Connect the microphone and the accelerometer as shown in J6 VAUX GND TXD0 RXD0 PP0/PWM0 PP1/PWM1 PT0 PT1 MOSI0 MISO0 SCK0 SS0 PA7 PA6 VAUX GND TXD0 RXD0 PP0/PWM0 PP1/PWM1 PT0 PT1 MOSI0 MISO0 SCK0 SS0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 J6 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 2 4 6 8 10 12 14 16 18 20 22 24 26 28 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 +5V (dark blue) PWM7 AN07 AN06 AN05 AN04 AN00 AN01 AN02 AN03 LIS2L02AL Vo (light blue) GND (white) +5V Red Head PWM7 AN07 AN06 AN05 AN04 AN00 AN01 AN02 AN03 Figure 1 Connection of a speaker to the amplifyer. MIC Black Head 3k GND PWM2 PWM3 PWM4 PWM5 RXD1 TXD1 PT2 PT3 PT4 PT5 PT6 PT7 5 Lab 9, Group # XX, Names: XX, XX Figure 2 MENG 483L Connection diagrams for the microphone and accelerometer. Place the speaker as depicted in Figure 1, connect regular computer speaker to the computer, connect the excitation (i.e. flat) speaker to the computer speaker. The computer speaker serves as an amplifier of the excitation signal. Place the microphone underneath the beam and use AN01 port to acquire the data. You will be using a pulse generation VI discussed in Lab6. The input signal supplied to the speaker is used to excite the beam and to trigger the data acquisition. Power up the LIS2L02AL accelerometer with 5 V available on board. The port AN00 is used to acquire the accelerometer data. Illustration of an experimental setup is given in Error! Reference source not found.. Please note that the frequency bandwidth of the LIS2L02AL is from 0.5 to 2500 Hz. Figure 1 Connection of a speaker to the amplifyer. Open the Labview PulseGenerator.vi file. This program produces repetitive “clicks” on the speakers and provides a digital trigger to tells the microcontroller when to capture data. Enable the trigger signal by connecting the Project Board’s Digital I/O “DO 0” to PA0 (J6_39). In the VI menu select the Pulse frequency as 2000Hz, select the shortest impulse length and maximum loudness. The data acquisition program is given below. For new version CW5: go to the My Documents, rename the “Default” folder as “Lab9”, go inside, rename CW file as “Lab9”. Double click on it to open. Copy and paste following code: #include <hidef.h> /* common defines and macros */ #include <mc9s12xdt512.h> /* derivative information */ #include "csm12d.h" #include <stdio.h> //standard I/O - requires termio.c in Sources #include “termio.c” //function prototypes #pragma LINK_INFO DERIVATIVE "mc9s12xdt512" #define SIZE 1024 //data array size /* interrupt service routines must go in NON_BANKED memory! */ #pragma CODE_SEG NON_BANKED /* The following timer interrupt will trigger the ATD converter. */ /* You must connect timer Ch0 to ATD Ch7 with a wire. */ void interrupt 8 ATDtrigger(void) { // interrupt 8 is timer channel 0 TC0 = TC0 + 100; // set ATD rate to 20kHz: 2MHz / 20kHz = 100 CFORC_FOC0 = 1; // toggle channel 0 back low TFLG1_C0F = 1; // clear the interrupt } #pragma CODE_SEG DEFAULT void main(void) { /* define variables */ 6 Lab 9, Group # XX, Names: XX, XX MENG 483L unsigned int i, x[SIZE], y[SIZE]; /* Initialize variables and hardware here */ CSM12D_USER_Init(); DDRA = 0x00; //configure Port A for input TERMIO_Init(); //Configure serial communication /* ATD init */ ATD0CTL1 = 0x07; //trigger on ATD ch7 ATD0CTL2 = 0x8C; //power up ATD converter, enable trigger ATD0CTL3 = 2<<3; //do 2 conversions per sequence ATD0CTL4_SRES8 = FALSE; //10 bit resolution ATD0CTL4_PRS = 0; //set ATD clock ATD0CTL5 = 0x90; //multiple channels, start at channel 0 /* timer init */ TSCR2_PR = 0; // set prescaler - 2MHz clock TSCR1_TEN = TRUE; // enable timer TIOS_IOS0 = 1; // configure channel 0 for output compare TCTL2_OM0 = 0; // these two lines configure channel 0 to toggle TCTL2_OL0 = 1; // the output level on a successful compare /* get data (data acquisition begins when trigger from VI */ /* is received on PA0) */ while (PORTA_PA0==0); //wait until the sound is played TIE_C0I = TRUE; // enable interrupt on channel 0 EnableInterrupts; // enable interrupts in general for(i=0;i<SIZE;i++) { while (!ATD0STAT1_CCF0); //wait until the conversion is complete x[i] = ATD0DR0; while (!ATD0STAT1_CCF1); //wait until the conversion is complete y[i] = ATD0DR1; } printf("Open output file and press any key to transfer data\n"); getchar(); for(i=0;i<SIZE;i++) { printf("%d, %d\n",x[i],y[i]); } for(;;); /* please make sure that you never leave the main() function */ } During this exercise, you may increase your volume slightly to get a good signal, but still keep your sound level within reason. To collect the data, you will need to run the pulse generator first and then press the microcontroller Start button immediately after you hear one of the clicks. The microcontroller should trigger on the next click and print the “Open output file” message. The data transfer procedure is the same as in previous laboratory exercises. Plot the data to see if you did indeed capture the pulse (occasionally there is a delay in the program and you may miss the pulse). Verify if the pulse is visible on both channels. The Matlab script for fft, from lab 7, accomplishes much of what will be necessary in the following questions. 7 Lab 9, Group # XX, Names: XX, XX MENG 483L Plot and analyze your signals. Run this experiment at least twice and do the followings: 1. LOAD YOUR DATA IN MATLAB. YOU WILL HAVE 2 VECTORS: IN, OUT RESPECTIVELY. PLOT THE TIMEDOMAIN REPRESENTATION OF THESE SIGNALS. 0.5 POINT 2. CALCULATE AND PLOT THE SPECTRUMS (I.E. FFT(SIGNAL)) OF THESE SIGNALS. THE MAXIMUM FREQUENCY VALUE (X AXIS) IN YOUR PLOTS MUST NOT EXCEED 2KHZ (HINT: USE XLIM([0 2*10^3]) IN MATLAB). 0.5 POINT 3. CALCULATE SPECTRAL DENSITIES ACCORDING TO THE EXAMPLE GIVEN IN THE THEORETICAL SECTION. 1 POINT. 4. USING EXPRESSION (1) CALCULATE THE FREQUENCY RESPONSE FUNCTIONS (FRF). PLOT YOUR FRFS. 1 POINT. 5. CALCULATE NATURAL FREQUENCIES OF THE BEAM USING FORMULATIONS PRESENTED IN SECTION 2.2. YOU SHOULD SEE THE NATURAL FREQUENCIES OF THE BEAM AS PEAKS IN THE FRF REPRESENTATION. LOCATE THESE NATURAL FREQUENCIES AND COMPARE THEM TO THE CALCULATED NATURAL FREQUENCIES. EXPLAIN THE DIFFERENCE BETWEEN VALUES OF CALCULATED AND MEASURED NATURAL FREQUENCIES. 1 POINT. 6. USING EXPRESSION (2) CALCULATE THE COHERENCE FUNCTION. WHAT ARE THE MAXIMUM AND MINIMUM VALUES OF YOUR COHERENCE FUNCTION? WHAT DO THEY TELL YOU ABOUT CONSISTENCY OF YOUR MEASUREMENTS? 1 POINT WHY DO YOU NEED A TRIGGERING CIRCUIT TO START THE ACQUISITION OF THE VIBRATION DATA? 1 POINT HOW DID YOU SELECT THE SAMPLE RATE FOR THE VIBRATION MEASUREMENTS? 8 1 POINT Lab 9, Group # XX, Names: XX, XX MENG 483L ACCELEROMETER AS A TILT SENSOR MEMS accelerometers can be used to determine an angle of tilt. This measurement is possible because the sensing axis of an accelerometer resting on a tilted surface is not aligned with the vector of gravity, thus generating a voltage output nonlinearly proportional to the angular difference between these two vectors. In this laboratory exercise we will only measure the tilt with respect to the y-axis. The LIS2L02AL accelerometer has a sensitivity of 1000 mV/g, which is sufficient for tilt applications. Angle vs. Output Voltage 4 Output Voltage 3.5 3 2.5 2 1.5 0 15 30 45 60 75 90 105 120 135 150 165 180 Angle (degrees) Figure 3 Nonlinearity of the accelerometer output in the tilt application. Nonlinearity of the accelerometer: As it can be seen in Figure 3, a typical output of a MEMS LIS2L02AL accelerometer resembles a sine function. The figure shows the analog output voltage of the accelerometer covering the tilt angles from 0° to 180°. The change of the tilt directly corresponds to a change in the acceleration due to gravity acting on the accelerometer. The slope of the curve is the sensitivity of the device. DRAW AND DISCUSS SCHEMATICS OF THE TILT EXPERIMENT. USE THREE ANGLES (0, 30, AND 90 DEGREES) TO SHOW THE ALIGNMENT OF THE ACCELEROMETER’S AXIS AND THE GRAVITY VECTOR. 0.5 POINTS Here the arrows represent gravity and the blocks are the accelerometer located at 0, 30, 90 degrees. Measured outputs are below. 9 Lab 9, Group # XX, Names: XX, XX MENG 483L EXERCISE #2: In this exercise you will measure the tilt using an accelerometer attached to a protractor, which is used as the angle reference. Power the accelerometer as described previously. Connect the banana clips to ELVIS DMM voltage measurement input ports. Adjust the protractor knob to each angle indicated in Table 2 and measure with Digital Multi-Meter the y-axis output voltage response. RECORD THE MEASURED VALUES IN TABLE 2 AND PLOT THE NONLINEAR OUTPUT CHARACTERISTIC PERTAINING TO YOUR MEASUREMENTS. 1 POINT Table 2 Measurement of accelerometer tilt response. Angle 0° 15° 30° 45° 60° 75° Output Voltage TA CHECKMARK 10 90° 105° 120° 135° 150° 165° 180° Lab 9, Group # XX, Names: XX, XX MENG 483L EXERCISE #3: The program below is used to display the angle value which you measured. You will have to include your own digital values for the desired angles, because the digital values change from one accelerometer to another. Load the following program to the microcontroller. For new version CW5: go to the My Documents, rename the “Default” folder as “Lab9”, go inside, rename CW file as “Lab9”. Double click on it to open. Copy and paste following code: #include <hidef.h> /* common defines and macros */ #include <mc9s12xdt512.h> /* derivative information */ #include "csm12d.h" #include <stdio.h> //standard I/O - requires termio.c in Sources #include “termio.c” //function prototypes #pragma LINK_INFO DERIVATIVE "mc9s12xdt512" /* Function that interpolates between table values. */ int interpolate(int x, int xtab[], int ytab[], int tsize) { int y,n; if(x <= xtab[0]) y=ytab[0]; else if(x >= xtab[tsize-1]) y=ytab[tsize-1]; else { // find position in table for (n=0; (xtab[n] < x) && (n < tsize); n++); // interpolate y = (ytab[n]-ytab[n-1])*(x-xtab[n-1])/(xtab[n]-xtab[n-1])+ytab[n-1]; } return y; } /* interrupt service routines must go in NON_BANKED memory! */ #pragma CODE_SEG NON_BANKED #pragma CODE_SEG DEFAULT void main(void) { /* define variables */ int i, x, angle; // x-table: ATD digital values int xtab[13]={327,334,357,393,439,493,552,610,665,711,746,770,778}; // y-table: angles int ytab[13]={0,15,30,45,60,75,90,105,120,135,150,165,180}; /* Initialize variables and hardware here */ CSM12D_USER_Init(); TERMIO_Init(); //Configure serial communication // setup ATD converter ATD0CTL2_ADPU = TRUE; //power up ATD converter ATD0CTL3 = 1<<3; //do 1 conversion per sequence ATD0CTL4_SRES8 = FALSE; //10-bit resolution ATD0CTL4_PRS = 0; //set ATD clock for(;;) /* program code goes inside this infinite loop */ { // average 8 values to smooth data 11 Lab 9, Group # XX, Names: XX, XX MENG 483L for(i=0,x=0;i<8;i++) { ATD0CTL5 = 0x80; // convert channel 0, right justified result while (!ATD0STAT0_SCF); // wait until sequence is complete x = x + ATD0DR0; // calculate running sum } x = x/8; // calculate mean angle = interpolate(x,xtab,ytab,13); printf("Digital %d = %d degrees\n",x,angle); msleep(500); } /* please make sure that you never leave the main() function */ } In your program, replace each digital value in the table with the new value you have recorded. This requires you to run the program, noting what the digital output is for a given angle. Re-compile and download the program with new digital values. Move the protractor knob throughout its range, noting the accuracy of tilt measurements. You will observe that as the device is tilted from 0° to 180°, the monitored angle will become less accurate as you approach 0° and 180°. Show Calibrated Program to TA WHY DOES ACCURACY DEGRADE AS YOU APPROACH 0° AND 180°? 12 1 POINT