PWM What is PWM signal? A square wave form with two parameters: 1. PWM period (T PWM ) and 2. Duty cycle (d)

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Advertisements

DC-DC Fundamentals 1.4 Charge Pump Regulator
Variable Frequency AC Source Students: Kevin Lemke Matthew Pasternak Advisor: Steven D. Gutschlag 1.
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.
CIRCUITS, DEVICES, AND APPLICATIONS Eng.Mohammed Alsumady
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.
Power Electronics Lecture-10 D.C to D.C Converters (Choppers)
EKT343 –Principle of Communication Engineering
Power Electronics Chapter 6 AC to AC Converters ( AC Controllers and Frequency Converters )
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:
Digital I/O Connecting to the Outside World
POWER SUPPILES LECTURE 20.
Micromouse Meeting #3 Lecture #2 Power Motors Encoders.
LECTURE 9 INTRO TO POWER ELECTRONICS
TIMERS.
Pulse Width Modulation (PWM) LED Dimmer Circuit
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.
CIRCUITS, DEVICES, AND APPLICATIONS Eng.Mohammed Alsumady
POWER PLANT USED IN TELECOM
ENGR 6806 – Motor Control Prepared By: Rob Collett September 15, Office: EN2074.
Chapter 13 Linear-Digital ICs. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. Electronic Devices.
APPED A Confidential Part 4…Isolated DC/DC (types, operations, sales guide, etc.) Application information Power supply unit (PSU) ©2010. Renesas.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
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.
Microprocessoren lesson 6. PWM /motor control/servo.
1 Lecture on Lab 6 Lab 7 Lab 8. 2 Lab 6: Open Loop Controller As you learned in lab 5, there are two kinds of control systems: open loop and closed loop.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
BM-305 Mikrodenetleyiciler Güz 2015 (3. Sunu) (Yrd. Doç. Dr. Deniz Dal)
Microprocessors Tutorial 2: Arduino Robotics. Agenda 1. Robot Anatomy 2. Sensor Review 3. PWM 4. MAKE: Fade 5. Motors 6. H Bridge 7. Robot Control library.
Microcontroller Applications ELEC 421 Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Introduction to DC-DC Conversion – Cont.
Data Acquisition Device (DAQ) A DAQ is a cool little device that allows you to interface hardware to a computer. Here is what we will do:  Create a square.
SMV Electric Tutorials
Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output.
1 4-Integrating Peripherals in Embedded Systems (cont.)
PWM: Pulse Width Modulation © 2014 Project Lead The Way, Inc.Digital Electronics.
THEME 6: Frequency dividers. Digital counters with reduced counting modulus. Programmable digital counters. If the input pulses are more than K, the counter.
1 4-Integrating Peripherals in Embedded Systems (cont.)
Analog Output Materials: animatronic head Processing Quiz HW: code links.
Throttle Arduino RC Receiver Stock Golf Cart Motor Controller Motor 1 PWM signal: Voltage: 0 – 5V Period = 22ms Positive Pulse Width: 1ms – 2ms Digital.
Guide Presented by Mr.M Cheenya V.Abhinav Kumar 11E31A0422 Asst.Professor K.Shiva Kumar 11E31A0423 K.Rajashekhar 11E31A0424 K.Chaithanya Sree 11E31A0428.
By: Devon Schmidt & Kyle Da Rif Instructor: Stanislaw Legowski Senior Design 2012/2013.
Pulse-Width Modulation: Simulating variable DC output
Praxis I.  Introduction  Hardware  Software Tools  Microcontroller board  Blinky (simple program to flash a led)  References.
CLOSED LOOP SPEED CONTROL OF DC MOTOR WITH PWM TECHNIQUE
1 4-Integrating Peripherals in Embedded Systems (cont.)
Module 8 Tutorial  An 8086 system is used for controlling the speed of a motor. The motor can operate at 5 different speeds (1- 5).  The speed.
Electronic Devices and Circuit Theory
Application Case Study Christmas Lights Controller
UNIT III DC Choppers.
MICROCONTROLLER AND INTERFACING
Clock Signals: 555 Timer 555 Timer Digital Electronics TM
Timers and Event Counters
Peripherals and CMSIS STM32F4, Cortex M
Chapter 13 Linear-Digital ICs
PRJ2UC: Microcontrollers
Digital Communication
DC-DC PWM Converters Lecture Note 5.
High Performance Low Cost Low Lost Wireless DC Motor Speed Control
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Introduction to Linear Voltage Regulators
General Licensing Class
UNIT-8 INVERTERS 11/27/2018.
Robotics System Lecture 11_12: DC Motor
Pulse-Width Modulation: Simulating variable DC output
Maker Education Manipulator
Presentation transcript:

