Mec E301 Lab02 Digital-W2021 PDF

Title Mec E301 Lab02 Digital-W2021
Author Atif Moeez
Course Mechanical Engineering Laboratory I
Institution University of Alberta
Pages 9
File Size 256.9 KB
File Type PDF
Total Downloads 23
Total Views 154

Summary

Download Mec E301 Lab02 Digital-W2021 PDF


Description

DIGITAL MEASUREMENT TECHNIQUES In order to make an informed decision about any digital data acquisition system it is necessary to understand which characteristics are important. You are to study methods of digital data acquisition and transmission with the aim of determining the interaction between parameters such as word length, resolution, conversion rates and gain.

1

DIGITAL DATA ACQUISITION

In this lab a digital data acquisition demonstration system is used to investigate the parameters used in data acquisition.

1.1 Equipment The equipment used allows a basic, hardware-level look at analog-to-digital (A/D) conversion, parallel or serial transmission of digital data, digital-to-analog (D/A) conversion, and data displays. The user can change digitization frequency, data word length, and input signal to see how these parameters affect the measurement process.

Figure 1 A schematic of the Digital Data Acquisition Demonstration System

The equipment shown in the schematic in Figure 1 consists of an integrated circuit digital data acquisition/transmission demonstration system used with the shaker table and LVDT from previous labs. The separate components of the digital data acquisition demonstration unit shown in Figure 2 are:

MecE-301

1

Serial Transmission of Signal Input in Analog (volts)

Input in Binary Output in Analog (volts)

Input

Input Gain Control

Analog-to-Digital Conversion

Output with Digital-to-Analog Conversion

Figure 2 A picture of the digital data acquisition demonstration unit

1. An input amplifier section to provide adequate input voltage level and protect the digital circuitry. The input amplifier can be set for a gain of x1 or x5. 2. A special-purpose analog to digital (A/D) converter chip, which when connected to the output of the amplifier, produces a digitally coded output proportional to voltage. The output is produced in serial form. This is a series of coded voltage pulses sent one after another (serially) on a single output line. The A/D converter can be set to produce 8 or 12 bit binary numbers and the A/D sampling and conversion rate can be varied from 10 Hz to 2 kHz. The A/D converter has a full scale input range of ±10 V. 3. A parallel digital data bus and binary display consisting of 12 LED indicators. The number of bits actually transmitted along the parallel bus can be set at 8, 10, or 12 independent of what the A/D converter is actually producing (although obviously no extra information will be generated by transmitting 12 bits when the A/D has only produced 8 significant bits). 4. A serial data line over which the serial digital data is transmitted from the A/D converter through 4-wire telephone line to a D/A converter.

MecE-301

2

5. A digital-to-analog (D/A) converter with a serial input. This D/A converter converts the serial pulses to an analog voltage signal. The D/A converter is designed to produce the same voltage level at its output as the A/D converter sees at its input. To help smooth out glitches in the reconstructed analog output signal, there is also a low-pass filter section on the D/A converter output.

1.2 Procedure To prevent signal transients from damaging the analog/digital (A/D) converter make sure nothing is connected to the ANALOG I/P (input connector) unless the system power is on. Turn on the power to all instruments and to the power oscillator on the shaker table and then connect the ANALOG I/P cable. Set the CONVERSION RATE to maximum (clockwise), the ANALOG INPUT AMPLIFIER gain to x1, and the number of conversion bits to 12. With the shaker table at rest, record the binary output of the A/D converter LED's in binary format (e.g. 100110111001) and convert to an integer value in Table 1. Note that for this display a lit LED indicates 1 and a dark LED indicates 0. Record the D/A output voltage. Be careful not to bump the table as the shaker table platform when not restrained will move quite freely and result in the least significant bits flickering. With the amplifier still set to a gain of x1, determine the sensitivity of the LVDT over a range of 2 mm by setting a 2 mm gauge block between the shaker table body and platform. Insert the gauge block under the platform, close to the LVDT attachment point, and allow the shaker table diaphragm to provide the force necessary to bring the block and platform into contact. Stable readings should be obtained; the least significant bits should not be flickering. As the equipment is very sensitive any vibration of the shaker table or lab bench will cause the LSB to flicker and will make reading difficult. Record the data in Table 2. Calculate the sensitivity of the LVDT in the space provided. Connect the D/A OUTPUT to channel 1 of the oscilloscope. Switch the ANALOG INPUT AMPLIFIER gain to x1 and turn the CONVERSION RATE to maximum (clockwise). Turn on the power oscillator, adjust the frequency to 10 Hz and set the amplitude range to medium. Adjust the amplitude control to obtain an output voltage of 0.3 V peak-to-peak on the oscilloscope. (Make sure the oscilloscope is set to the correct probe amplification.) Measure the shaker table amplitude and frequency using the D/A output signal and record values in Table 3. Reduce the number of bits used by the A/D to 10 and then to 8, noting the effect on the reconstructed signal by sketching the waveforms in Table 4. Estimate the shaker table amplitude and frequency again with 8 bits and gain of x1 and record in Table 5. Switch the ANALOG I/P amplifier gain back to x5 and fill in Table 6.

