Pulse Width Modulation Applications

Similar documents
1/22/16. You Tube Video. Definitions. Duty Cycle: on-time per period (specified in per cent)

Servo Info and Centering

Servo Motors (SensorDAQ only) Evaluation copy. Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Timer A (0 and 1) and PWM EE3376

PROJECT PRESENTATION ON CELLPHONE OPERATED ROBOTIC ASSISTANT

CHAPTER 11: Flip Flops

Using the Motor Controller

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

EVAL-UFDC-1/UFDC-1M-16

Pulse Width Modulated (PWM) Drives. AC Drives Using PWM Techniques

STEPPER MOTOR SPEED AND POSITION CONTROL

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Electronic Circuits Spring 2007

Principles of Adjustable Frequency Drives

Pulse Width Modulated (PWM)

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

PCM Encoding and Decoding:

Adding Heart to Your Technology

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Interfacing Analog to Digital Data Converters

Pulse width modulation

INTRODUCTION TO SERIAL ARM

DC Motor control Reversing

The quadrature signals and the index pulse are accessed through five inch square pins located on 0.1 inch centers.

ServoOne. Specification. Option 2 - Technology. x 11. x 8 X 8. x 10. x 9. x 7. x 6 TTL Encoder / TTL Encoder simulation

LOW COST MOTOR PROTECTION FILTERS FOR PWM DRIVE APPLICATIONS STOPS MOTOR DAMAGE

Technical data. General specifications. Signal voltage V DC Signal duration. 1 s Input 2. Signal voltage. 1 s Analog output.

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

X8 Option 2 - Technology

QR12 (1.22 ) Diameter Optical Encoder

MANUAL FOR RX700 LR and NR

ServoPAL (#28824): Servo Pulser and Timer

Material: Weight: Bearing Life: Shaft Speed: Starting Torque: Mass Moment of Inertia: Shaft Loads:

Work with Arduino Hardware

FREQUENCY CONTROLLED AC MOTOR DRIVE

EFC Frequency converters

How many high-speed counters (HSCs) are provided by the SIMATIC S PLC? SIMATIC S FAQ March Service & Support. Answers for industry.

Whale 3. User Manual and Installation Guide. DC Servo drive. Contents. 1. Safety, policy and warranty Safety notes Policy Warranty.

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

DRTS 33. The new generation of advanced test equipments for Relays, Energy meters, Transducers and Power quality meters

The VOLTECH HANDBOOK of PWM MOTOR DRIVES. Andrew Tedd

[F/T] [5] [KHz] [AMP] [3] [V] 4 ) To set DC offset to -2.5V press the following keys [OFS] [+/-] [2] [.] [5] [V]

How To Power A Schen

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

Lab 1: The Digital Oscilloscope

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

MILE Encoder for EC 90 flat

Scripting Language Reference. SimpleBGC 32bit

Talon and Talon SR User Manual

Chapter 4: Pulse Width Modulation

Power Analysis of PWM Motor Drives

Table 1 Comparison of DC, Uni-Polar and Bi-polar Stepper Motors

TECHNICAL DATASHEET Incremental Encoder RI 58-H

Borstlösa DC-motorer. Promoco Scandinavia AB

Figure 1: Multiple unsynchronized snapshots of the same sinusoidal signal.

Datasheet of the Easy Servo Motor ES-M Series

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

DC Motor Driver 24V 20A [RKI-1340]

Speed Control Methods of Various Types of Speed Control Motors. Kazuya SHIRAHATA

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

Mini Breakout-Board. CNC Interface for LPT Port. Installation Manual Version 4

A1000 Cheat Sheet (Open Loop Vector)

Datasheet of the Easy Servo Motor ES-MH Series

SECTION VARIABLE FREQUENCY DRIVES

Accurate Measurement of the Mains Electricity Frequency

Optimizing VCO PLL Evaluations & PLL Synthesizer Designs

Ultrasound Distance Measurement

PROXIMITY CARD READERS C-10, C-20, C60, C70

Lab 5 Getting started with analog-digital conversion

DC Motor with Shaft Encoder

Electrical Resonance

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

Glolab Talking Phone Dial Monitor

Product Information. Gateway For Connecting EnDat Encoders to PROFIBUS-DP

