ENGR 1110: Introduction to Engineering Lab 7 • • CH1 VOLTS/DIV knobÆ 5 AC/GND/DC switch Æ AC • • HORIZONTAL MODE switch Æ A A and B SEC/DIV Æ 1 ms In-Lab Activity 1) Get a cable with a BNC connector on both ends: 2) Connect one end of the cable to the output of the function generator and the other end to CH1 on the oscilloscope. 3) Set the function generator to the following settings: • • • • • • FREQUENCY knob Æ 3 AMPLITUDE knob Æ max (fully clockwise) 0 dB/-30 dB buttonÆ 0dB (pushed in) WAVEFORM button Æ sine wave DC OFFSET knob Æ off (fully counterclockwise) RANGE-Hz button Æ X1k Turn on the oscilloscope. Adjust the CH1 vertical POSITION knob until the trace is on the horizontal axis. This sets the output to a sine wave at 3 kHz (FREQUENCY x RANGE), with an amplitude of approximately 10V (AMPLITUDE at max). Keep power off until oscilloscope is set up. 4) Set the oscilloscope to the following settings: • VERTICAL MODE switch Æ CH1 Turn on the function generator. The display should look something like the following: set to in order for one period to be to equivalent to 3 horizontal blocks? 10) Continue to play with the settings on the function generator and the oscilloscope until you feel comfortable with their basic settings. For the function generator, focus on the following: frequency knob, range buttons, amplitude knob, waveform buttons, and the DC offset knob. For the oscilloscope, focus on the volts/div knob and the sec/div knob. If you have any questions, ask your T.A. Do not worry about the other settings on the oscilloscope unless the signal is not clearly visible. If the sine wave is not stable and clear even after checking to make sure the above settings are correct, ask your T.A. for assistance. These settings have equated each vertical block equal to 5V and each horizontal block to 1 millisecond. 5) Use the display on the oscilloscope to calculate the frequency of the sine wave (in Hz). Remember 1 Hz = 1/s. 6) Change the following settings on the function generator: • • FREQUENCY Æ 9 RANGE button Æ X100K 7) Manually adjust the oscilloscope until the sine wave can be seen clearly. Notice the max amplitude is significantly lower. This is because the function generator has a max power output, and higher frequencies require more power. This means that the max amplitude decreases as the frequency increases. 8) Calculate the frequency of the new signal two different ways: first, by using the settings on the frequency generator and, second, by using the display and settings on the oscilloscope. 9) Decrease the frequency of the function generator to 20kHz. What setting does the SEC/DIV knob on the oscilloscope need to be 11) In MATLAB, create a 3kHz sound wave using the following commands: >> f0 = 3000; % frequency >> t = [0:1/16000:30]; % time sampling >> x = sin(2*pi*f0*t); % sine wave samples 12) Connect the oscilloscope to the output of the sound card on your PC. Plug a stereo phone plug into the headphone jack, and connect clips to the tip and the main shaft on the other side of the cord. Play the sound with the following command, and display the signal on the oscilloscope. How does it compare to the 3 kHz signal generated by the function generator? >> sound(x,16000) 13) Now, power off and disconnect the function generator. You will not be using it the remainder of the lab. Obtain your RC transmitter and receiver and your motor control hardware. 14) Locate the two input voltage terminals. Jumper the positive terminals together as shown below. Note: the negative (ground) terminals are connected on the board (you can’t change this, and you don’t want to). 15) Connect a power supply (7V-9V) to either input-voltage terminal (DO NOT TURN THE POWER SUPPLY ON UNTIL YOU KNOW THE POLARITIES ARE CORRECT). Because the positive terminals are shorted together by the jumper and the ground terminals are shorted together, it doesn’t matter which set of terminals you connect the power supply to. Signal Once you have connected the power supply correctly and turned it on, the LED should turn on. This indicates there is power to your circuitry. 16) Connect the receiver unit to the motor control board. 5V GND 17) Obtain a cable with a BNC connector on one end with red and black probes on the other end: 18) A PPM signal is transmitted from the remote, captured by the receiver, and input into a microcontroller. This microcontroller outputs 6 servo PWM channels. View CH3 on the oscilloscope by connecting the BNC end to the o-scope, the black probe to any ground on the control board, and the red probe to the CH3 jumper as shown in the next two figures: maximum duty cycle (maximum average voltage): Min: Max: 19) On the o-scope, set CH1 VOLTS/DIV Æ 2 and SEC/DIV Æ 10ms. Turn your TX on, and view the servo PWM signal on the o-scope. It should look like the following: There are six channels that have outputs similar to this one. Each of these can be used to drive servo motors. CH2 and CH3 are inputs into other microcontrollers to produce motor PWM signals. 21) Connect the oscilloscope probes to different servo PWM channels. Play with these and ask questions to your T.A. until you begin to feel comfortable with the oscilloscope, PWM theory, and the basic idea of signals. 22) In MATLAB, generate a PWM signal as follows: >> width = 0.01; >> t = [0:1/16000:0.1]; % time sampling >> period = 1*(t < width); >> x = repmat(period,[1 300]); 20) Adjust the output of the TX by moving the CH3 joystick around. Moving the stick all the way one direction will show the minimum duty cycle (lowest average voltage) and moving the stick completely in the other direction will show the Play the sound and plot on the o-scope: >> sound(x,16000) Increase the width to 0.02 s, and play/plot again. How does this look different from the PWM signal from the board? 23) Make sure you completely clean up your workspace before leaving. Homework (to be done individually and turned in at the beginning of the next lab): Write a short memo to Dr. Reeves using MS Word: 1) Answer the questions in the lab write-up. 2) Create sine waves with sampling period T=1/8000 and duration 5 seconds beginning with a frequency of 100 Hz, and listen with soundsc(x,8000). Gradually increase the frequency up to 8000, and determine the frequency at which the pitch begins to come back down. Can you explain why this happens? It may help to plot a small segment of the signal using plot(x(1:50)) and observing what happens as the frequency increases.