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



Similar documents
ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

LM 358 Op Amp. If you have small signals and need a more useful reading we could amplify it using the op amp, this is commonly used in sensors.

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

Switch Mode Power Supply Topologies

What Is Regeneration?

Microcontroller for Variable Speed BLDC Fan Control System. T.C. Lun System Engineer, Freescale Semiconductor, Inc.

Application Note AN-1187

Drive circuit basics + V. τ e. Industrial Circuits Application Note. Winding resistance and inductance

APPLICATION NOTES: Dimming InGaN LED

Designing VM2 Application Boards

Theory of Operation. Figure 1 illustrates a fan motor circuit used in an automobile application. The TPIC kω AREF.

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Hands On ECG. Sean Hubber and Crystal Lu

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

EET272 Worksheet Week 9

Constructing a precision SWR meter and antenna analyzer. Mike Brink HNF, Design Technologist.

A Digital Timer Implementation using 7 Segment Displays

Pulse Width Modulation

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

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

Conversion Between Analog and Digital Signals

Pulse Width Modulation Applications

FEATURES DESCRIPTION APPLICATIONS BLOCK DIAGRAM. PT2248 Infrared Remote Control Transmitter

Chapter 6 PLL and Clock Generator

Design and Construction of Variable DC Source for Laboratory Using Solar Energy

Principles of Adjustable Frequency Drives

Create Colorful and Bright LED Light with an LED Matrix Dimmer

Timer A (0 and 1) and PWM EE3376

Inrush Current. Although the concepts stated are universal, this application note was written specifically for Interpoint products.

DATASHEET. ADAM Arduino Display Adaptor Module. Arduino Compatible Shield P/N: 4Display-Shield-FT843 For the 4D Systems 4DLCD-FT843 Display

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Electronics 5: Arduino, PWM, Mosfetts and Motors

Glolab Talking Phone Dial Monitor

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AP331A XX G - 7. Lead Free G : Green. Packaging (Note 2)

Fundamentals of Signature Analysis

Selecting and Implementing H-Bridges in DC Motor Control. Daniel Phan A

A Practical Guide to Free Energy Devices

CHAPTER 11: Flip Flops

3-Digit Counter and Display

AN2680 Application note

Basic Pulse Width Modulation

Programmable Single-/Dual-/Triple- Tone Gong SAE 800

The 2N3393 Bipolar Junction Transistor

LAB4: Audio Synthesizer

7-41 POWER FACTOR CORRECTION

Welcome to this presentation on Switch Mode Drivers, part of OSRAM Opto Semiconductors LED Fundamentals series. In this presentation we will look at:

DC Motor control Reversing

POCKET SCOPE 2. The idea 2. Design criteria 3

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

PROJECT PRESENTATION ON CELLPHONE OPERATED ROBOTIC ASSISTANT

A PIC16F628 controlled FLL (Frequency Locked Loop) VFO for HF

Tutorial. replace them with cell-phone operated module. The advantages of a cell-phone operated bot are:-

Interfacing To Alphanumeric Displays

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Decimal Number (base 10) Binary Number (base 2)

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

Digital to Analog and Analog to Digital Conversion

Inwall 4 Input / 4 Output Module

Lab Experiment 1: The LPC 2148 Education Board

SG2525A SG3525A REGULATING PULSE WIDTH MODULATORS

Analog to Digital Conversion of Sound with the MSP430F2013

Special Lecture. Basic Stamp 2 Programming. (Presented on popular demand)

(Refer Slide Time: 00:01:16 min)

Introduction to Power Supplies

EST7502B PC Power Supply PWM with Supervisor

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

ABB i-bus EIB Logic Module LM/S 1.1

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Designing an Induction Cooker Using the S08PT Family

GT Sensors Precision Gear Tooth and Encoder Sensors

LED DIMMING A HELPFUL GUIDE...

css Custom Silicon Solutions, Inc.

VICOR WHITE PAPER. The Sine Amplitude Converter Topology Provides Superior Efficiency and Power Density in Intermediate Bus Architecture Applications

STEPPER MOTOR SPEED AND POSITION CONTROL

LC898300XA. Functions Automatic adjustment to the individual resonance frequency Automatic brake function Initial drive frequency adjustment function

= V peak 2 = 0.707V peak

Controlling a Dot Matrix LED Display with a Microcontroller

DS12885, DS12885Q, DS12885T. Real Time Clock FEATURES PIN ASSIGNMENT

