0% found this document useful (0 votes)
23 views4 pages

Lab 3 Control

The document discusses conducting an experiment to analyze the behavior of a DC motor. It involves using an Arduino connected to a rotary encoder to read motor speed data and sending it to MATLAB. The tasks are to plot the step response of the motor using experimental data, determine the transfer function of the motor theoretically and experimentally, and compare the theoretical and experimental responses.

Uploaded by

Osama Gaming
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)
23 views4 pages

Lab 3 Control

The document discusses conducting an experiment to analyze the behavior of a DC motor. It involves using an Arduino connected to a rotary encoder to read motor speed data and sending it to MATLAB. The tasks are to plot the step response of the motor using experimental data, determine the transfer function of the motor theoretically and experimentally, and compare the theoretical and experimental responses.

Uploaded by

Osama Gaming
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/ 4

Lab 3

Objective:
a) To read the speed of dc motor through encoder using arduino and MATLAB.
b) To plot the step response of dc motor using experimental data.
c) To determine transfer function of a dc motor and compare theoretical and hardware
responses.
Apparatus
 DC motor control apparatus
 MATLAB in Laptop/PC
Explanation:
A first order control system is defined as a type of control system whose input-output
relationship (also known as a transfer function) is a first-order differential equation. A first-
order differential equation contains a first-order derivative, but no derivative higher than the
first order. The order of a differential equation is the order of the highest order derivative
present in the equation.

Figure 3.1 Block Diagram of the first order system.


Where:
K is the DC Gain
T is the time constant of the system
Time Constant:
The time constant can be defined as the time it takes for the step response to rise up to 63% or
0.63 of its final value.
DC Gain K
DC Gain of a system is the gain at the steady state which is at t tending to infinity i.e., s
tending to zero.
Poles of a Transfer Function:
The poles of the transfer function are the value of Laplace Transform variable(s), which
cause the transfer function to become infinite. The denominator of a transfer function is
actually the poles of function.
Zeros of a Transfer Function:
The zeros of the transfer function are the values of the Laplace Transform variable(s) that
causes the transfer function becomes zero. The nominator of a transfer function is actually the
zeros of the function

Figure 3.2 Response of first order system using step input.


Procedure:
1. Connect setup of DC motor with MATLAB.
2. Select COM port of arduino connected with pc.
3. Upload code in arduino with encoder configuration at pin 2 and 3 and ppr 475.
4. Run motor and store data in array.
5. Plot the graph using plot command
6. Find steady state value of the system which is the dc gain K of our system
7. Find time required to reach 63.2 % value from the graph which is time constant T of
the system.
8. Repeat the experiment at least 3 times and take average of the value.
9. Use first order equation to find the transfer function of the system.
10. Compare the practical and transfer function graph.

Result:
K = 75
T = 0.45
TF = 47.25

Task:
Write a MATLAB code to meet above objectives. A sample code is given below:
firstly check Arduino is connected to which port of PC/Laptop;
clear all;
a = arduino (‘COM port#’, ‘Uno’, ‘Libraries’, ‘rotaryEncoder’);
declare rotary encoder function;
use a ‘rateControl’ object from help, it will enable you to run a loop at a fixed frequency;
generate signals at arduino digital pins that will connect to motor driver;
generate PWM signal at arduino digital pin to enable motor driver;
use ‘readSpeed’ function to read the motor speed for 100 iterations;
after that disable PWM digital pin to stop motor;
generate a time vector;

plot time versus speed plot in MATLAB;

Question: What is the execution of functions ‘rotaryEncoder’ and ‘rateControl’?


'rotaryEncoder' could be used to read the position of a rotary encoder, which is a type of input
device that is commonly used to control settings on electronic devices such as volume controls
or menu navigation. This function may use interrupts or polling to check the status of the rotary
encoder, and then perform some action based on the current position of the encoder.
On the other hand, the function 'rateControl' could be used to control the rate of something,
such as the speed of a motor or the flow of a fluid. This function may take some input value,
such as a desired speed or flow rate, and then adjust the output accordingly using a feedback
loop or other control algorithm.
Conclusion:
In conclusion, these three tasks are related to the analysis and control of a DC motor. In task a,
a rotary encoder is used to read the speed of the motor, which is then transmitted to MATLAB
for further analysis. Task b involves plotting the step response of the motor using experimental
data, which can provide insights into the motor's performance and stability. Finally, in task c,
the transfer function of the DC motor is determined through both experimental and theoretical
methods, and the accuracy of the theoretical model is evaluated by comparing it to the
experimental data.

Overall, these tasks illustrate the importance of understanding the behavior and dynamics of a
DC motor, as well as the need for accurate and reliable measurement and control systems in
order to optimize its performance in various applications.

You might also like