PWM What is PWM signal? A square wave form with two parameters: 1. PWM period (T PWM ) and 2. Duty cycle (d)

The duty cycle is defined as the percentage of digital ‘high’ to digital ‘low + high ’ signals present during a PWM period. It is shown in the figure below, (10%, 50%, 90%). The PWM resolution is defined as the maximum number of pulses that you can pack into a PWM period. The PWM period is an arbitrarily time period in which PWM takes place. It is chosen to give best results for your particular use.

Duty cycle/ Duty Time Duty time is the ‘ON’ time in one period. (t d ). t d <T PWM Duty cycle can be determined using following eq.:

Uses of PWM 1) Create an analog output voltage level digitally. PWM can adjust the average value of the output voltage. – Thermal system – DC Motor speed controllers – Lighting control – Any application where you need a variable DC voltage 2) To digitally create analog signals for arbitrary waveforms, sounds, music and speech.

SMPS application System is a DC-DC converter that regulates the output power. Power-electronic switch is used as a chopper to adjust the average value of the output voltage. PWM signal is applied to the control input (for MOSFET: gate). System has high efficiency, high performance and smaller size if it is compared to linear regulators. Duty ratio of the pwm signal is controlled by uC according to the output voltage feedback. The higher PWM frequencies produce smoother output DC voltage. However high PWM frequency increases the susceptibility to voltage noises.

Produce a Sine-Wave Using PWM Signal

PWM Signal Generation

Before&After Filtering The filter output for higher frequency PWM input.

STM32F4x PWM operation The timer modules are used to generate PWM signals Most of timer modules has output channels that are assigned to I/O pins. Most of them are defined as Auxiliary Function pins.

Output Pins of Timer Module Channels The channel list fot TMR1 and TMR2 can be seen below. The complete channel list can be seen on table.9 in the STM32f4x datasheet (Doc#: DocID Rev 4 ).

Adjusting the PWM Signal 1.A PWM output channel should be selected 2.Proper clock signals are applied – RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);// IO PD15 is selected and it is PD15 is connected to TMR4 channel4.=> corresponding timer should be clocked – /* LED is on GPIOD, We want the LED connected to PD15 should blink*/ – RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); – GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PD15 is selected – GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //Auxiliary mode is seleceted. // (Not input or not output or not Analog) – GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; – GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // push pull output (not open //drain). – GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ; // Pull up enable – GPIO_Init(GPIOD, &GPIO_InitStructure); – GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_TIM4);// PD15 is connected to TMR4 channel4. => Configure PD15 auxiliary mode for TIM4. (GPIO_AF_TIM4)

2. The corresponding timer is adjusted according to the required PWM period: – /* Time base configuration */ – TIM_TimeBaseStructure.TIM_Period = 1000;// a timer period is divided into 1000 pieces. – TIM_TimeBaseStructure.TIM_Prescaler = (int) ((SystemCoreClock /2) / 50000) - 1; – TIM_TimeBaseStructure.TIM_ClockDivision = 0; – TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; – TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); Here timer4 is adjusted to 1/50msec x1000=1/50 sec. Therefore PWM period is adjusted as 20 msec. and 20 msec is divided into 1000  A PWM period has 1000x0.02 msec. time slots.

3. Set the output channel of the timer: Use TIM_OCInitStructure, TIM_OCXInit function and TIM_OCXPreloadConfig function. Here X is channel number. – /* PWM1 Mode configuration: Channel4 */ – TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; – TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; – TIM_OCInitStructure.TIM_Pulse = 0; – TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; – TIM_OC4Init(TIM4, &TIM_OCInitStructure); // The settings are loaded to output channel4 (OC4) of TIMER4. (Remember PD15 is connected to TMR4-OC4) – TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Enable); 4. Adjust the Duty cycle: Use TIM_SetCompareX function. Here X is channel number. Remember a timer period is divided into 1000, if 25% duty is required 250 of them should be ‘1’ and the rest should be ‘0’ – TIM_SetCompare4(TIM4, 250); // 25% duty cycle Examine the test_PWM.c file in detail…