How to avoid typical pitfalls when measuring Variable Frequency Drives

Analog Representations of Sound

3-Digit Counter and Display

CBS RECORDS PROFESSIONAL SERIES CBS RECORDS CD-1 STANDARD TEST DISC

Implementing a Digital Answering Machine with a High-Speed 8-Bit Microcontroller

Simulation and Analysis of PWM Inverter Fed Induction Motor Drive

Technical data. General specifications. Indicators/operating means. 30 Hz Multiplex operation 30 Hz / n, n = number of sensors, n 5

Transmitter Interface Program

Germanium Diode AM Radio

Datasheet of the Easy Servo Drive ES-D VDC, 8.2A Peak, Close-loop, No Tuning. Version

Phase-Control Alternatives for Single-Phase AC Motors Offer Smart, Low-Cost, Solutions Abstract INTRODUCTION

Pulse Width Modulation

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

Telecommunications Switching Systems (TC-485) PRACTICAL WORKBOOK FOR ACADEMIC SESSION 2011 TELECOMMUNICATIONS SWITCHING SYSTEMS (TC-485) FOR BE (TC)

Electric Landing Gear controllers and sequencer LGC12 / LGC 13C

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

IP40 or IP64 (EN 60529) Protection class housing. IP50 (IP65 optional) (EN 60529) Minimum length of mountig

Siemens AG 2011 SINAMICS V60. The perfect solution for basic servo applications. Brochure May 2011 SINAMICS. Answers for industry.

AMZ-FX Guitar effects. (2007) Mosfet Body Diodes. Accessed 22/12/09.

Magic Poker 2 Manual

MAINTENANCE & ADJUSTMENT

The Phase Modulator In NBFM Voice Communication Systems

ECE 495 Project 3: Shocker Actuator Subsystem and Website Design. Group 1: One Awesome Engineering

Access Control Using Smartcard And Passcode

Transcription:

Pulse Width Modulation Applications Lecture 21 EE 383 Microcomputers

Learning Objectives What is DTMF? How to use PWM to generate DTMF? How to use PWM to control a servo motor? How to use PWM to control a DC motor?

PWM Applications Pulse-Width Modulation (PWM) can be used with any application that requires generation of a periodic rectangular waveform. With additional filter circuitry, rectangular waveforms can be used to generate triangular, sinusoidal, and other waveform types. Design of these filters is outside the scope of this class. PWM applications include: Servo control (standard or continuous-rotation) DC motor speed control Generation of audio tones Many others

Generating Audio Tones A pure audio tone is a sinusoid of a particular frequency. Sinusoids can be roughly approximated by 50% duty-cycle rectangular waves. The approximation can be improved by filtering the rectangular wave. The range of tone frequencies for human hearing falls roughly in the range 20Hz 20 khz. The extremes of this range are quite variable by individual. Aging tends to reduce the range, especially at higher frequencies. The Dragon12 PWM can easily generate waveforms in the 20Hz 20 khz range and, with a proper transducer (e.g. a speaker), can be used to produce audio output. The quality of this square-wave audio may be questionable.

Touch-Tone Telephone 1 2 3 4 5 6 7 8 9 */E 0 #/F A B C D 1 2 3 4 5 6 7 8 9 * 0 # Original Touch-Tone Keypad Modern Touch-Tone Keypad

DTMF Touch-Tone Standard Dual-Tone Multiple-Frequency (DTMF) encoding is used to transmit the state of the keypad when a button is pressed. Each keypress is indicated by a unique combination of two sinusoidal frequency components. One sinusoid indicates the keypad row and the other indicates the keypad column. Each tone must be held for a minimum of 40 ms.

DTMF Frequencies 1209 Hz 1336 Hz 1477 Hz 1633 Hz 697 Hz 1 2 3 A 770 Hz 4 5 6 B 852 Hz 7 8 9 C 941 Hz */E 0 #/F D

Approximating DTMF with PWM DTMF requires the sum of two sinusoids. PWM produces rectangular waveforms. Two PWM channels (row and column) with appropriate low-pass filters may be used to create the DTMF sinusoids.

