Pulse Width Modulation

Slides:



Advertisements
Similar presentations
By: Zak Ahmad Phuc Dao Joel Toussaint. Outline Introduction PWM Definitions Generation Types PWM on the HCS 12 Applications 2 Presented by Zak Ahmad.
Advertisements

Chapter 4 DC to AC Conversion (INVERTER)
PWM Pulse Width Modulation
PWM Pulse Width Modulation
ECE Electric Drives Topic 7: Pulse Width Modulation
Lecture 9: D/A and A/D Converters
1. Output signal alternates between on and off within specified period Controls power received by a device The voltage seen by the load is directly proportional.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
COMP3221: Microprocessors and Embedded Systems Lecture 20: Analog Output Lecturer: Hui Wu Session 2, 2004.
DC-DC Converters Convert a fixed DC Source into a Variable DC Source
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Copyright by UNIT III DC Choppers 4/17/2017 Copyright by
Electronic Instrumentation 1 Experiment 7 Digital Logic Devices and the 555 Timer Part A: Basic Logic Gates Part B: Flip Flops Part C: Counters Part D:
Pulse Width Modulation A Student Presentation By: Wayne Maxwell Martin Cacan Christopher Haile.
Chapter 8 Inverters AC Power • Inverters • Power Conditioning Units • Inverter Features and Specifications.
Digital to Analog Converters
Micromouse Meeting #3 Lecture #2 Power Motors Encoders.
Pulse Width Modulation (PWM) LED Dimmer Circuit
Pulse Width Modulation (PWM) LED Dimmer Circuit
DC-DC Fundamentals 1.2 Linear Regulator. What is a Linear Regulator? The linear regulator is a DC-DC converter to provide a constant voltage output without.
General Licensing Class G7A – G7C Practical Circuits Your organization and dates here.
Power Electronics and Drives (Version ) Dr. Zainal Salam, UTM-JB 1 Chapter 3 DC to DC CONVERTER (CHOPPER) General Buck converter Boost converter.
T IMERS - 2. O UTPUT U NIT Each capture/compare block contains an output unit. The output unit is used to generate output signals such as PWM signals.
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
ET3380 Principles and Methods of Electric Power Conversion David Morrisson MS,MBA Week 1.
Digital Fundamentals Floyd Chapter 1 Tenth Edition
ELECTRICAL CIRCUIT ET 201 Define and explain characteristics of sinusoidal wave, phase relationships and phase shifting.
8254 Programmable Interval Timer
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Lecture 29: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM)
PIT: Programmable Interval Timer
System Clocks.
General Licensing Class Oscillators & Components Your organization and dates here.
The 8253 Programmable Interval Timer
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
PHY 202 (Blum)1 Analog-to-Digital Converter and Multi-vibrators.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals with PLD Programming.
PWM Circuit Based on the 555 Timer. Introduction In applications LED Brightness Control we may want to vary voltage given to it. Most often we use a variable.
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM) Refer to Chapter 21 in the reference book “Stellaris® LM3S9B96 Microcontroller.
8254 Timer.
Floyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd © 2008 Pearson Education Chapter 1.
SMV Electric Tutorials
Bridge Rectifier Circuit with Working Operation and Their Types.
DC motor principles Speed control Direction Stepper motor principles
CLOSED LOOP SPEED CONTROL OF DC MOTOR WITH PWM TECHNIQUE
Microcontroller basics Embedded systems for mortals.
Different Types of Voltage Regulators with Working Principle.
Microcontroller basics
Why are Timer Functions Important?
EKT124 Digital Electronics 1 Introduction to Digital Electronics
Timers and Event Counters
ECE 3430 – Intro to Microcomputer Systems
IMPEDENCE - SOURCE INVERTER FOR MOTOR DRIVES
Digital Fundamentals Floyd Chapter 1 Digital concepts Tenth Edition
Predefined Speed Control of BLDC Motor
Digital Communication
Oct 30 Announcements Code Marked and on Blackboard
Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
POWER AMPLIFIERS.
Oct 30 Announcements Code Marked and on Blackboard
CBC Fundamentals Lecture is based on material from Robotic Explorations: A Hands-on Introduction to Engineering, Fred Martin, Prentice Hall, 2001.
ME 4447/6405 Pulse Width Modulation (PWM)
General Licensing Class
UNIT-8 INVERTERS 11/27/2018.
Amplifiers Classes Electronics-II
Amplifiers Classes Electronics-II
Digital Fundamentals Floyd Chapter 1 Tenth Edition
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Equalizing Average Source Power with Pattern Swapping
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
Presentation transcript:

Pulse Width Modulation ME 4447/6405 October 29th, 2009 By: Val Tocitu Jason Kulpe Alexandre Mariuzza

Introduction and definitions Types of PWM Methods of generation Presenter: Val Tocitu Introduction and definitions Types of PWM Methods of generation Characteristics of PWM Applications and examples Implementation on the HCS12 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

What is it? Output signal alternates between on and off within specified period Controls power received by a device The voltage seen by the load is directly proportional to the source voltage 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Definitions Duty Cycle: on-time / period Vlow is often zero 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Types of Pulse Width Pulse center fixed, edges modulated Leading edge fixed, tailing edge modulated Tailing edge fixed, leading edge modulated Pulse Width constant, period modulated 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Types of Pulse Width 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Analog Generation of PWM Analog PWM signals can be made by combining a saw- tooth waveform and a sinusoid PWM output is formed by the intersection of the saw-tooth wave and sinusoid 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Digital Methods of Generating PWM Digital: Counter used to handle transition Delta : used to find the PWM at a certain limit Delta Sigma: used to find the PWM but has advantage of reducing optimization noise 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Delta Method Output signal compared with limits Every time limits reached, changes state 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Delta Sigma Method PWM signal generated by Delta method Error = output – reference Error integrated State changes when integration reaches limits Advantage Circuit simpler Reduces quantization noise by high pass filter 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Applications to DC Motors The voltage supplied to a DC motor is proportional to the duty cycle Both brushed and brushless motors can be used with PWM Both analog and digital control techniques and components are available 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Three Phase AC motors with PWM 3 different AC currents at different phases Phase: 120 degrees apart Creates constant power transfer Rotating magnetic field Pulses substitute for AC current 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Space Vector Modulation Used for three-phase AC motors Convert DC current to AC current Gates turned on/off at different intervals 3 PWM created 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Motor Control Diagrams 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Advantages of PWM average value proportional to duty cycle, D low power used in transistors used to switch the signal fast switching possible due to MOSFETS and power transistors at speeds in excess of 100 kHz digital signal is resistant to noise less heat dissipated versus using resistors for intermediate voltage values 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Disadvantages of PWM Cost Complexity of circuit Radio Frequency Interference Voltage spikes Electromagnetic noise 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Introduction and definitions Types of PWM Methods of generation Presenter: Jason Kulpe Introduction and definitions Types of PWM Methods of generation Characteristics of PWM Applications and examples Implementation on the HCS12 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Applications of PWM In the past, motors were controlled at intermediate speed by using resistors to lower delivered power Electric stove heater Lamp dimmers Voltage regulation – convert 12 volts to 5 volts by having a 41.7% duty cycle Sound production: PWM controlled signals give sound effects similar to a chorus Power transfer: PWM used to reduce the total power given to a load without relying on resistive losses 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

PWM used with D/A conversion commonly used in toys lowpass filter smooths out transients from harmonic effects frequency values of harmonics doesn’t change, but the amplitude does, which adjusts the analog output signal 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

PWM used to transmit data in telecommunications clock signal is found “inside” PWM signal more resistant to noise effects than binary data alone effective at data transmission over long distance transmission lines 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Concerns: Ripple of PWM Signal Ripple is the noise in the output signal Appropriate PWM controllers can minimize these effects 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Frequency of the PWM Signal Lower Limits Upper Limits Must be at least 10 times higher than the control system frequency Higher than 20kHz – audible frequency of sounds to avoid annoying sound disturbances, caused by magnetostriction If too low the motor is pulsed, not continuous, because the motor’s inductance can not maintain the current Inverse of frequency should be much less than the motor/load time constant Higher error from ripple voltages If too high the inductance of the motor causes the current drawn to be unstable MOSFET transistor generates heat during switching Limited by resolution of controller Eddy currents generated in electromagnetic coils which lead to adverse heating Heat losses in electromagnetic materials is proportional to frequency squared 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Example: PWM with 555 Timer Potentiometer is used to adjust the duty cycle 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Example: Specifying circuit elements Requirements Maxon EC-16 brushless motor, Time constant = 8.75 ms 2. Want to avoid audible frequencies f ≥ 20 kHz 3. PID control loop running at 150 Hz f ≥ 10 ∙ 150 Hz 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

