Professional Documents
Culture Documents
Experiment 3
DC MOTOR SPEED CONTROL USING PWM
1.Objectives
The student is expected to control the speed of a DC motor using PWM in open-
loop and closed-loop mode.
2.Prelab
1.Read the PIC16F87X data sheet especially the PWM section, and the A/D
Converter.
2.Referring to the switching experiment, design a driving circuit for the PC fan that
uses PWM to control its speed, knowing that the fan specification are: (12V,
0.16A), you can use any switching technique you want, but you must specify the
type and value for each component VB=12 V, use transistor BC141-16.
3. Apparatus
• 2-wire PC brushless DC fan with driver.
• DC power supply.
• Multi-meter.
• Oscilloscope.
• Development board. (Bread board, PIC, and any other needed
components).
• PIC 16f877A
4.Introduction
Pulse-width modulation (PWM) or duty-cycle variation methods are commonly
used in speed control of DC motors. The duty cycle is defined as the percentage of
digital ‘high’ to digital ‘low’ plus digital ‘high’ pulse-width during a PWM period.
1
Mechatronics System Design lab Exp3: DC Motor speed control
Fig.1 shows the 5V pulses with 0% through 50% duty cycle. The average DC
voltage value for 0% duty cycle is zero; with 25% duty cycle the average value is 1.25V
(25% of 5V). With 50% duty cycle the average value is 2.5V, and if the duty cycle is
75%, the average voltage is 3.75V and so on. The maximum duty cycle can be 100%,
which is equivalent to a DC waveform. Thus by varying the pulse-width, we can vary the
average voltage across a DC motor and hence its speed. The average voltage is given
by the following equation:
But usually y minimum equals zero so the average voltage will be:
ý = D. Ymax
The circuit of a simple speed controller for a mini DC motor, such as that used in tape
recorders and toys, is shown in Fig.2.
2
Mechatronics System Design lab Exp3: DC Motor speed control
5. Procedure
Part one: Open Loop System:
a) Using PIC16F876 (A) write an assembly program to generate a PWM with a
frequency of 1 kHz and a duty cycle of 50%, and watch your signal on the oscilloscope.
b) Now connect your signal to the fan driver and watch what happens.
c) Draw the block diagram for the open loop system.
4
Mechatronics System Design lab Exp3: DC Motor speed control
6) Compare the value in COUNTER with SPEED1. If equal do nothing. If more than
then decrement duty cycle register (CCPR1L). If less than then increment duty cycle
register.