Dragon12plus - First Approximation of DTMF For a simple approximation of DTMF on the Dragon12plus, we can take advantage of the fact that we can set a separate frequency for each PWM channel. In addition, the Dragon12plus laboratory kits include two small piezoelectric speakers equipped to plug directly into the servo connectors on the Dragon12plus. Driving these two speakers with two PWM square-wave (50% duty cycle) signals is an acceptable first approximation for DTMF.

Dragon12 PWM Speakers

Selecting DTMF frequencies Frequency (Hz) Period (µs) 24 MHz cycles 697 Hz 1434.72 µs 34433.28 cycles 770 Hz 1298.70 µs 31168.83 cycles 852 Hz 1173.70 µs 28169.01 cycles 941 Hz 1062.69 µs 25504.78 cycles 1209 Hz 827.13 µs 19851.12 cycles 1336 Hz 748.50 µs 17964.07 cycles 1477 Hz 677.05 µs 16249.15 cycles 1633 Hz 612.37 µs 14696.88 cycles Because of the tight constraint on period accuracy (1.5%) we should consider using the concatenated PWM channels with 16-bit period counters for greater accuracy.

Selecting PWM parameters for DTMF Frequency (Hz) Period (µs) 24 MHz cycles (PWMPER/PWMDTY) 697 Hz 1434.72 µs 34433.28 cycles (34434/17217) 770 Hz 1298.70 µs 31168.83 cycles (31168/15584) 852 Hz 1173.70 µs 28169.01 cycles (28170/14085) 941 Hz 1062.69 µs 25504.78 cycles (25504/12752) 1209 Hz 827.13 µs 19851.12 cycles (19852/9926) 1336 Hz 748.50 µs 17964.07 cycles (17964/8982) 1477 Hz 677.05 µs 16249.15 cycles (16250/8125) 1633 Hz 612.37 µs 14696.88 cycles (14696/7348) The period counts here are the closest even integer so that the duty cycle counts provide for exactly 50% duty cycle. This will produce a sinusoidal signal with minimum distortion after filtering.

Setting up PWM for DTMF Let us choose to use concatenated PWM channels to give us the needed accuracy. Use PWM channels 4 and 5 for the DTMF row. Output is on pin 5. Use clock A or SA. Use PWM channels 6 and 7 for the DTMF column. Output is on pin 7. Use clock B or SB.

PWM Setup Code For DTMF BSET PWMCTL, #$C0 BSET PWMPOL, #$F0 BCLR PWMCLK, #$F0 BCLR PWMPRCLK, #$FF ;set CON67 and CON45 ;4,5,6,7 active high ;50% duty cycle so polarity doesn t matter ;4,5,6,7 use clock A/B ;clock scale = 2^0, clock is 24 MHz ;clock period now (1/24) microseconds MOVW #34433, PWMPER4 ;697 Hz, signal generated at CH5 MOVW #17217, PWMDTY4 ;50% duty cycle MOVW #14696, PWMPER6 ;1633 Hz, signal generated at CH7 MOVW #7348, PWMDTY6 ;50% duty cycle BSET PWME, #$F0 JSR DELAY_1s BCLR PWME, #$F0 ;4,5,6,7 enabled ;TURN OFF

Motor Control Applications Motors convert electrical energy into mechanical energy. Motor control is normally concerned with one or more of the following: Motor shaft position Motor shaft rotational speed Available rotational power (torque) Control is usually optimized for one of these factors and it is generally not possible to control all three quantities simultaneously. PWM is easily adapted to two simple motor types, DC motors and Servo motors.

Servo Motors Servo motors employ internal feedback control electronics to allow the motor to be controlled by a simple pulse sequence. The servo motor control signal has a fixed frequency of 50 Hz and a duty cycle that varies from (nominal) 5% to 10%. Varying the duty cycles causes the servo motor to respond by changing some aspect of its operation. For a standard servo, the control signal is used to determine the position of the motor shaft. This is often constrained to less than one full revolution. Rotational speed is typically low. Torque is typically high. For a continuous-turn servo the control signal is used to determine rotational speed. Shaft position is uncontrolled. Torque is typically high.

Servo 3-pin connector GND, 5V, signal

Port P Servo Headers on Dragon12 3-pin connectors GND, 5V, signal (PWM)

