0% found this document useful (0 votes)
16 views13 pages

03 - Lecture 5 - PWM

The document discusses pulse width modulation (PWM), which is a technique for delivering partial power to a load by digitally controlling the on and off cycles of a signal. PWM works by varying the duty cycle, or width of the on portion of a square wave, and can be used to control applications like DC motors, LED dimming, and audio output. While PWM has advantages like low power loss and noise resistance, it also has disadvantages such as complexity, potential for radio frequency interference, and voltage spikes.

Uploaded by

hoxojew752
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)
16 views13 pages

03 - Lecture 5 - PWM

The document discusses pulse width modulation (PWM), which is a technique for delivering partial power to a load by digitally controlling the on and off cycles of a signal. PWM works by varying the duty cycle, or width of the on portion of a square wave, and can be used to control applications like DC motors, LED dimming, and audio output. While PWM has advantages like low power loss and noise resistance, it also has disadvantages such as complexity, potential for radio frequency interference, and voltage spikes.

Uploaded by

hoxojew752
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/ 13

18/04/23

Pulse Width Modulation

.DIEM
INTERNET OF THINGS

Introduction
• Pulse Width Modulation (PWM) is a
technique for delivering partial power
to a load via digital means.
Partial Power

• Other devices for delivering Dim Bulb


partial power??
Bright Bulb

1
18/04/23

Introduction
• Pulse Width Modulation (PWM)
is a method for changing how
long a square wave stays “on”.
• The on-off behavior changes the
average power of the signal.
• Keep in mind: If signal
toggles between on and off
quicker than the load, then
the load is not affected by
the toggling.

Duty Cycle -
Introduction On Off
VH
— The duty cycle (the width of the
signal) is modulated. Duty
— It is expressed as percentage Cycle (D)
measurement of how long the signal VL
stays on with respect to the period.

Period (T)

2
18/04/23

Duty Cycle - Definition

On Off
— Duty Cycle is determined
VH
by:
On Time
Duty Cycle = ´100%
Duty Period
VL Cycle (D)
— Average signal can be
Period (T) found as:
Vavg = D ×VH + (1- D)×VL

— Usually, VL is taken as zero volts for simplicity. 5

• Average value proportional to duty cycle, D


• Power loss in the switching transistors is low
• Fast switching possible due to MOSFETS and power
transistors at speeds up to hundreds of kHz Advantages
• Digital signal is resistant to noise
• Less heat dissipated versus using resistors for
intermediate voltage values

3
18/04/23

Disadvantages
• Complexity of circuit
• Radio Frequency Interference
• Voltage spikes
• Electromagnetic noise

Choosing PWM Frequency

Application dependant Not too low Not too high


Audible frequencies Transistors generate more heat at
Twice the inverse of device time higher frequencies
constant Some loads will not respond at
higher frequencies

4
18/04/23

• Voltage supplied is directly proportional to the

Application duty cycle


• Ability to control the speed of the motor via the
duty cycle
to DC • Example: Can be used in regulating room
temperature. A PC can sense the current
Motors temperature (using an analog-to-digital converter)
and then automatically increase/decrease the fan's
speed accordingly.

RC devices
• Transmitters send PWM signals to the receivers on board of
Radio controlled devices for specific control.

5
18/04/23

Video Devices
• PWM dimming provides
superior color quality in LED
video display
• The TLC5940 PWM dimming can
provide up to 68.7 million colors
to a pixel.

Audio devices

Used in audio amplifiers to generate Produce less heat than traditional Gives a sound effect similar to chorus
output signals for cellphone speakers analog amplifiers when used in audio circuit.
to high-power stereo systems

12

6
18/04/23

Simple examples of
PWM usage
• LED dimming
• Buzzer tone control

DC Motors
control
• A Permanent Magnet Direct Current
motor

7
18/04/23

• Except for transients, the rotation speed is


proportional to the average voltage
• Motor inertia acts as a low-pass filter, smoothing
DC Motors out the high-frequency components in the input
control voltage
• … so we can easily control the motor speed using
PWM!

DC Motors • We just need to connect one end of


the motor armature to GND, and the
control other end to a digital output pin…

8
18/04/23

DC Motors • We just need to connect one end of


the motor armature to GND, and the
control other end to a digital output pin…

NEVER DO THAT!!!!!!
Remember the currents? A motor requires a way too
large current for a digital I/O pin!

• You need a motor driver to supply the right


current/power to your motor…

DC Motors
control

9
18/04/23

• To control the direction, the motor driver includes a circuit


known as H-bridge
• To have the motor
turn in one direction,
you have to close
DC Motors switches S1 and S4
• For the other

control direction, you have


to close S2 and S3
• If you close S1 and
S2 (or S3 and S4)
the motor brakes
• Never close S1 and
S3 (or S2 and S4)!!!

DC Motors control
• Typically, to interface a motor driver you need 3
digital pins:
• 2 pins are used to encode the direction of
rotation
• A 3rd pin is used with PWM to encode the
speed

• You also have to supply the motor driver with a


voltage source to power the motor (unless the
motor is very small, don’t take it from the ESP32
board!)

10
18/04/23

Servo motors

Servo motors
• While DC motors are controlled in speed, you
use a Servo motor to control it in angular
position
• A servo includes in a small package:
• A (usually low power) DC motor
• A set of reduction gears, to have more torque
(at the expense of speed)
• A position sensor (usually a potentiometer)
• A control circuit that uses a feedback loop to
move the motor to the desired position
• A motor driver, so you can interface it directly
to the MCU

11
18/04/23

• Servos have been traditionally used for building


Radio - Controlled models, since they are very easy
to control, even using analog electronic circuits.
They are cheap and widely available…

Servo motors

• Most servos need to receive a control input around


every 20 milliseconds. They are not sensitive to the
duty cycle, but to the absolute time the control input
is high
• Typical values require a signal high from 1ms to 2ms

Controlling a
servo

12
18/04/23

• The servo DOES NOT respond to the duty cycle!


• The position depends on the width of the
pulse, independently of the period of the
pulse (within an acceptable range of periods)
• However, you can use a PWM generator to
generate a control signal for your servo!
Controlling a • Set the period to 20 milliseconds (better
to use a microsecond resolution!)
servo • Compute the pulse duration corresponding
to the angle you want (for a precise
positioning, you may need to do some tests…
cheap servos have often significant individual
variations!)

• The servo interface has typically 3 pins:


• Ground
• Vcc (typically, +5V)
• Control signal
• Check the datasheet to find which is which!

13

You might also like