03 - Lecture 5 - PWM
03 - Lecture 5 - PWM
.DIEM
INTERNET OF THINGS
Introduction
• Pulse Width Modulation (PWM) is a
technique for delivering partial power
to a load via digital means.
Partial Power
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
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
3
18/04/23
Disadvantages
• Complexity of circuit
• Radio Frequency Interference
• Voltage spikes
• Electromagnetic noise
4
18/04/23
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
8
18/04/23
NEVER DO THAT!!!!!!
Remember the currents? A motor requires a way too
large current for a digital I/O pin!
DC Motors
control
9
18/04/23
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
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
Servo motors
Controlling a
servo
12
18/04/23
13