Open-Loop and Closed-Loop Control of A DC Motor With Ni Myrio
Open-Loop and Closed-Loop Control of A DC Motor With Ni Myrio
Objective
This lab has been developed to help students understand the following:
▪ what is PWM.
1
Figure 1: H-bridge and geared motor
2 Experiment Setup
Construct the circuit on the breadboard according to the schematic shown below
2
3 Exercise 1: Open-Loop Control of a DC Mo-tor
3.1 Steps
a. Click on the encircled button Create Project.
3
b. The new window with multiple options is shown in the figure below.
4
d. Select the myRIO Project from the right portion of the window.
e. The both of the above steps are shown in the figure below.
Just after pressing this button you will be able to see a new window on
your computers screen.
g. Select the Plugged into USB option and press Refresh button, your
attached myRIO device will be detected in this way.
IP address of the used NI myRIO is encircled in the below figure as 22.
11.2.
The newly opened window with a bit detail is shown in the figure below.
5
h. The destination of the le which is being created is shown in the figure
below.
i. Now, press the Finish button as highlighted in the figure shown below.
j. As you press this button a new window will again appear on your com-
puters screen.
k. Go to the \myRIO-1900 (xxx.xx.xx.x)"as encircled in the figure below.
6
l. Now go to the \myRIO-1900 (xxx.xx.xx.x)" and \Right Click" on it.
m. By doing so, you can see a lot of options here in the new mini window,
go to New-> VI.
The above steps are shown in the figure given below.
n. As u press the VI two windows, Front Panel and Block Diagram will be
appeared on your computers screen.
o. Both the windows are shown in the figure below.
7
p. Now, press <Ctrl+t>, both of the windows will be aligned in this way.
q. in the front panel, and from \Modern" sub palette drop \Vertical Pointer
Slide", \Meter" and \wave Form Chart", and finalize it as below
r. In the block diagram panel, drop \Encoder" from myRIO sub palette,
and set it as below
8
s. Drop \PWM" from myRIO sub palette, and set it as below
9
t. Drop \PWM" from myRIO sub palette, and set it as below
10
u. Finalize the code as below
11
v. Save the code and run it.
4.1 Steps
a. Open the code you made for Open-Loop Control.
c. Place the PID controller located in the Control & Simulation PID
subpalette in this space
d. Create front-panel controls for the proportional gain, integral time, and
derivative time values. Also create output range from -100 to 100.
e. Right-click on the PWM duty control and select \Change to indicator"
12
j. Save and run the code.
5 Report
5.1 Report sections*:
1. Introduction (literature survey-background information) ( 10%)
2. Definition of the experiment (diagrams, schematics, etc.) ( 10%)
13
3. Details of apparatus settings ( 5%)
4. Results and analysis and graphs presentation ( 40%)
5. Discussion, comments and reflections on the experiment ( 30%)
6. References ( 5%)
*Note: The percentages are solely marking indications and may vary.
Can you get a perfect tracking (error=0) with a PID control for this experiment?
If not, what is the trade-off you have to consider to get closed to zero error?
(mention the pros and cons of your solution)