36
California University of Pennsylvania
Department of Applied Engineering & Technology
Electrical Engineering Technology
EET 370: Instrumentation Design 1
Lab No. 2
Servomotor Analysis and Control
Servomotor Analysis and Control
Laboratory Experiment Objective.
This is a multistage experiment. Students will gain understanding of different motor control techniques.
In order to achieve this objective, student will demonstrate the ability to:
- use software tools to investigate the behavior of a servomotor
- use software tools to interface, acquire, analyze, and control a servomotor.
- analyze and discuss the effect of different control strategies on a servomotor.
- Optional, students may synthesize, construct, and implement analog controllers.
Preface:
This experiment is divided into several sub experiments. Students should read all steps carefully and make best judgments as they proceed through these experiments. Since all experiments are related in the way they build on each other, it is imperative that each experiment is performed excellently.
Students must read all steps and perform all required tasks.
The complexity of the experiments increase as we advance through the set.
Deliverables:
A formal laboratory report is to be submitted at the conclusion of the set. Thus, students are encourage to document all steps and to save electronic copies of all results.
Experiments:
The experiments are as listed below. A brief explanation of each experiment is provided (as needed.)
Experiment 2-A: Introduction to LabVIEW DAQ system (Two weeks experiment)
Experiment 2-B: Servomotor interface to LabVIEW. (One week Experiment)
Experiment 2-C: Investigation of Servomotor Open-Loop and Closed Loop performance
Experiment 2-D: Controller Design and Implementation – speed control ( PID)
Experiment 2-E: Controller Design and Implementation – Position Control (students are to decide on best control strategy)
Experiment 2-F: Controller Design and Implementation- speed control (Phase Lag, Phase Lead)
Experiment 2-G: Controller Design and Implementation - speed control (Phase Lead-Lag)
Parts Needed:
- myDAQ
- 2n3904 and 2n3906 BJTs
-LM 741
- Pololu 6VDC, 120 RPM 50 oz-in Gearmotor w/ Encoder
- Breadboard
Reading References
1- Refer to the “Servomotor Identification” document on my web page under EET 410 labs.
2- Refer to the datasheet regarding the servomotor (found under Labs for this course)
3- Refer to Chapter 8 in your textbook and to the myDAQ Specifications and User’s guide on the course’s page.
Experiment 2-A: Introduction to LabVIEW DAQ system
Answer all question clearly and completely.
Objective: To gain first hand familiarity with some of the DAQ device I/O terminals and capabilities
Section I – Analog Input
A- Getting to Know the Data Acquisition (DAQ) board
The DAQ device used in the laboratory is National Instrument’s myDAQ
NI myDAQ provides analog input (AI), analog output (AO), digital input
and output (DIO), audio, power supplies, and digital multimeter (DMM)
functions in a compact USB device
From the myDAQ Specs. and User’s Guide, answer the following:
a- Number of possible analog inputs in differential mode is ------, and the number of analog inputs if used in stereo audio input is: ------
b- These analog inputs operate in differential or single ended mode ? ------
c- Sampling rate in one channel mode is ------
d- The maximum voltage range on the analog inputs is ------
e- Number of bit in the A/D conversion is ------
f- Number of analog outputs as ground referenced is ------, and as audio stereo outputs is ------
g- the D/A conversion for the analog output is ------bits
h- the maximum update rate is ------
i- the maximum range on the analog output is ------
j- the maximum output current per channel is ------
k- the maximum TOTAL power available from the power supplies is ------
l- Number of digital I/O lines is ------
m- How are the digital lines configures as inputs or as outputs ? ------
n – the maximum output current per DIO line is ------
o- Number of counters/timers ------, number of bits (Resolution) ------, frequency
------, the maximum update rate is ------
p- Which pins are used for the timer counter functions ? ------
q- What does PFI stand for ? ------
r- What is the difference between RSE (Reference Single Ended) and Differential mode inputs ?
s- Give an example where differential mode input is mostly used. ------
B- Test the DAQ board
1- Do not launch LabVIEW yet.
2- Connect the 20-pin screw terminal connector to the board (most probably already done)
3- Using the USB cable, connect the myDAQ to your PC
4- Once acknowledged by the PC, launch the Measurement and Automation Studio . It should be found on the desktop.
5- In the Measurement and Automation Studio, expand the Devices and Interface
6- find myDAQ and click on it.
7- click on Self-Test -- if all is ok, should get a passing message.
8- click on Test Panel >Analog Input>Start. Should see a noisy signal.
9- click on Digital I/O , Click Start, set the line directions to All Outputs> change the states and watch the results below. Stop
10- click on Counter/Timer>change the mode to Edge Count. Start, should see counting due to noise.
11- if all the above work, the device is working properly. Close the M&A studio
C- DAQ as an input device –DC Input
1- Ensure that the voltage applied to the DAQ never exceeds 10V. (For our case, we will always work with a maximum of +/- 8V)
2- Run LabVIEW
3- Start a blank VI and develop a DC voltmeter
· on the block diagram, functions>Input>DAQ Assistant (may be different path: Functions>Measurement I/O, Dmax, DAQ Assistant)
· A menu pops up, select Acquire Signal>Analog Input>Voltge>Analog Input 0 (AI0), then click Finish
· Click on the Terminal Configuration, you will notice, you cannot change the mode from Differential for this DAQ.
· Set the acquisition mode to One Sample on Demand.
· select analog input channel 0 (ai0)
§ On the Front panel, place a numeric indicator and set the range to be -10 to +10
§ select the Digital Display to be as shown.
§ In the block diagram, connect the DAQ assistant output to the meter indicator.
§ Enclose the two items in the block diagram with a while loop
§ Make sure the bench power supply is turned all the way down to zero volts
and that it is turned OFF. From your bench power supply, connect the ground to the AIGND and the DC voltage to the AI0+.
· Run the VI. Slowly increase the DC voltage (NEVER EXCEED 8Volts.) You should notice the meter reading changing accordingly.
· Set the DC supply to 5 volts. Does your meter measure 5V (within 2%)? ------
· There should be an error in the reading. This should be due to the fact that the DAQ
input configuration is ------?
§ Stop the VI, Connect the AI0- to the AIGND to the bench reference. Run the VI. Is the voltmeter providing more accurate results ? ------
§ Demo to instructor.
§ Double click on the DAQ Assistant and change the acquisition mode to Continuous.
§ Run the VI ---- vary the DC input (careful not to exceed 8 Volts.) Do you notice any difference in performance?
Comments: ------
D- DAQ as a DC output and DC input Device.
Remove any wiring connections to the myDAQ.
1- Start a new blank VI
2- Build this on the front panel.
3- Place a while loop in the block diagram to enclose the control and indicator and to allow room for adding two DAQ Assistants.
4- Place a DAQ Assistant and select Generate Signal>Analog Output>Voltage>0 (AO0)
5- change the generation mode to continuous and set the min and max ranges to -8 and +8 volts. Click OK
6- Connect the control (output voltage) to the DAQ Assistant’s input.
7- Place a DAQ assistant and configure it as analog input voltage at AI0. Set the range to +/-8 Volts and set the acquisition mode to continuous.
8- Connect the meter indicator to this DAQ assistant’s output. This will be the input from the DAQ to LabVIEW.
9- On the myDAQ, connect the Analog output GND to the Analog Input GND and connect AI0- to the analog input GND. All are set to the GND reference.
10- Connect the Analog output 0 (AO0) to the Analog Input 0+
11- Run the VI, you should notice that the meter reading is displaying the signal provided by the control knob. Using digital displays to show accurate readings.
12- Demonstrate to instructor.
Section II – Analog Output
Part –A DC output
1- Design a simple VI so that the user can manually adjust a DC voltage level between -5 to 5 Volts Make sure the knob control shows a digital display. Set the digital display to two decimal places.
2- Using the DAQ assistant, configure it for DAQ analog output voltage on ao0. On the configuration window, set the min and max to -8 to +8 Volts ,respectively. Set the configuration mode to On Demand.
3- Monitor the DC output using the bench DMM and verify correct operation.
4- Configure a DAQ assistant for analog input at ai0. Set the min and max to -8, +8, and configuration mode to On Demand.
5- feed the DAQ DC output of step 2 above back into the DAQ input. (ensure the differential mode is connected properly.)
6- Note, tie analog out ground to the analog in ground and to the bench meter’s ground.
6- Display the reading using meter indicator and verify correct operation. Include a digital display with the meter. Set the display to two decimal places.
7-enclose the DAQ system on the block diagram in a while loop.
Place front panel (showing results) and commented block diagram here.
Part - B Continuously varying DC output
1- Do not modify the DAQ assistants of part A.
2- Remove the knob control on the front panel. The Varying DC is to be generated automatically.
3- Design the VI so that it outputs automatically a DC voltage between -4 to +5 volts in increments of 0.5volts. Wait 1000ms between increments (or enough time for you to distinguish values.) The loop should then automatically stop once the output just exceeds 5Volts.
4- The front panel should have the meter reading and a switch to power the VI ON to start incrementing (do not bother with turning the VI off during the process.) Verify operation of measurements and the power switch.
5- Use decoration and good layout on the front panel.
Place front panel (showing results) and commented block diagram here.
Part - C Analog Output (AC)
1- Start with a blank VI
2- place a signal generator VI on the block diagram.
3- On the block diagram, create control inputs for amplitude, frequency, signal type and sampling information. Your block diagram should look like this
The Front Panel should look like this:
Change the amplitude to 2V, the frequency to 500Hz, the sampling frequency to 20K and the number of samples to 1000. Select sine wave for the signal type.
4-Place a waveform graph on the front panel and resize it to be easier to read.
5- Place a DAQ Assistant and set it up for analog output voltage at AO0. Enclose all Vis on the block diagram with a while loop
Configuration of the DAQ Assistant: This part is tricky and it is worth spending time on it to better understand it.
- we would set the Generation mode to On Demand if the signal is at DC or if it is at a VERY low frequency (1 or 2 Hz.)
- However, we prefer continuous generation mode. BUT, we may run into computer hardware problems. Data may fill the buffer too fast (faster that reading it) or the data in the buffer may be overwritten before it is read – thus lost.
e- For now, set the Generation mode to Continuous Generation , a sampling rate of 20KHZ and 100 samples to write
f- On MyDAQ, feedback the DAQ output to the analog input (ensure the differential input is taken care of.)
g- Place another DAQ assistant to acquire a voltage signal at AI0. Set up DAQ assistant to the same voltage levels and same terminal configurations as above.
h- Tricky part again: Set the acquisition mode of the N samples. This way, the DAQ will read the exact number of samples available in the buffer with samples to read = 100 and a sampling frequency of 20K.
You should have the following on the block diagram.
6- Set up a sine wave signal at 500Hz and 2V pk.
7- verify the signal output using the scope (waveform graph) on the front panel.
8- On the front panel, change the time scale on the waveform graph to a maximum of 4ms and disable auto scaling on the x-axis. Change the input frequency to 1KHz. Do you still obtain a reasonable waveform ? ------
9- While the VI is running, Change the input frequency to 2KHz. Do you still notice a reasonable
sine wave ? ------What distortion do you notice ? ------
10- While the VI is still running, change the # of samples on the front panel to 10000. What do you notice?
11- Stop he VI. On the block diagram, change the number of samples to write and to read to 2K. Run the VI, you should notice slight improvement in the waveform.
12- While the VI is running, change the input frequency back to 1KHz. You should see a proper sine wave. ? ------
13- Again, while the VI is still running, change the input frequency to 4KHz. What do you notice ?
14- While the VI is running, slowly increase the input frequency until the waveform changes to a triangular wave.
Explain why did this happen : ------
At what input frequency did this occur ?
15- change the input frequency back to 1KHz and, while the VI is running, change the signal type to sawtooth, square wave, and triangular wave .
16- Remove the DAQ input { labeled as “From DAQ” } (to optimize performance) and only obtain a sine wave output