Best Microcontroller Projects


XML RSS
What is this?
Add to My Yahoo!
Add to My MSN
Add to Google

Home
LCD-KEYS OnePort
Digital Downloads
C Course
State Machines
Interrupt Secrets
Schematic Tool
PIC Introduction
PIC Programming
PIC Programmers
PIC Compilers
PIC Projects
Tips & Techniques
Store
My SECRET
Oscilloscopes
Contact Me
About Me
Terms of Use
Search This Site
Freebies
Articles
Problem?-Solution
MicroBlog
Books
Resource Links
Site Map
Your Projects
Video du Jour
Rant/Rave
Privacy Policy

I use and
recommend Firefox
for the best internet
browsing experience. Click below for your
free copy today:

CLICK THE IMAGE:


Note: I find it faster
and easier to use and
it has great plugins.  

It even imports all your current
browser settings!

There's no risk as your existing browser is not affected in any way - you can just choose which one to use.


Find Out How This
Site Works
Like any engineering problem with the right tools it's Easy.
CLICK HERE 

Social Bookmarking
Click & Add:
add to BlinkBlink
add to Del.icio.usDel.icio.us
add to DiggDigg
add to FurlFurl
add to GoogleGoogle
add to SimpySimpy
add to SpurlSpurl
Bookmark at TechnoratiTechnorati
add to YahooY! MyWeb
Find out Why social bookmarking is
Useful For You.

Readers comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."


- Ranish Pottath


"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com

Learn PIC C Now
Wondering how to program your next project using C and need a great start?


"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

Learn Microcontrollers
"Interested in
Microcontrollers?"


Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon





PWM PIC : Pulse Width Modulation (PIC Micro).


PWM for the PIC Microcontroller (or any microcontroller).

"Pulse Width Modulation"

Project Update:

"Measuring Analogue Voltages

Without An ADC"


FREE )

Warning: This project could be Removed at
any time and will NOT be available indefinitely.
To avoid disappointment get it Now.


Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access enter your
Name and Primary email Now:


Primary Email
First Name

Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you MicroZine
Note: Look through the back issues for your
No-ADC method).


P.S. The newsletter also has essential information for you as well.

More Resources...


PWM (Pulse Width Modulation) is the term used to describe using a digital signal to generate an analogue output signal.  This is usually used to control the average power to a load in a motor speed control circuit.

You can also use it to generate a contunuously variable analogue output without using any other integrated circuits by smoothing the PWM signal using a capacitor.

As well as saving the costs of extra chips and interfaces the Pulse Width Modulation signal will not drift over time since it is generated from the time base of the processor i.e. a quartz crystal.  

Using analogue circuits to generate accurate signals that don't drift is a difficult task so PWM is very effective and cheap.

It works by changing the average voltage level and this is done by generating a constant frequency signal but one where the pulse width is changed (or modulated).

For a moment if you think of the digital signal when it is at its extremes i.e. normal - it generates the maximum of 5V when the output is high and the minimum of 0V when the output is low.  If you want to generate a 2.5V signal then you need to make the signal on for half of the time and off for the rest and then take the average.

PWM PIC digital output and average output

Examples of PWM from the PIC Micro

PWM pulse width modulation signal

In the diagram the digital signal (solid line) is at a constant frequency while the pulse width is changed (modulated).  The dotted line represents the average signal (if the digital signal is converted to an average).  The duty cycle represents the amount of time that the signal is high compared to the amount of time that the signal is low.

Project Update:

"Measuring Analogue Voltages

Without An ADC"


FREE )

Warning: This project could be Removed at
any time and will NOT be available indefinitely.
To avoid disappointment get it Now.


Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access enter your
Name and Primary email Now:


Primary Email
First Name

Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you MicroZine
Note: Look through the back issues for your
No-ADC method).


P.S. The newsletter also has essential information for you as well.

More Resources...

Duty Cycle

So the top signal is high for 10% of the period so the average is low, the middle signal is high for 50% of the period so the average is half and the bottom signal is high for 90% of the period so the average is high.  For fully off you use 0% and fully on you use 100%.

So the duty cycle is independent of the frequency of the PWM signal and you'll always see the same type of waveform for a specific duty cycle.

PWM Frequency

The frequency of the PWM signal is important depending on the device you are driving.  If the aim is to create a dc signal then you would want the frequency high (kHz) so a low pass filter could remove the frequency component.   How high depends on how much frequency component is allowed at output and depends on how it is used i.e. what error can be tolerated.

Averaging the PWM PIC output

To convert the PWM signal to a usable analogue signal you need to average it and you can do this by using a resistor capacitor filter (low pass).  The higher the PWM frequency the less that frequency will come through the filter so you can design out the PWM frequency from the analogue output.

Note: In some cases a filter is not needed as the filtering is done by the device you are controlling e.g. a motor (is inductive anyway).  Or in the case of an RGB led your eye averages out the signal (persistence of vision)!

Noise immunity of the PWM PIC signal

Since the PWM signal is fully digital the only way noise can affect it is if the noise is strong enough to change a digital 1 to a digital 0 and vice versa.   This immunity is much higher than a purely analogue signal that will be affected by any noise.  

For this reason changing an analogue signal into a digital one can improve either the signal transmission distance or its immunity to spurious noise.

For example you could encode an audio signal into PWM, send it over longer cables than a pure analogue signal could travel, and then remove the PWM frequency at the receiver.

Projects using PWM techniques :
Note: that the RGB led link above uses a software PWM method as it needed three PWM outputs and the 16F877 only has 2.

Controlling the PWM PIC output

The PIC microcontrollers are very easy to use with PWM as they have built in PWM generators - all you do is set up the relevant control registers

    // Timer 2
   PR2=199;   // 4 MHz clock -> 5kHz PWM frequency
   T2CON = (1<<TMR2ON);

   // Initialize Control PWM
   CCPR1L  = 30;    // Initial Duty
   CCP1CON = 0x0f;  // PWM mode set and 5,4 duty = 0

...and then control the duty cycle:

   CCPR1L = j;

Note that the above control only controls the upper 8 bits of the 10 bit PWM module (the other two  bits are in a CCP1CON).

Note the above code was taken from the C programming course.

P.S. One PIC 'gotcha' is that the duty cycle for the PIC microcontroller is not the generic duty cycle measured as a percentage rather it is the number of basic oscillator cycles for the output to remain high. So its related only to the master clock not to the period of the PWM signal!


Project Update:

"Measuring Analogue Voltages

Without An ADC"


FREE )

Warning: This project could be Removed at
any time and will NOT be available indefinitely.
To avoid disappointment get it Now.


Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access enter your
Name and Primary email Now:


Primary Email
First Name

Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you MicroZine
Note: Look through the back issues for your
No-ADC method).


P.S. The newsletter also has essential information for you as well.

More Resources...


Jump from PWM PIC Microcontroller notes to
Best Microcontroller Home Page


Don't forget to Sign Up for your

Microcontroller Newsletter

With "Essential tips and techniques",

..."New Site Info" and more...

Including a free project :

How to drive an LCD and 12key keypad using "Only One 8 Bit Port" with no interface logic!...

(Works for any microcontroller)

This costs you : Nothing...
Just fill out the form below and you'll get full C source code and project schematic and description.



Email

Name

Then

Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you MicroZine.
Google
 
  Best Microcontroller projects.