Flexible Active Shutter Control Interface using the MC1323x

Features. Applications

Series AMLDL-Z Up to 1000mA LED Driver

Application Unit, MDRC AB/S 1.1, GH Q R0111

BJT Characteristics and Amplifiers

HANDLING SUSPEND MODE ON A USB MOUSE

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

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

8051 MICROCONTROLLER COURSE

Welcome to the combined product training module of Linear Technology and Wurth Electronics about their efficient design solution for DC/DC Flyback

Accurate Measurement of the Mains Electricity Frequency

Modeling and Analysis of DC Link Bus Capacitor and Inductor Heating Effect on AC Drives (Part I)

1. Computer System Structure and Components

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Current Loop Tuning Procedure. Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) General Procedure AN-015

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

Kit Watt Audio Amplifier

Transcription:

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module RS0 Microcontroller LEDs Motor Control Pushbuttons Purpose: To demonstrate an easy way of using a Freescale RS0K2 microcontroller to control the speed of a DC motor and brightness of LEDs. Brief Explanation: When one or more of the control buttons are pressed, the microcontroller will send 0 Hz pulses to the motor, LEDs, and speaker. Pressing more buttons generates pulses with longer ON time, which will make the motor run faster and the LEDs appear brighter. The speaker puts out a steady 0 Hz regardless of how many buttons are pressed because only the pulse width (duty cycle) is varied, not the frequency. Background on PWM: Pulse width modulation is a technique commonly used for controlling DC motor speed. It is also used for other applications such as controlling any DC device and even high power (Class D) audio amplifiers. PWM has the advantages of being very power efficient and also easily controlled by digital devices such as microcontrollers. By definition, duty cycle is the portion of each cycle that the signal is ON compared to how long it is OFF, expressed as a percentage. Instead of sending pure DC to a motor, PWM uses pulses that have precisely controlled ON and OFF times. If the pulses are on longer, then the motor will run faster. Conversely, narrowing the pulses on time will slow the motor down. typical PWM signal might look something like this:

more technical explanation is provided by www.wikipedia.org: Pulse width modulation uses a square wave whose duty cycle is modulated resulting in the variation of the average value of the waveform. If we consider a square waveform f(t) with a low value y min, a high value y max and a duty cycle D (see figure ), the average value of the waveform is given by: s f(t) is a square wave, its value is y max for. The above expression then becomes: and y min for This latter expression can be fairly simplified in many cases where y min = 0 as. From this, it is obvious that the average value of the signal ( ) is directly dependent on the duty cycle D. Keep in mind that although the ON and OFF times may vary, the frequency of a PWM signal will remain constant. The actual frequency may change for each application, but in our demo board example, 0 Hz was chosen to allow the signal to be in the audible range for demonstration purposes. Detailed Hardware Explanation: Refer to the schematic diagram on one of the following pages. The heart of this module is a Freescale MC9RS0K2CPC microcontroller configured with 5 inputs and output. When power is first applied to the circuit, capacitor C pulls the PT/CMPO/BKGD/MS pin high momentarily, thereby placing the microcontroller into Run mode.

