0% found this document useful (0 votes)
330 views15 pages

Open-Loop and Closed-Loop Control of A DC Motor With Ni Myrio

This document provides instructions for an experiment using a NI myRIO device to perform open-loop and closed-loop control of a DC motor. The objective is to help students understand DC motors, control methods, PID controllers, and PWM. The experiment hardware includes an H-bridge motor driver, geared DC motor, myRIO breadboard adapter, and wires. The first exercise describes open-loop control by setting the PWM duty cycle. The second exercise adds a PID controller in a closed-loop to read motor position with an encoder and vary the duty cycle to reduce error between the setpoint and measured position. Students are instructed to write a lab report analyzing their results and discussing PID control performance and limitations.

Uploaded by

kamal wani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
330 views15 pages

Open-Loop and Closed-Loop Control of A DC Motor With Ni Myrio

This document provides instructions for an experiment using a NI myRIO device to perform open-loop and closed-loop control of a DC motor. The objective is to help students understand DC motors, control methods, PID controllers, and PWM. The experiment hardware includes an H-bridge motor driver, geared DC motor, myRIO breadboard adapter, and wires. The first exercise describes open-loop control by setting the PWM duty cycle. The second exercise adds a PID controller in a closed-loop to read motor position with an encoder and vary the duty cycle to reduce error between the setpoint and measured position. Students are instructed to write a lab report analyzing their results and discussing PID control performance and limitations.

Uploaded by

kamal wani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Open-Loop and Closed-Loop Control of a DC

Motor with NI myRIO


Dr Appolinaire Etoundi and Dr Aghil Jafari
Department of Engineering Design and Mathematics
University of the West of England, Bristol, UK

Module Title: INTEGRATED ELECTRO-MECHANICAL SYSTEMS (UFMFSL-15-3)


Lab Session: No. 7
Room: Mechatronics Lab (1N12B)

Objective
This lab has been developed to help students understand the following:

▪ The concept of Dc motors and controller.

▪ Open-Loop and Closed-loop control method.


▪ How PID controller works.

▪ what is PWM.

1 Experiment Hardware components


▪ H-bridge (PmodHB5)
▪ Geared motor

▪ Breadboard Adapter for NI myRIO


▪ Electric wires

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.

c. Go to the myRIO option as 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.

f. Now, press the Next button as 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 Exercise 2: Closed-Loop Control of a DC Mo-tor

4.1 Steps
a. Open the code you made for Open-Loop Control.

b. Open up some vertical space immediately to the right of the Encoder


Ex-press VI (press \Ctrl" and left-mouse click and drag) and then
disconnect the error cluster from the encoder VI.

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"

f. Connect the PID output to the PWM duty indicator

g. Create a control for the PID setpoint input, and


h. in the front panel, initialize the Kc to 0.4, and Ti to 0.4.
i. Finalize the code as below.

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.

5.2 Open Question to be answered for the Group Report

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)

5.3 Questions to be answered for the Group Presentation/VIVAs


a. Change the gain values to improve the tracking. Describe and explain
the effect of each gain on the tracking.

b. Investigate PID controllers and explain what prevents a \perfect


tracking" (Zero Error)?
c. What is the solution to improve performances?

d. What are the pros and cons of using a PID controller?


14

You might also like