f Example: Specifying circuit elements ≥ 117 Hz ≥ 20 kHz ≥ 1.5 kHz This circuit has a PWM frequency according to: Check constraints Set f to 25 kHz to add in a factor of safety Choosing C1 to be 100 nF, R1 is 576 Ω ~ 500 Ω Recalculating with these values f = 28.8 kHz ≥ 117 Hz ≥ 20 kHz ≥ 1.5 kHz f 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Matlab can do PWM! The procedure works similar to the generation of analog PWM using a sinusoid and saw-tooth wave 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

HUGE Where can I buy a PWM controller? BIGGER Texas Instruments Digikey Mouser Electronics Critical Velocity Motor Control HUGE BIGGER SMALL Texas Instruments TAS5508B 8-Channel Digital Audio PWM Processor 64 pin chip, max 192 kHz frequency $7.25 18 kHz frequency Continuous 28 amps $55.95 120 amps, used for hybrid vehicles $469.00 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Introduction and definitions Types of PWM Methods of generation Presenter: Alex Mariuzza Introduction and definitions Types of PWM Methods of generation Characteristics of PWM Applications and examples Implementation on the HCS12 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

PWM Implementation The signal is outputted through Port P Six Channels Dedicated Chip 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 29

PWM Module Each channel has a dedicated counter Programmable duty and period Independently adjustable clock, polarity, and alignment 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 30

PWM Module- Other Features 8-bit and 16-bit resolution supported Two PWM channels can be concatenated together Four source clocks (A, SA, B, SB) Emergency Shutdown Some changes take a complete cycle to be implemented Modes of Operation: Normal: everything is available Wait: Low-power consumption and clock disabled Freeze: Option to disable clock is available Emergency Shutdown- can be triggered with input from pin 5 of Port P 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 31 31

PWM Configuration Configured through specific registers Registers are located from $00E0 to $00FE There are repeated registers (ex. 0013-0017) There are 30 registers, lots of them are repeated 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 32 32

PWM Enable Register Located at $00E0 Code Warrior variable: PWME Set PWMEx to 0 to disable the channel Set PWMEx to 1 to enable it Channel is activated when bit is set If 16-bit resolution used, then PWME4/2/0 are deactivated 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 33

PWM Polarity Register Located at $00E1 Code Warrior variable : PWMPOL Set PPOLx to 0, signal goes from low to high Set PPOLx to 1, signal goes from high to low 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 34

PWM Clock Select Register Located at $00E2 Code Warrior variable : PWMCLK Set PCLK5/4/1/0 to 0 to use clock A Set PCLK5/4/1/0 to 1 to use clock SA Set PCLK3/2 to 0 to use clock B Set PCLK3/2 to 1 to use clock SB Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 35 35

PWM Prescaler Register Located at $00E3 Variable: PWMPRCLK Used to prescale clocks A and B Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 36 36

PWM Scale A Register Located at $00E8 Code Warrior variable: PWMSCLA Store a hexadecimal value in order to change the clock frequency of SA Note: if set to $00, PWMSCLA is set to 256 Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 37 37

PWM Scale B Register Located at $00E9 Code Warrior variable: PWMSCLB Store a hexadecimal value in order to change the clock frequency of SA Note: if set to $00, PWMSCLB is set to 256 Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 38 38

PWM Center Align Register Located at $00E4 Code Warrior variable: PWMCAE Set CAEx to 0 for left align signal Set CAEx to 1 for center align signal Note: can only be set when channel is disabled Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 39 39

Signal Alignment Signal changes when counter is equal to period register In the center aligned mode, the PWM counter goes from a down-count to a up-count to down-count, etc. In the left aligned mode, the PWM counter is a up-counter and rests to zero when it overflows 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 40

PWM Control Register Located at $00E5 Code Warrior variable: PWMCTL Set CONxy to 0 to keep PWM channels separate (8-bit) Set CONxy to 1 to concatenate PWM channels x and y together (16-bit). Channel y determines the configuration x becomes the high byte and y becomes the low byte Bits PSWAI and PFRZ set either wait or freeze mode Changes only occur when channels are disabled Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 41 41

