M.E. 401 – Mechatronics Laboratory Four Waveform Generation and Analysis, Fourier Seires Required Materials Hardware P.C. Multi-Function data acquisition board Speaker and Microphone Software Measurement and Automation eXplorer (MAX) LabVIEW Study Material Course Text LabVIEW Manual Purpose Be able to generate a certain functions. Understand Fourier Seires. Generate sine and square waveforms and observe their frequency spectrums. Understand FFT and how it transfers time domain to frequency domain Introduction We will generate square and sine waves in the time domain. During this process, we will use a FFT to transform the wave form from the time domain to the frequency domain. We will represent the signals in terms of its frequency and its amplitude. Any waveform can be analyzed in terms of the harmonics that compose the signal. We will use harmonic analysis (also called Fourier analysis) to break down a signal into its harmonics and analyze the signal. Part1. Waveform Generation Sine Wave Generation 1 Create a new VI with an On-Off switch. 1. Configure an analog output channel a. Create an Analog Channel as in lab 1 using DAQmx Create Virtual Channel.vi and place on the left side of the block diagram. b. Add a control to select the appropriate line you want to control. c. Add a constant for the min and max values. Set to 0 and 5. Move to the Block Diagram and configure the internal components of your VI. 2. Create Case Structure a. Right Click in the block diagram to bring up the Functions Panel, and select Case Structure from the Structures subpalette. Click and drag cursor in the block diagram to place and size the structure. (Create Virtual Channel and Boolean Control should be outside and to the left of your case structure) b. Wire the Boolean Control to the Case Structure by attaching the T/Fbox to the case selector located on the case structure frame. c. Configure the Case Structure i. Inside the True frame of the case structure, add a Sine wave vi from the waveform generation from Signal processing subpalette of the Functions menu. ii. Now right click on the frequency terminal of sine waveform and go to create and select control. Notice the changes in front panel. iii. Follow the same procedure for amplitude and phase terminals on sine waveform. iv. Now go to front panel and bring up the control menu by right click. Go to modern subpalette and select the Waveform Chart from graphs subpalette. Place the waveform chart by right click on the front panel. v. Notice the waveform chart vi. In block diagram. Place it inside the case structure. vi. Inside the True Frame, add DAQmx Write. Right Click on the Arrow, Select Type=>Analog=>Single Channel=>Single Sample=>DBL. Your Block Diagram should look something like this so far While Loop: executing commands until a condition is TRUE. Whe the power to the instrument is ON (Boolean TRUE) the VI will send a series of pulses to the digitally connected LED. To accomplish this task, we make use of a While Loop that executes the commands within its window until a condition is TRUE. The condition we will use is a certain number of iterations. 3. Configure the While Loop a. Add a While Loop and place it outside of the Case Structure. The Boolean Control should be inside the While Loop, but outside the Case Structure. 4. Now right click on the loop condition and select the create control option. 5. Wire the DAQmx Analog Channel terminals. a. Wire the Task output from Create Virtual Channel to the input of DAQmx Write. b. Wire the Error out from Create Virtual Channel to error in of Sine waveform .vi. Now wire Error out from Sine waveform .vi to the input of DAQmx Write. c. Wire the Signal out from Sine waveform .vi to the data terminal of DAQmx Write. Also wire the Waveform graph with the wire joining the signal out of the Sine waveform .vi to the data terminal of DAQmx Write d. Add DAQmx Clear Task.vi to the outside-right of the While Loop in the Block Diagram. Wire the task and error output of DAQmx Write to DAQmx Clear Task. e. Check your work by making sure that there are connection tunnels passing through each of the While Loop, Case Structure, and Sequence Structure. The tunnels, or data entry and exit terminals, on the right-hand side of each structure will have white centers because the FALSE case has not been wired yet. f. Toggle case structure to FALSE. Wire Create Virtual Channel task and error out terminals to Clear Task VIs task and error in terminals by spanning the empty Case Structure. You should now be ready to run your program. Set the analog line, frequency, and amplitude. Here is an image of Part 1 Front Panel and Block Diagram Plot the front panel and block diagram Part 2. Fourier series Create a vi that uses three sine waveforms to approximate the square wave. This will be accomplished through the use of a Fourier series. Any periodic function that is piecewise continuous can be represented by a Fourier series. We will not discuss the Fourier series in great detail but note that the Fourier series generally consists of Fourier coefficients with sine and/or cosine terms. The appropriate form of the Fourier series will be given to you. Be sure to include the appropriate controls and indicators (charts/graphs – for the harmonics) to monitor the approximation, and feel free to experiment with the program. (Hint: Use “add” to add 3 sine waves together with specific freq. and apm. below.) Sine Wave Information Sine Wave 1 Sine Wave 2 Sine Wave 3 Frequency .1591 .4774 .7957 Amplitude 1.27 .4244 .2546 Plot the front panel and block diagram Explain how you simulate a square wave using Fourier series (Hint: In this case , we use 3 sine waves.) Your report should follow the format described below: 1. Lab title 2. Hardware and Software 3. Objective 4. Descriptions of the problems you have experienced and how you solved them 5. Solutions to all the questions (will start with a bullet in the lab transcripts). Note that brief explanations or descriptions after each plot are required. 6. Plots that need to be printed out (will start with a bullet in lab transcripts) have to be attached with lab reports. Plots should be created by selecting “File”-“Print”-“Next”-“icon, description, panel and diagram”-“Print” options, which will also include your lab records such as time or date, etc. 7. Summary or conclusion