The program will be explained in the next section, but basically the micro is continuously monitoring user input switches S-S5. These switches are assigned binary values in this way: Microcontroller Input Pushbutton Switch Binary value PT0 S PT S2 2 PT2 S PT S PT5 S5 6 If no button is pressed, that represents binary value zero, meaning that the operator is requesting to run the motor at 0% duty cycle. The controller will, therefore, put out pulses that are on 0% of the time and off 00% of the time. In other words, the output never turns on for 0% duty cycle. When a user presses one or more buttons, the program converts those buttons to a non-zero binary number and turns output PT on and off to generate an 0 Hz signal with a duty cycle determined by that number. If all buttons are simultaneously pressed, this will represent the largest possible 5-bit binary number and so the PT output will be on much longer than it is off. Pulses from IC-PT will turn TIP0 Q on and off through base current limiter R. Q is driven hard into saturation and cutoff, so the only time it spends in the linear region is during transitions from off to on or on to off. Therefore, Q will dissipate very little heat and waste very little power. DC motor MOT receives the current pulses from Q and integrates them into an average value. The inductance of the motor windings and the inertia of the rotor ensure that the motor turns smoothly rather than trying to jerk at 0 Hz. The 0 Hz is not even apparent when observing the motor. LED-LED, on the other hand, can respond much more quickly than the motor. lthough these LEDs appear dimmer and brighter when different duty cycles are selected, the truth is that they are actually switching on and off very rapidly. The apparent dimming is caused by the human eye performing a sort of optical integration and sending the brain an average value. To confirm for demonstration purposes that there actually are pulses of current going through the LEDs, speaker SPKR is in series with them. soft 0 Hz tone may be heard from this speaker when the buttons are pressed as the speaker responds to those current pulses. When Q switches on and sends current through MOT, a magnetic field is built up in the windings of the motor. When Q is switched off again, the magnetic field collapses and attempts to send a high voltage spike through Q and any thing else that gets in the path. However, diode D conducts and shunts the voltage generated by the collapsing field, thereby protecting Q from that potentially destructive high voltage spike. diode used this way is commonly called a freewheeling diode. The only component not yet mentioned is capacitor C2, and that is simply a decoupling capacitor to help prevent power supply noise from getting in or out of this module. Software Explanation: The RS0 microcontroller program was written using the free Freescale s CodeWarrior C compiler/assembler. The following explanation will make more sense if you are familiar with C programming. It should be noted that the RS0 does not automatically generate PWM signals as some microcontrollers will do, so this program accomplishes the PWM generation.

The main function first calls an auto-generated function, MCU_init(), which initializes the device I/O, bus clock frequency, timer interrupts, etc. void main(void) { MCU_init(); /* call Device Initialization */ Next is a simple loop that runs indefinitely and does two things:. Sets a byte variable, bpwmdesired, to a weighted value proportional to the current state of the five pushbutton input switches. Note that the 5/2 multiplier will limit the duty cycle to 5% to protect the motor and normalize the number over a 0- range (the range of a 5-bit binary number). bpwmdesired = ((PTD_PTD0) + (2*PTD_PTD) + (*PTD_PTD2) + (*PTD_PTD) + (6*PTD_PTD5)) * 5 / 2; 2. Calls function PwmCycle, passing it the desired duty cycle through the bpwmdesired variable. This function actually generates the output pulses for one cycle. // run one PWM cycle at appropriate duty cycle PwmCycle(bPwmDesired); The PwmCycle function contains a loop that divides the cycle into 00 equal intervals: for(bloopcounter = 0; bloopcounter <= 00; bloopcounter++) Within that loop, a call is made to function PwmInterval, which returns a Boolean value and sets output PT (also called PTD_PTD) on or off as appropriate for the given duty cycle and current interval as determined by the loop counter: PTD_PTD = PwmInterval(PwmDesired, bloopcounter); Function PwmInterval loops over and over until the overflow interrupt flag from the timer, SIP_MTIM, is set. This timed interrupt is set to occur every 2.625 us, making each of the 00 intervals per cycle just 2.625 us long. Note that the RS0 does not have true vectored interrupts. Instead, the interrupt bit must be polled and action taken accordingly. fter resetting the timer and acknowledging the interrupt, the function compares the desired duty cycle to the current 0-to-00 interval within the cycle and returns a 0 or to indicate whether the output should be off or on at that point in the cycle. byte PwmInterval(byte bdutycycle, byte bcurrentinterval) { while(! SIP_MTIM); // wait for overflow interrupt flag from timer MTIMSC_TRST = ; // reset timer and acknowledge the interrupt if(bcurrentinterval >= bdutycycle) // if end of ON time, return 0; // turn OFF the bit of concern else return ; // still in ON time for the bit of concern }

0 2 5 6 B C C2 00nF VDD.V IC C 00nF N00GP D VCC 2V M MOT Deleted from final design because mounted speaker volume was very low SPKR R2.Ω Pin Pin2 LED B C D S PT0/KBIP0/CMP+ PT/KBIP/CMP VDD PT2/KBIP2/TCLK/~RESET/VPP PT5/KBIP5 5 VSS PT/CMPO/BKGD/MS 2 PT/KBIP 6 R kω Q TIP0 LED LED2 D S2 MC9RS0K2CPC LED E E S F S Electronics Workbench 0- Peter Street Toronto, ON M5V 2H (6) 9-5550 F S5 Title: 5-bit PWM K2 Desc.: Display Board 5-bit PWM K2 G Designed by: Checked by: Document No: 000 Date: 200-2-9 Revision: Size:.0 G pproved by: Sheet of 0 2 5 6