Professional Documents
Culture Documents
Experiment-01: Design and implementation of a circuit to drive a stepper motor using IC’s and
discrete components
Stepper motor: A stepper motor is an electric motor whose main feature is that its shaft rotates by
performing steps; moving by a fixed amount of degrees in response to each input current pulse received by
its controller.
Function: speed control, position control.
Step angle: the angle through which the motor shaft rotates for each command pulse is called the step
angle(β)
Common step angle: 1.8, 2.5, 7.5, 15
Range: 0.72-90 degrees
𝑁𝑠−𝑁𝑟
Step angle, β= 𝑁𝑠𝑁𝑟 ∗ 360
Full step mode: Two phases are energized at the same time.
Half step mode: Combination of wave and full step mode. The step size is reduced to half.
Features of Arduino:
1. It is able to read program from different sensors and turn it into desirable output. Such as: turning a
motor, Turning on/off switch, connect to the cloud and many other actions
3. Arduino does not need an extra piece of hardware to load a new code. USB cable can simply be used to
load the code to the hardware
5. Arduino provides a standard form factor that breaks the functions of the microcontroller into a more
accessible package.
Board description:
Total no of pin- 28
total no of port- 3(B, C, D)
Digital I/O port-14 (among them 6 are PWM of 8 bit resolution)
Analog Input port- 6(Ao-A5) (10 bit of resolution)
8-BIT microcontroller
Powering- Directly powered by computer usingUSB
Directly powered by AC main source using Barrel JACK
Voltage regulator(7805 IC): Helps to control the DC voltage input to the Arduino board used by the
processor and other elements
Crystal oscillator(pin-9, 10): helps Arduino I dealing with time issues. Frequency of the crystal oscillator is
16MHz.
VCC- 3.3V, 5V
Vin- Can be used to provide power from external power source(6-18V).
A built in function “analogwrite()” can be used to generate pulse width modulation signal. Example:
Circuit diagram:
Experiment-03
The void loop() is a function that executes indefinitely until you power off the Arduino.
• This type of motor consists of soft iron multi toothed rotor and a one stator
• Direction of rotation is independent of the polarity of stator current
• The reluctance of the magnetic circuit formed by the rotor and stator teeth varies with the angular position
of the rotor
• It has a wound stator poles but its rotor poles are permanently magnetized
• The rotor no longer has teeth in it unlike VR motor.
• It’s direction of rotation depends on the polarity of the stator current.
Experiment-04: Find overall transfer function of the system given in block diagrams. Also find the poles
and zeroes of the transfer function.
Block diagram- Block diagram is a pictorial representation of a control system. It is used to make a
mathematical model of a control system which can be implemented on a computer.
Pole: A pole is a point in the complex plane where the transfer function of the system approaches infinity.
Zero: A zero is a point in the complex plane where the transfer function of the system approaches zero.
sys1=series(g2,g3);
sys2=parallel(g1,sys1);
sys3=series(sys2,g4);
finalsys=feedback(sys3,h);
Cs=minreal(finalsys) %cancel common terms
[num,den]=tfdata(Cs, 'v')
Experiment-05: Obtain step response of a unity feedback for a given forward transfer function and find ζ,
ωn, Ts, Tp, Tr, %OS.
clc; close all; clear all;
% define transfer function for blocks
num=25; %Define numerator of G(s)
den=[1 5 0];%Define denominator of G(s)
g=tf(num,den);%G(s)
T=feedback(g,1);%Find T(s)
[numt,dent]=tfdata(T,'v');%Extract numerator and denominator of T(s)
Root locus:
path of the closed loop poles.
Nature of the control system
Stability of the closed loop control system
Root locus definition: Root locus is the locus of the roots of the characteristics equation by varying system
gain(K) from zero to infinity.
Case-I: K = 0; Closed loop poles are equal to the open loop poles
Case-II: K = ∞; Closed loop poles are equal to the open loop zeroes
so the root locus branches ranges from open loop poles to open loop zeroes.
Angle condition: The point at which the angle of the open loop transfer function is an odd multiple of 180
degree.
Magnitude condition: The point at which the magnitude of the open loop transfer function is one
Experiment-07: Obtain bode plot for a unity feedback system with a given G(s) for different values of k.
Also, obtain gain margin, phase margin, phase crossover frequency and gain crossover frequency.
Bode plot: It is a graphical technique used to determine the stability of control system.
A bode plot maps the frequency response of the system through two graphs
-Bode magnitude plot
- Bode phase plot
Semi log graph paper is used.
Gain margin: Gain margin refers to the amount of gain which can be increased or decreased without
making the system unstable.
GM=0-G dB
Phase crossover frequency: This the frequency at which the phase curve cuts the -180 degree axis in the
Bode plot.
Phase margin: Phase margin is the amount of phase which can be increased or decreased without making
the system unstable.
PM = ɸ - (-180) degree
Gain crossover frequency: this is the amount of frequency at which the gain curve cuts the zero dB axis in
the Bode plot.
Corner frequency: the frequency at which the two asymptotes cut or meet each other is called break
frequency or corner frequency.
the corner frequency in a Bode plot of a control system is the frequency at which the magnitude
response begins to decrease significantly, and it can be found by locating the frequency where the
magnitude response crosses the -3 dB line.
Code:
(i)
clc; close all; clear all;
Num= input ('Enter num=')
Den= input ('Enter den=')
G=tf(Num,Den)
[GM PM Wpc Wgc]=margin(G)
bode(G)
(ii)
clc; close all; clear all;
w=logspace(-1,2,200);
for i=1:3
if i==1
K=1;
num=[0 0 0 K];
den=[1 6 5 K];
G=tf(num,den);
[mag,phase,w]=bode(G,w);
mag1dB=20*log10(mag);
phase1=phase;
disp('gain margin, phase margin, phase crossover frequency and gain
crossover frequency for k=1')
[GM PM Wpc Wgc]=margin(G)
end
if i==2
K=10;
num=[0 0 0 K];
den=[1 6 5 K];
G=tf(num,den);
[mag,phase,w]=bode(G,w);
mag2dB=20*log10(mag);
phase2=phase;
disp('gain margin, phase margin, phase crossover frequency and gain
crossover frequency for k=10')
[GM PM Wpc Wgc]=margin(G)
end
if i==3
K=20;
num=[0 0 0 K];
den=[1 6 5 K];
disp('gain margin, phase margin, phase crossover frequency and gain
crossover frequency for k=20')
G=tf(num,den);
[mag,phase,w]=bode(G,w);
mag3dB=20*log10(mag);
phase3=phase;
[GM PM Wpc Wgc]=margin(G)
end
end
figure
semilogx(w,mag1dB(:,:)','-',w,mag2dB(:,:)','-',w,mag3dB(:,:)','-')
grid on
title('Bode Diagrams of G(s)=K/[s(s+1)(s+5)] where K=1, K=10 and K=20')
xlabel('Frequency (rad/sec)')
ylabel('Gain(dB)')
text(1.2,-31,'K=1')
text(1.1,-9,'K=10')
text(11,-31,'K=20')
figure
semilogx(w,phase1(:,:)','-',w,phase2(:,:)','-',w,phase3(:,:)','-')
grid on
xlabel('Frequency (rad/sec)')
ylabel('phase(degree)')
text(0.2,-90,'K=1')
text(0.2,-20,'K=10')
text(1.6,-20,'K=20')
Frequency response:
The combination of the magnitude and phase frequency responses is called the frequency response.
Experiment-08: The open loop transfer function G(s) of a unity feedback system is given. Draw the
Nyquist plot of G(S). Also determine the stability of the system.
Nyquist stability criterion states that the number of encirclements about the point (-1+j.0) is equal to the
difference between enclosed open loop poles and the enclosed closed loop poles.
Code:
clc; close all; clear all;
%sketch the Nyquist plot for the system
num=60;
den=conv([1 1],conv ([1 2],[1,5]));
G=tf(num,den);
nyquist(G)
b=isstable(G)
Here,
p=0
N=0
Z=P-N
Z=0-0;
since, Z=0, the value of Z indicates that there is no closed loop pole on the right half plane. So, the system
is stable.
Experiment-09: Determine the transfer function and poles of the system represented in state space as
given.
Code:
clc; close all; clear all;
A=[-2.048 0;0.83333 -2.2381];
B=[7 0.5714;-1.117 0];
C=[0 1];
D=[0 0];
[num,den]=ss2tf(A,B,C,D,2);
G=tf(num,den)%Determine transfer function
Experiment-10: Show the effect of addition of (a) a PD and (b) a PI controller on the system performance
of a unity feedback system with given forward path transfer function.
Code:
clc; close all; clear all;
num=[1]
den=[1 10 20];
P = tf(num,den)
T1=feedback(P,1)
figure
step(T1)
title('Step Response of given system')
grid on
Question-1 : Draw the block diagram (not schematic diagram) of design and implement a circuit to drive a
stepper motor using ICs and discrete components.
Question-2:How can you determine whether a stepper motor coil is center-tapped or not?
Answer: A center-tapped stepper motor has a center tap on one or more of its windings, which allows for
two independent circuits to be created. This center tap can be identified by an additional wire coming out
of the motor. The center tap wire is typically connected to ground or a power supply, depending on the
circuit configuration.
In contrast, a non-center-tapped stepper motor does not have a center tap wire and only has two wires per
winding. This type of stepper motor typically requires a different driver circuit than a center-tapped stepper
motor.
To summarize, if you see an additional wire coming out of a stepper motor, it is likely a center-tapped
stepper motor. Otherwise, if you only see two wires per winding, it is likely a non-center-tapped stepper
motor.
Question-03: Draw coil arrangement for unipolar and bipolar stepper motor.
There are several software options available for programming Arduino boards, but the most commonly
used software is the Arduino Integrated Development Environment (IDE).
Answer:
Int Constant=’e’ ;
void setup()
{
pinMode(Constant, OUTPUT);
}
2𝑠+1
Question- 7. a. Write a MATLAB code for 𝐺(𝑆) =4𝑠^2+2𝑠+3
num=[2 1];
den=[4 2 3];
Sys = tf(num, den)
s = tf('s')
Gs = ((2*s+1)*(4*s+2)/( 4*s^2+2*s+3)*(s+1))
Or
num=conv([2 1],[4 2]);
den=conv([4 2 3],[1 1]);
Gs = tf(num,den)