ME461_Lab5 - ME 461 Laboratory #5 Characterization and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ME 461 Laboratory #5 Characterization and Control of PMDC Motors Goals: 1. 2. 3. 4. 5. 6. Build an op‐amp circuit and use it to scale and shift an analog voltage. Calibrate a tachometer and use it to determine motor speed. Control a PMDC motor using two methods (by varying voltage and duty cycle). Understand the function of an H‐Bridge motor amplifier. Use motor current to estimate angular position in static equilibrium. Perform open‐loop control on a PMDC motor and evaluate performance. NOTE: It is very important that you follow the directions in this lab carefully. You will be working with voltages outside the operating range for your microcontroller, so an incorrect connection or prematurely acting could damage the microcontroller. If you are unsure of anything, ask your TA before guessing. Damaging the hardware will obligate you to re‐solder an entirely new microcontroller setup. Exercise 1: (30 points) In this exercise, you are going to build the op‐amp gain and shift circuit you designed as part of homework 5 using the LM741. The goal is to linearly map a voltage in the range of [‐12V, +12V] to a voltage in the range [0V, 3V]. Solder the gain‐shift circuit in the prototyping area of your breakout board. Use the schematic below and the demo board in lab as a guide. R2 Banana Jack Vin +12V R1 VCC 1.5uF 10k Vout Jumper to ADC pin VREF -12V Op‐amp circuit schematic Use the values of R1 and R2 you found in the homework assignment. Your TA will show you where the bipolar power supply is located and help you wire it to your board. Use two banana jacks to bring the ‐12V supply into pin 4 of the LM741 and +12V into pin 7 of the LM741. Also, connect the COM terminal of the bipolar supply to your board’s GND via the banana jack soldered to GND in the last lab. Make sure to leave the jumper between Vout on the op‐amp and the microcontroller ADC pin OPEN until you are told to shunt it later in the lab. Connect the two outer terminals of the motor shaft‐mount potentiometer to +12V and ‐12V. Then, connect the output of the potentiometer to the Vin banana jack. You will use the potentiometer to provide input voltages between ±12 V to your gain and shift circuit for the purpose of establishing the gain and offset. Show your wiring to your TA. Exercise 2: (30 points) First, set Vin = 0V by rotating the motor and potentiometer while measuring the potentiometer output with the digital multimeter (DMM). Then, without disturbing the Vin setting, measure the output voltage of your gain‐shift circuit by switching the DMM to the op‐amp’s output. Now, adjust Vref by tuning the 20 turn 10KΩ potentiometer on your board so that Vout ≈ 1.5 V. Next, set Vin according to the table below by rotating the motor shaft‐mount potentiometer. Record Vout for each case. Use the DMM to measure the input and output voltages. Vin (V) Vout (V) ‐12 ‐8 ‐4 0 4 8 12 Plot the data (Vout vs. Vin) in Excel and fit a linear trend line to the data. Record the exact gain and offset below. Gain: ____________ Offset: ____________ Show your results to your TA. Exercise 3: (40 points) The motor and shaft‐mount potentiometer should already be secured to the bench. Connect the motor+ (red) and motor– (black) terminals to the HP programmable power supply. Disconnect the output of the shaft‐mount potentiometer from your gain‐shift circuit’s input and switch it to be connected instead to the oscilloscope. As you will see below we are going to use the potentiometer’s output to calibrate the tachometer’s gain. The oscilloscope ground should be connected to the common ground (either at the ±12V COM terminal or at the banana jack connected to your board’s GND). Connect the tachometer ground (grey terminal) to the same common ground and the tachometer output (orange terminal) to the Vin banana jack. Now you are ready to determine the relationship between motor RPM and tachometer output voltage. As a precaution, set the ADC10AEx bit corresponding to the analog channel you will connect to the op‐amp output. Show your TA your wiring and that you have loaded the configuration to your microcontroller and he/she will provide you with a jumper shunt to connect the op‐amp output to the ADC. Write a program to sample the op‐amp output voltage and display the reading in millivolts to the terminal window. As always, leverage previously written code. By varying the voltage across the motor terminals, it is possible to drive the motor at different speeds. You can reverse the direction of rotation by reversing the polarity of the voltage applied to the motor power terminals. That is simply swap the red and black wires plugged into the programmable power supply. Ensure that there are no wires laying over any rotating parts. Set the programmable power supply’s current to 2A and apply several voltages (positive and negative) to the motor. With the motor stationary, the output of the gain‐shift circuit should be roughly 1.5V. With positive velocity it should decrease toward 0V and with negative velocity it should increase toward 3V. Observe the waveform generated by the spinning potentiometer on the oscilloscope. You can measure the rotational speed of the motor by measuring the frequency of the sawtooth waveform on the oscilloscope. Select Measure → Time → Frequency to display an automatic reading of the motor’s speed in rotations per second. For the voltages listed in the table below, record the output voltage of the gain‐shift circuit and the speed of the motor in RPM. Motor Voltage (V) Vout (V) ‐12 Motor Speed (RPM) ‐10 ‐8 ‐6 0 6 8 10 12 Plot the data (Vout vs. RPM) in Excel and fit it with a linear trend‐line. Record the slope of the line (in volts per thousand RPM) below. Ignore any small y‐offset you may observe. Then, extrapolate the tachometer gain from this number (the gain before passing through the gain‐shift circuit). Check the values with your TA. Gain (Vout to RPM): _________________ V/ 1000 RPM (mV/RPM) Tachometer gain (Vin to RPM): _________________ V/ 1000 RPM (mV/RPM) Now, modify your program to print the speed of the motor in RPM to the terminal window. Always remember to use integers only and to scale operands appropriately. Demonstrate to your TA for several positive and negative motor voltages. Exercise 4: (30 points) Before beginning the remainder of the lab, you need rewire a few things and solder two more banana jacks. Refer to the demo board in lab as you make the following changes. First, disconnect all the wires connecting the ±12V supply to your board and to the motor’s potentiometer. You are done using the ±12V supply and the gain and shift circuit for this lab. Solder a banana jack to your board that connects to Vcc. You are going to be powering the motor’s potentiometer with your board’s Vcc in this and following sections. Also make sure a banana jack is soldered to an open ADC channel. You should already have an open ADC channel connected to a banana jack from lab 4. Wire the pins of a 1‐by‐5 male header to your board in the following fashion: 1 – Digital I/O pin; 2 – Not connected; 3 – Timer B1; 4 – a second open ADC channel; 5 – GND. The second open ADC channel to which you solder pin 4 of the 1‐by‐5 header must be connected to GND through a 2.2‐3.0 kΩ resistor. In the previous exercises, you learned how to calibrate and use the tachometer to measure angular speed of the motor. Now, you are going to calibrate the potentiometer to measure angular position. Connect the oscilloscope or the DMM to the output of the potentiometer, but this time power the potentiometer with the boards VCC and GND. A weighted link has been connected to the motor’s output shaft. Rotate the link to three angles: +90o, 0o, and ‐90o relative to the vertical and record the potentiometer voltage. Link Angle (degrees) Vpot (V) ‐90 0 90 Again, plot the data and determine the best‐fit line that relates angle to potentiometer voltage. Fill in the parameters in the equation below. θ = ________ × Vpot + ________ (degrees) Connect the output of the potentiometer to the ADC channel connected to the banana jack. Write a program to display the angular position (in degrees) of the link attached to the motor. Demonstrate to your TA. Exercise 5: (20 points) Until now, you have driven the DC motor by varying the supply voltage. However, as you learned in lecture, it is possible to exploit the baseband characteristics of PMDC motors to control them. In this exercise, you are going to use the National Semiconductor LMD18200 H‐bridge module to control the motor with a PWM signal. Connect the HP programmable power supply to the power supply jacks on the H‐bridge but do not turn it on yet. Connect the OUT1 and OUT2 leads on the H‐bridge to the motor+ and motor– jacks. Connect your 5‐pin header to the female jack on the H‐bridge (GND to GND). Leverage the code you wrote in lab 2 to develop a program for outputting PWM signals to the H‐ bridge. Set the PWM frequency to 20kHz. Use two of the four traffic signal switches to control the duty cycle in the following manner: both off – 0% duty cycle; both on – 50% duty cycle; switch 1 on – 17% duty cycle; switch 2 on – 33% duty cycle. Use a third switch to control the state of the digital I/O pin wired to the Direction input on the H‐bridge. You do not need to use pin interrupts for the switches in this case; simply read P2IN in the TimerB0 ISR or elsewhere in your program. Load the program onto your microcontroller. After you verify your wiring with your TA, turn on the HP power supply and set the current to 4A and the voltage to 12V. Press the switches in different combinations and observe as the link moves to each static equilibrium state. Also observe the angle reading in the terminal window. Demonstrate to your TA. Exercise 6: (40 points) In this exercise, you will develop another method for estimating the static position of the linkage. You determined the equation for static equilibrium for the motor plus linkage in homework 5 and found that the torque applied to the motor by the linkage arm was balanced by the torque applied to the linkage arm by the motor. L θ Linkage free‐body diagram Recall that motor torque m = Kmim. As you also know from homework 5, the LM18200 H‐bridge makes measuring motor current easy because the H‐bridge outputs a current on the Sense pin that is proportional to the motor current. Thus, isense = Ksense∙im. If a resistor is connected between the Sense pin and GND, the voltage across the resistor can be measured by the ADC on the MSP430F2272 and used to determine the Sense current: Vsense = Rsense∙isense. You used this knowledge in the homework to show that the Sense voltage is linear in the sine of the linkage angle: Vsense Ksin , where K is constant that lumps together the relevant physical parameters (i.e., Ksense, Rsense, mass m, acceleration due to gravity g, linkage effective length L, and motor constant Km) responsible for the static response of this system. As you might have guessed, you are going to estimate the lumped parameter in the above equation using data measurements. Attach the DMM or scope to the ADC pin on which the Sense voltage is present. Configure the pin as an input (digital or analog, for now) so that it is high‐impedance, but do not worry about sampling the channel yet (you have not yet learned how to sample multiple ADC channels and we still need to sample the potentiometer). Load the program to your MCU. Send several duty cycle commands to your motor using the three switches and record the resulting angles from the terminal window and Sense voltages from the DMM or scope. 33% 17% 33% 50% Reverse Vsense (V) 0% Link Angle (degrees) 17% Forward Duty Cycle 50% Direction Plot sinθ vs. Vsense and θ vs. Vsense on the same plot. Notice that for small angles, θ is a good approximation of sinθ. Determine the slope of the sinθ vs. Vsense plot and record it below. Also plot Vsense vs. duty cycle and record the slope below. Check with your TA. sinθ = ___________ × Vsense Vsense = ___________ × duty cycle (V) The equation you just found for link angle is called a grey‐box model because it is based on physical laws and parameters, but it does not explicitly identify all of the physical parameters. Modify your microcontroller program to sample the voltage across the Sense resistor (comment out the previous configuration; you will need it again). Use the model you found and the assumption that θ is small to estimate the link angle from the motor current. Print the link angle to the terminal. Demonstrate to your TA as you vary the input. Exercise 7: (10 points) Now, modify your program so that instead of specifying a duty cycle with the switches, you specify an angle in [‐π/3, π/3]. Then, in your program, calculate the duty cycle required to produce that angle by using the equations you found in exercise 6. Send that duty cycle to the H‐bridge. Also, revert back to sampling the potentiometer reading. Print the angle command from the switches next to the angle measured from the potentiometer reading. With your hand, simulate the effect of adding extra weight to the linkage by gently pressing downward on the suspended link. What happens to the angle reading and the command? Set the angle command to 0o and move the linkage. What happens to the angle reading and command? Explain this discrepancy to your TA. You have just observed the motivation for closed‐loop control and sensor feedback. Open‐loop control is sensitive to both disturbances and parameter uncertainty. Also, if you compare your results to those of your labmates, you will likely recognize that the identification procedure must be performed on an individual basis. This is another drawback of open‐loop control; closed‐loop control allows for some model variation. You will learn more about closed‐loop control in future labs. What do you think some advantages of the current‐sensing configuration might be? Hint: think cost, size, and sensor reliability. ...
View Full Document

This note was uploaded on 11/07/2011 for the course ME 461 taught by Professor Staff during the Spring '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online