DC Motor Control Lab
DC Motor Control Lab
Objectives
Control the speed of a DC motor.
Use encoder for motor speed feedback.
Use PWM signals for speed feedback and control.
DC motor
A direct current DC motor is defined as a class of electrical motors that convert direct current
electrical energy into mechanical energy. DC motors have wide range of applications.
A brushed DC motor is composed of armature (rotor), stator, commutator, and brushes.
Commutator reverses the current every half cycle and creates single direction torque. When a DC
motor is powered, a magnetic field is created in its stator. The field attracts and repels magnets on
the rotor; this causes the rotor to rotate. To keep the rotor continually rotating, the commutator that
is attached to brushes connected to the power source supply current to the motors wire windings.
A brushless DC motor, also known as synchronous DC motor, do not have a commutator. The
commutator in a brushless DC motor is replaced by an electronic servomechanism that can detect
and adjust the angle of the rotor.
PWM signal
Pulse width modulation (PWM) is a commonly used control technique that generates analog
signals from digital devices such as microcontrollers. Thus, at any given time, the wave will either
be high or low.
PWM uses a rectangular pulse wave whose pulse width is modulated resulting in the variation of
the average value of the waveform. Thus, it is a method of controlling the average power delivered
by an electrical signal. The average value of voltage (and current) fed to the load is controlled by
1/5
switching the supply between 0 (OFF) and 100% (ON) at a rate faster than it takes the load to
change significantly.
PWM is particularly suited for running inertial loads such as motors, which are not as easily
affected by this discrete switching. The PWM switching frequency can vary greatly depending on
load and application. For example, switching only has to be done several times a minute in an
electric stove; 100 or 120 Hz (double of the utility frequency) in a lamp dimmer; between a few
kilohertz (kHz) and tens of kHz for a motor drive.
The frequency of PWM determines how fast a PWM completes a period. The frequency of PWM
can be calculated as follows:
𝑃𝑒𝑟𝑖𝑜𝑑 𝑇 = 𝑇𝑂𝑁 + 𝑇𝑂𝐹𝐹
𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 1⁄𝑇
The average voltage of the signal is calculated using the following formula,
𝐷
𝑉𝑎𝑣𝑔 = × 𝑉𝑚𝑎𝑥
10
where
𝑇𝑂𝑁 : Duration of the signal being in the high (on) state
𝑇𝑂𝐹𝐹 : Duration of the signal being in the low (off) state
𝑇: Period = Total time taken to complete one cycle
D = Duty Cycle in Percentage
Vavg = Average voltage of the signal
Vmax = Max voltage of the signal
2/5
Rotary Encoders
Rotary encoders are electronic devices that can measure mechanical rotation. They can be used in
two fashions – As a control or as a device to measure the rotation of a shaft.
Incremental encoders are called quadrature or relative rotary encoders. These encoders have two
sensors and output two sets of pulses. The sensors, which can be magnetic (hall effect) or light
(LED or Laser), produce pulses when the encoder shaft is rotated. As there are two sensors in two
different positions, they will both produce the same pulses, however, they will be out of phase as
one sensor will pulse before the other one. Which sensor goes first is determined by the direction
of rotation.
The speed of rotation is determined using the Pulse Per Revolution PPR of the encoder as function
of the pulse width which changes with speed.
3/5
4/5
Experiment Procedure
1- Build the DC motor speed control setup.
2- Wire all the power and control signals.
3- Upload the code to the Arduino board.
4- Run the system and observe its function.
5- Use a tachometer to measure the speed of the motor and compare with the code.
6- Explain the different types of DC motors and relays.
7- Submit a group technical report for the experiment. [objective, experiment setup picture and
explanation, results plots, data analysis, discussion]
5/5