MecE-301

3

With the A/D converter using 12 bits again, turn the CONVERSION RATE knob counter-clockwise to reduce the conversion rate. Note the reduction in reconstructed signal resolution that results. Record the change in the output waveform in Table 7 using three conversion rates. To test the susceptibility of digital data transmission to noise set the CONVERSION RATE to maximum, gain x5, and the number of bits to 12. Set the shaker table oscillator frequency to 10 Hz. Set the 60 Hz NOISE SOURCE coil on the coil of wire carrying the analog signal from the LVDT to the digital system. Note the amount of 60 Hz noise on the D/A O/P connections when the noise source is activated. Move the AC NOISE SOURCE to the coil of wire carrying the serial digital signal. Record the shape of the waveforms in Table 8. Why is the analog signal sensitive to noise and the digital signal is not? Record your answer in the space provided. Disconnect the LVDT, oscilloscope, and counter leads from the digital system before turning off the power.

MecE-301

4

Table 1 The at rest position of the shaker table, gain set to x1, maximum conversion rate, 12-bit Binary Number (counts) Output Voltage Integer Number (V) MSB LSB

Table 2 LVDT calibration, gain set to x1, A/D set to 12-bit Disp. (mm)

LVDT output (V)

A/D 12-bit output (binary)

Amp. output (V) MSB

A/D output (integer)

D/A output (V)

LSB

0.000 2.000 Calculate LVDT sensitivity:

Table 3 D/A set to 12-bit, gain set to x1 D/A output Shaker table Oscilloscope amplitude Pk-Pk Pk-Pk (~0.3V) (mm)

Shaker table frequency (Hz)

A/D resolution (V)

Table 4 Influence of conversion bit depth on waveform shape, gain set to x1 A/D number of bits 8-bit 10-bit

Displacement measurement resolution (mm)

12-bit

Shape of the D/A output voltage curve

Table 5 A/D set to 8-bit, gain set to x1 D/A output Shaker table Oscilloscope amplitude Pk-Pk Pk-Pk (V) (mm)

Table 6 A/D set to 8-bit, gain set to x5 D/A output Shaker table Oscilloscope amplitude Pk-Pk Pk-Pk (V) (mm)

MecE-301

Shaker table frequency (Hz)

A/D resolution (V)

Displacement measurement resolution (mm)

Shaker table frequency (Hz)

A/D resolution (V)

Displacement. measurement resolution (mm)

5

Table 7 Effect of conversion rate on the A/D output, A/D set to 12-bit, gain set to x5 Conversion Shape of the D/A output curve rate (arbitrary)

Table 8 Effect of 60 Hz noise on digital and analog data line, A/D set to 12-bit, gain set to x5 Shape of the D/A output curve Line Signal

Analog

Digital

Why is the analog signal sensitive to noise and the digital signal is not?

MecE-301

6

2

ARDUINO FOR DATA ACQUISITION

2.1 Equipment The Arduino Uno is a microcontroller based on the ATmega328 integrated circuit. The Arduino can be programmed with the Arduino software to read and write digital signals, read analog signals, communicate with computers, etc. The Arduino Uno has 6 analog inputs with an analog-to-digital converter (ADC) of 10 bits. The default voltage range of the ADC is 0 to 5 V; however, the upper end of the voltage range can be reduced (for better resolution) by supplying the desired reference voltage on the AREF pin. You will be provided with a printed circuit board that will directly plug into your Arduino. This circuit generates a sinusoidal voltage, which is fed into the A0 analog input pin (referenced to the GND (ground) pin). The printed circuit board is powered by the Arduino and gets the required power from the 5V pin (also referenced to the GND (ground) pin). The sine wave generated by the circuit has a maximum and minimum voltage between 0 and 5 V and a frequency between 5 and 100 Hz (each circuit board is unique).

