Вы находитесь на странице: 1из 7

Home

Ads by Google PWM Motor Driver 2.4 G RF AVR Develop

Search here Search

Jan-9th-2009

Introduction to PWM – Pulse Width Modulation.

PWM Sensor Displays


Monitor position sensor data with advanced digital panel A digital device like a microcontroller can easily work with inputs and outputs
meters. that has only two state, on and off. So you can easily use it to control a LED's
www.rapidcontrols.com
state i.e. on or off. In the same way you can use it to control any electrical
Proposal Generator device on/off by using proper drivers (transistor,triac, relays etc). But
Configure, Calculate, Visualize Generate Sales Documents
www.sofonguidedselling.com
sometimes you need more than just "on" & "off " control over the device. Like
if you wanna control the brightness of a LED (or any lamp) or the speed of
Hot Swap Controllers DC motor then digital (on/off) signals simply can't do it. This situation is very
Live Insertion Inrush Current Control and System
Monitoring smartly handled by a technique called PWM or Pulse Width Modulation.
www.linear.com
PWM for HHO 50 amp PWM is the technique used to generate analogue signals from a digital
Constant Current PWM Generator with LCD and digital device like a MCU. Almost all modern MCUs have dedicated hardware for
control. PWM signal generation. In this tutorial we will learn the basics of PWM
www.3rdbrakeflasher.com
technique and later on we will see how to implement PWM generation with
AVR microcontrollers.

PWM : Pulse Width Modulation


A digital device, like a microcontroller can only generate two levels on its output lines, HIGH=5v and LOW=0V. But what if we
want to generate 2.5v or 3.1v or any voltage between 0-5 volt output ? For these kinds of requirement, instead of generating a
constant DC voltage output we generate a square wave, which has high = 5V and Low = 0v (See figure 1).

Fig. 1 - A PWM Waveform.

In the figure you can see a PWM signal. As you can see it is just a digital signal (can easily be generated by MCUs). But let me
clarify some of its properties.

The signal remains "ON" for some time and "OFF" for some time.
Ton = Time the output remains high.
Toff = Time the output remains Low.
When output is high the voltage is 5v'
When output is low the voltage is 0v
T = Time Period = Ton + Toff

Duty Cycle.

It is defined by

So you can see it is just the percentage of the total time the output was high. In the above figure (Fig. 1) you can see that Ton =
Toff = Half of the time period. So the duty cycle is 50%. If the frequency of such wave is sufficiently high (say 500 Hz) the output
you get is half of 5v i.e. 2.5 volts. Thus if this output is connected to a motor(by means of suitable drivers) it will run at 50% of
its full speed at 5v. The PWM technique utilizes this fact to generate any voltage between two extremes (for example between
0-12volts). The trick is to vary the duty cycle between 0-100% and get same percentage of input voltage to output. Below are
some examples of PWM signals of different duty cycle.

Fig. 2- A PWM Waveform. Duty Cycle = 12.5% Analog Voltage Out = 12.5% of Vcc (5v) = 0.625 Volts
Fig. 3- A PWM Waveform. Duty Cycle = 75% Analog Voltage Out = 75% of Vcc (5v) = 3.75 Volts

So you just saw how we can generate analog voltage levels from a digital system using PWM technique. If the output is
provided with an R/C filter you will get a pure DC signals levels instead of square waves. But this isn't required for driving
motors or controlling LED's brightness. You can feed the PWM signals directly to then (by directly I mean without the R/C filter
and not the drivers (like transistor etc)).

In the next tutorial we will see how to actually generate PWM signals from an AVR MCU. Till then good bye. But don't forget
to leave your comment ! May be you have some doubts, request or any feedback, feel free to say !

Automated Forex Trading Rf Signal Generator


Auto Trade 300+ Forex Strategies... No Experience Find Electronics Solutions For Your Business. Get It
Necessary! Done Now!
www.ProSignal.net/Automated-Forex www.business.com

This entry was posted on Friday, January 9th, 2009 at 4:11 pm and is filed under AVR Tutorials. You can follow any responses to this entry through
the RSS 2.0 feed. You can leave a response, or trackback from your own site.

11 Responses to “Introduction to PWM – Pulse Width Modulation.”

1. 1
PWM Signal Generation by Using AVR Timers. | eXtreme Electronics Says:

[...] the last tutorial you saw how the PWM technique helps us generate analog signals from a microcontroller. In this [...]

January 14th, 2009 at 10:33 am


2. 2
PWM Signal Generation using AVR Timers | eXtreme Electronics Says:

[...] Introduction to PWM – Pulse Width Modulation [...]

February 8th, 2009 at 11:15 am