PWM Counter Register Located at $00EC through $00F1 Code Warrior variable: PWMCNTx One per channel It tracks the cycle counts It can be read If written to, the count is reset to $00 and a up-count starts Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 42 42

PWM Period Register Located at $00F2 through $00F7 Left-Aligned: Variable: PWMPERx Store a hexadecimal value to limit maximum value of counter Changes occur when: Current period ends Counter is written to Channel is disabled Left-Aligned: Clock A and B are independent prescaled clocks Clock SA and SA are based on clocks A and B Center-Aligned: 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 43 43

PWM Duty Register Located at $00F8 through $00FD Code Warrior variable: PWMDTYx Store a hexadecimal value to control when signal changes Changes occur when: Current period ends Counter written to Channel is disabled Polarity 0- counts low time Polarity 1- counts high time Polarity = 0: Polarity = 1: 10/29/2009 44 44

PWM Shutdown Register Located at $00FE Code Warrior variable: PWMSDN PWMENA: Enables and disables emergency shut down PWMIF (Interrupt flag): Set when an input is detected in pin 5 PWMIE (Interrupt Enable): Enables and disables CPU interrupts PWMRSTRT: Resets the counters PWMLVL (Shutdown Output Level): Determines if output is high or low when shutdown PWM5IN (Input Status): Reflects status of pin 5 PWM5INL: Determines active level of pin 5 Polarity 0- counts high time Polarity 1- counts low time 45 45

How it all works Clock A, SA, B, or SB 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 46 46

Example Desired Signal: 8 kHz PWM signal Duty Cycle of 30% Left Aligned Channel 1 Low → High 8-bit channel 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 47

Assembly Code PWME EQU $00E0 PWMPOL EQU $00E1 PWMCLK EQU $00E2 PWMPRCLK EQU $00E3 PWMCAE EQU $00E4 PWMCTL EQU $00E5 PWMPER1 EQU $00F3 PWMDTY1 EQU $00F9 ORG $1000 LDAA #$00 STAA PWMCLK ; Sets source clocks to clock A STAA PWMPOL ; The signal goes from low to high STAA PWMCTL ; Makes all channels 8-bit STAA PWMCAE ; Signals are left aligned LDAA #$FA STAA PWMPER1 ; Sets the period to 250 clock cycles LDAA #$AF STAA PWMDTY1 ; Makes the duty cycle equal to 30% LDAA #$02 STAA PWMPRCLK ; Sets the prescaler to 4 STAA PMWE ; Enables and starts channel 1 …… 10/29/2009 48

C Code #include <hidef.h> /* common defines and macros */ #include <mc9s12c32.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE “mc9s12c32” // Set up chip in expanded mode MISC = 0x03; PEAR = 0x0C; MODE = 0xE2; //Set up PWM Registrer PWMCLK = 0; // Sets source clocks to clock A PWMPOL = 0; // The signal goes from low to high PWMCTL = 0; // Makes all channels 8-bit PWMCAE = 0; // Signals are left aligned PWMPER1 = 250; // Sets the period of the signal to 250 clock PWMDTY1 = 175; // Makes the duty cycle equal to 30% PWMPRCLK = 2; //Sets the prescaler to 4 PMWE = 2; //Enables and starts channel 1 …. 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 49

REFERENCES http://en.wikipedia.org/wiki/Pulse-width_modulation http://www.netrino.com/Embedded-Systems/How-To/PWM-Pulse-Width-Modulation Cetinkunt, Sabri. Mechatronics. Hoboken, NJ: Wiley, 2006. Print. http://www.jimfranklin.info/microchipdatasheets/00538c.pdf http://www.allaboutcircuits.com/vol_6/chpt_6/9.html http://www.dprg.org/tutorials/2005-11a/index.html http://www.4qdtec.com/pwm-01.html http://skywalker.cochise.edu/rgill/ch02elec.ppt http://pcbheaven.com/wikipages/PWM_Modulation/ Matlab 2009 online documentation http://www.epanorama.net/links/motorcontrol.html#ac MC9S12C Family, MC9S12GC Family Reference Manual, (pp. 347-382) 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza

Questions? 10/29/2009 Pulse Width Modulation - Val Tocitu, Jason Kulpe, Alex Mariuzza 51