2.2 Procedure Your goal in this section of the lab is to determine the peak-to-peak amplitude, frequency, and mean voltage (i.e. or “DC offset”) of the signal. Go to: http://arduino.cc/en/Guide/HomePage and read the step-by-step instructions on how to set up your Arduino or your system (i.e. download software, drivers, run simple program, etc). If you are having difficulty communicating with your Arduino (i.e. a sketch won’t upload) it’s typically because the Arduino software is trying to communicate with the wrong serial port. Please re-read steps 8 and 9 of the installation guide: http://arduino.cc/en/Guide/HomePage Now it’s time to try measuring a signal with your Arduino: Plug in the sine wave printed circuit board so that the A0 and 5V pins on the circuit board plug into the A0 and 5V pins on the Arduino. Arduino has many built-in example “sketches” (or programs). Open the example sketch called “ReadAnalogVoltage” under the menu File>Examples>01.Basics. Upload this sketch to the Arduino by hitting the Upload button on the top of the sketch window. Now the Arduino is going to be reading the analog voltage coming out of the function generator and sending it to your computer via the serial port. To see the communication from the Arduino, open up the Serial Monitor from the Tools menu. Set the baud rate of the serial monitor to 9600 baud (i.e. the same value as was set in the void setup section of the sketch). You should now see numbers flying through serial monitor. These are the voltages measured on pin A0 and sent to your computer’s serial port. MecE-301

7

What we want to do is measure the frequency, amplitude, and mean of this signal. The “ReadAnalogVoltage” sketch is not very useful for determining these values because we need to know the voltage AND the time the voltage was measured. Therefore, download the Arduino “sketch” called “AnalogIn_SerialOut.ino” from eClass. Open it in the Arduino software and read through the sketch to understand how it works. The AnalogIn_SerialOut sketch reads the value of the analog input, calculates the time the measurement was made with respect to the first measurement (in microseconds), and prints the time and ADC output (in counts) to the serial port. The default code collects 100 samples, with approximately 1 ms between samples, and then stops. Upload this code to your Arduino and look at the output on the serial monitor (don’t forget to change the baud rate in the serial monitor to 115200 bps as noted in the sketch). Cut-paste this output into Excel and plot the result. (Note: The time and ADC counts are separated, or “delimited”, by a comma. Excel will allow you to import these numbers into separate columns using the Import wizard. If you have a Macintosh, first open TextEdit and under Preferences set the format to “Plain Text”, then paste your values into a new TextEdit file. Save your results as a .txt file. Then open Excel and import the data using File > Import.) You should see a sine wave. Play around with the number of samples and the time between samples in the sketch, and remake the measurements, until you can plot a sine wave with 6 or more complete cycles and about 20 points per cycle (or the maximum number of points you can get if you set the delay time to zero). Save this data and write down the identification number on the sine wave printed circuit board.

If you are more interested, read through the sketches to understand how it works. The Arduino website has an excellent reference section which explains Arduino syntax and programming elements (http://arduino.cc/en/Reference/HomePage). Details on the “ReadAnalogVoltage” sketch are found here: http://arduino.cc/en/Tutorial/ReadAnalogVoltage .

MecE-301

8

3

QUESTIONS

Please do the following: 1. Fill in all values and sketches in the Tables 1-8. You need to include a copy of these tables in your worksheet. 2. Plot the sine wave (voltage vs time) measured by your Arduino. Make sure you follow the course requirements for your plot. Give the identification number of the printed circuit board in the figure title. 3. Using the data you collected from the Arduino calculate: a) The peak-to-peak VOLTAGE of the sine wave (Note: The code you used gave you the number of counts, i.e. a value between 0 to 1023), b) The mean voltage (or “DC offset”), c) The frequency, f, of the wave and d) Total uncertainty in your calculation of the frequency.

HINT: Calculate the frequency by calculating the time (i.e. period, T) between the maximum voltages of two consecutive cycles. Calculate this time for the 6 or so cycles you measured and average them. Using these measurements for the period, calculate the precision uncertainty. A major source of bias uncertainty is the time resolution of the measurement (i.e. you don’t really know the exact time when the maximum voltage occurred because it likely fell between two samples). You can consider the average sampling time (the time between samples), when the “delay time” is zero as bias uncertainty. After calculating the total uncertainty of the period, calculate the uncertainty in the frequency using propagation of uncertainty (Section 3 in the Lecture 1 notes) and knowing f=1/T.

MecE-301

9...


Similar Free PDFs