Servo Connections The typical electrical connection for a servo motor is a 3-wire interface: Ground Power (typically 5-6V DC) Control input (50Hz, nominal 5%-10% duty cycle) On the servo motors purchased from www.parallax.com, the ground connection is a black wire, the 5V connection is a red wire, and the control input is a white or yellow wire. The Dragon12plus provides 4 connectors that provide servocompatible control. The signal lines for these connectors are Port P pins 4-7.

Driving Servos from Dragon12plus The Dragon12 provides 4 connectors that provide servo-compatible control. The signal lines for these connectors are Port P pins 4-7. Servo motors can draw considerable power, especially when loaded. Care must be taken when driving servos directly from the Dragon12plus to prevent overloading the onboard voltage regulator. If you plug in a servo to the Dragon12plus board and it draws too much power, it is likely that the Dragon12plus will reset when the output of the voltage regulator is pulled too low. When you are asked to use servos in the laboratory, a separate power board for the servos will be provided.

Controlling a Standard Servo Motor The position of the servo motor shaft is controlled by a single pulse-width modulated control signal. A 50 Hz pulse train with a period of 20ms with an active high pulse of 1.5ms (7.5% duty cycle) will cause the servo to move to the center of its range of motion then hold the shaft at that point. Longer duty cycles (> 1.5ms/20ms) will cause the servo to rotate counterclockwise. Shorter duty cycles(< 1.5ms/20ms) will cause the servo to rotate clockwise. The official valid range of duty cycles is from 5% (1ms/20ms) to 10% (2ms/20ms). The relative position of the servo is proportional to the difference from the center point to the extremes.

Controlling a Continuous-Rotation Servo The speed and direction of the servo are controlled by a single pulsewidth modulated control signal. A 50 Hz pulse train with a period of 20ms with an active high pulse of 1.5ms (7.5% duty cycle) will cause the servo to hold at a constant fixed point. Longer duty cycles (> 1.5ms/20ms) will cause the servo to rotate counterclockwise. Shorter duty cycles(< 1.5ms/20ms) will cause the servo to rotate clockwise. The official valid range of duty cycles is from 5% (1ms/20ms) to 10% (2ms/20ms). The relative speed of the servo is proportional to the difference from the center point to the extremes.

Example Code MOVB #$30, PWMPRCLK ;PWM CLOCK B SCALE = 8 MOVW #60000, PWMPER6 ;PWM CHANNEL 6&7 PERIOD = 20ms MOVW #4500, PWMDTY6 ;PWM CHANNEL 6&7 DUTY CYCLE 7.5% BSET PWMCTL, #%10000000 ;CONCATENATE 6&7 BSET PWMPOL, #%11000000 ;CHANNEL 6&7 ACTIVE HIGH BCLR PWMCLK, #%11000000 ;CHANNEL 6&7 CLOCK B BSET PWME, #%11000000 ;ENABLE PWM CHANNEL 6&7

DC Motor Control Generally, a DC motor is designed so that when a constant voltage is applied to the motor, the shaft will turn at a constant speed. A DC motor will be rated to have a maximum input voltage. A DC motor may be operated at a reduced voltage to produce a reduced speed. However, this is very inefficient and below a certain level will not work at all as the applied voltage will not produce sufficient torque to turn the motor, especially when loaded. A better way to control the speed of a DC motor is to rapidly turn it fully off and fully on to produce a desired average speed while maintaining full torque while it is on. PWM is appropriate for this.

Controlling a DC Motor using PWM The duty cycle of a PWM control for a DC motor determines the fraction of the maximum supplied energy provided to the motor to make the shaft turn. If the duty cycle is chosen too short, the motor may not be able to develop enough torque to make the shaft turn before the pulse ends. If the period is chosen too long, the motor will stop between pulses rather than continuing to spin from inertia. The appropriate PWM period and duty cycle are very dependent on the physical properties of the motor. Larger motors have greater inertia so, in general, pulses must have longer duration than for small motors to overcome the inertia initially but need shorter pulses to maintain rotation.

Driving DC motors from Dragon12plus The PWM outputs on the Dragon12plus are very limited in the amount of current they can provide. Attempting to drive a DC motor directly from the Dragon12 is likely to damage the microprocessor I/O pins. It is important to buffer the PWM outputs so that the drive current for the DC motor does not come directly through the microprocessor. The DC motors you will utilize in the laboratory will be accompanied by a circuit using a ULN2803A buffer.