3. 3
Paul from Edmonton, Canada Says:

Hi Avinash,

Do you have any suggestions about how this might be applied to decoding infra-red protocols?

Cheers,

Paul

March 15th, 2009 at 1:43 pm


4. 4
Avinash Says:

Hello Paul,

For IR decoding see


http://extremeelectronics.co.in/category/code-libraries/

March 15th, 2009 at 7:10 pm


5. 5
aditya Says:

nice the author seems to be doing a very nice job

June 7th, 2009 at 9:25 pm


6. 6
tom Says:

thanks for putting up the info, you have great tutorials. they are short and have just enough info not to complicate noobs!
great work and thank you again for sharing!

July 9th, 2009 at 6:55 pm


7. 7
ASHISH Says:

the above text was really helpful…

July 22nd, 2009 at 2:00 pm


8. 8
sunil Says:

its quite helpful……

July 29th, 2009 at 8:45 pm


9. 9
Sikhmbuzo Says:

Hey, i am using a dsp for my project. Can you pls help me by showing me how to generate a PWM for a DSP 56F807.

Thanks

August 21st, 2009 at 6:14 pm


10. 10
twinkle Says:

Hi Avinash,
Thanks a lot .
Actually becoz of ur tutorials i came to know the clear clarification regarding PWM.its helped me so much.
And wishing u a very bright future.

October 29th, 2009 at 4:12 pm


11. 11
kishen Says:

really good tutorial


thx a lot
really helped

November 24th, 2009 at 8:20 pm

Leave a Reply

Name (required)

Mail (will not be published) (required)

Website
Submit Comment

Notify me of followup comments via e-mail

New Products
Tags
Meta

New Products

Tags
avrs xBoard electronics Seven Segment Timer0 timer1 Multiplexing internal peripherals programming ir ADC
isr atmega8 hi-tech hi-tech c PIC Development Board i2c pwm Hyperterminal microcontrollers USB
Programmer avr gcc avr programmer c interrupt lcd mplab usb pic programmer Timer mcu USART
rs232 atmega16 pic tutorial pic programmer atmega32 pic16f pic16f877 pic18 pic18f
microchip pic18f2550 pic18f4550 pic AVR
Meta
Log in
RSS
Comments RSS
Wordpress
Valid XHTML

Recent Post
Comments
Video

Recent Post
Interfacing DS1307 RTC Chip with AVR Microcontroller
Interfacing LCD Modules with PIC Microcontrollers.
AVR Project – Relay Timer with ATmega8 AVR MCU
AVR Development Board – Assembly Instructions
RF Communication Between Microcontrollers – Part II

Comments
kishen: really good tutorial thx a lot really helped
ankita: dis was realy helpful… but can we do the same ussing pic16f876a???? how to include...
andy: Hi, Nice tuto, could you show me how to setting about clock source for AVR…? I used...
Bob Cousins: Hi there, In your wiring diagram you have VSS and VDD connected the wrong way. VSS...
Diego: I fine great your software….If you want I can help to translate your software to spanish...
Fernando Machado: Very nice job! Well done and free!
sAnuB sAliM: Thanxz dude…. This site is very useful to the beginners…. Thank u…...

Video

Categories
AVR Development Board
AVR Projects
AVR Tutorials
Code Libraries
Code Snippets
Hardwares
Microchip PIC Tutorials
PIC Development Board
Programming in 'C'
RF
Software
Tools

Navigation
Home
Forum
Shop
Links

Subscribe
Get New Articles Deliverd To Your Inbox!

Email address:

Subscribe

Delivered by FeedBurner

Recent Posts
Interfacing DS1307 RTC Chip with AVR Microcontroller
Interfacing LCD Modules with PIC Microcontrollers.
AVR Project – Relay Timer with ATmega8 AVR MCU
AVR Development Board – Assembly Instructions
RF Communication Between Microcontrollers – Part II
Programming in C – Tips for Embedded Development.
RF Communication Between Microcontrollers – Part I

Comments
kishen: really good tutorial thx a lot really helped
ankita: dis was realy helpful… but can we do the same ussing pic16f876a???? how to include...
andy: Hi, Nice tuto, could you show me how to setting about clock source for AVR…? I used...
Bob Cousins: Hi there, In your wiring diagram you have VSS and VDD connected the wrong way. VSS...
Diego: I fine great your software….If you want I can help to translate your software to spanish...
Fernando Machado: Very nice job! Well done and free!
sAnuB sAliM: Thanxz dude…. This site is very useful to the beginners…. Thank u…...

eXtreme Electronics © 2007-2009 | See Our Privacy Policy

Вам также может понравиться