linear1 forums
[part of the linear1 network]
+ [linear1 case mods]
+ [LED Center]
+ [privacy policy]
Welcome, Guest. Please login or register.
March 15, 2010, 12:31:14 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Login Register

linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: How to build a PWM « previous next »
Pages: 1 [2] Print
Author Topic: How to build a PWM  (Read 15634 times)
Uzaree
Strong like bull
*
Offline Offline

Posts: 10


« Reply #15 on: December 13, 2005, 02:55:22 PM »

Can you program PIC in that?  Forgive me but I couldn't find more information on it.
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #16 on: December 13, 2005, 03:06:54 PM »

you mean PWM?  yes, you should be able to do pwm with it.

PIC is a brand of microcontroller, sold by Microchip.  The basic stamp is 'powered' by a PIC microcontroller
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
Uzaree
Strong like bull
*
Offline Offline

Posts: 10


« Reply #17 on: December 13, 2005, 03:20:42 PM »

Oh, haha I feel silly now hehe.  Thanks for your help JustDIY I'm going to pick one of them up in the next day or so.
Logged
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #18 on: December 14, 2005, 03:53:11 AM »

I've done a PWM with a NE556 with reasonable success. I used one of the 555 in 50% duty cycle mode (out-resistor-capacitor-ground). In that way I get a roughly triangular signal at the poles of the capacitor. The idea is to use the second 555 as a voltage comparator (speek of overkill). I tied its control pin to ground through a diode (but you can as well use a 1K resistor), then I used a (variable) voltage divider from capacitor to ground to feed the "voltage comparator". You can go smoothly from 0% to 100% if you adjust the resistors in the divider.
Logged
chopper
custom tail light builder
Smart like tractor
***
Offline Offline

Posts: 145


« Reply #19 on: December 20, 2005, 05:20:51 PM »

   Started breadboarding the pwm suggested by cpemma and have a question about cap's.

   I can't seem to find what a 100n cap is in other ratings but if I have this figured correctly (doubt it lol) it would be equal to a .01mfd.? How was my guess? Huh

   Oh, btw, my breadboard is to small for this but a little improvising has it going ok. Guess it is time for a larger board.?

                                                             
                                                         
Logged
cpemma
Global Moderator
Smart like tractor
*****
Offline Offline

Posts: 122



WWW
« Reply #20 on: December 20, 2005, 06:30:18 PM »

  ...have a question about cap's.

   I can't seem to find what a 100n cap is in other ratings but if I have this figured correctly (doubt it lol) it would be equal to a .01mfd.? How was my guess?

1,000,000 pico = 1,000 nano = 1 micro, so 100nF = 0.1uF, not 0.01  Tongue
Logged
cpemma
Global Moderator
Smart like tractor
*****
Offline Offline

Posts: 122



WWW
« Reply #21 on: December 20, 2005, 06:53:02 PM »

I've done a PWM with a NE556 with reasonable success...

There's a kit here using one, the documentation download available gives the circuit, component values, and some useful tips on parts substitution.
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #22 on: December 20, 2005, 07:59:26 PM »

or just use one line of code on a microcontroller Wink

HPWM Port, Duty, Freq

so HPWM 1, 128, 1000 would give me a 50% duty cycle at 1khz on hardware pwm output 1

Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #23 on: December 21, 2005, 04:16:36 AM »

I've done a PWM with a NE556 with reasonable success...

There's a kit here using one, the documentation download available gives the circuit, component values, and some useful tips on parts substitution.
Their solution is undoubtely more professional than mine, but I think they cannot do true 100% and 0% duty cycle.
or just use one line of code on a microcontroller Wink

HPWM Port, Duty, Freq

so HPWM 1, 128, 1000 would give me a 50% duty cycle at 1khz on hardware pwm output 1
Sure, but it's not very smooth in the lower part of the spectrum.
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #24 on: December 21, 2005, 08:58:44 AM »

HPWM Port, Duty, Freq

so HPWM 1, 128, 1000 would give me a 50% duty cycle at 1khz on hardware pwm output 1
Sure, but it's not very smooth in the lower part of the spectrum.

please elaborate.
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #25 on: December 21, 2005, 12:43:23 PM »

HPWM Port, Duty, Freq

so HPWM 1, 128, 1000 would give me a 50% duty cycle at 1khz on hardware pwm output 1
Sure, but it's not very smooth in the lower part of the spectrum.
please elaborate.
When you go from HPWM 1, 1, 1000 to HPWM 1, 2, 1000 you double the duty cycle, when you go from HPWM 1, 2, 1000 to 1, 3, 1000 you multiply it by 1.5; that's what I intended. It's usually sufficient for all purposes, if that's what you wanted to hear !
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #26 on: December 21, 2005, 01:58:12 PM »

ok, yes, I agree - there is some amount of granularity involved, since its a digital system not analog.

the pic hardware pwm is capable of 10 bit resolution up to about 40kHz pwm freq assuming a 40mHz cpu clock, so you have 1023 steps ... 0 being 0% duty cycle, 1 being less than 0.1%, 11 being close to 1%, 102 being close to 10%

doing a pwm routine in software, you could get a finer resolution, with the trade off of having limited cpu time to do other tasks.   a cheap 8 pin pic still costs more than a 555 based solution would cost, so its not the most cost effective means for a commerical end-user product.
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
Pages: 1 [2] Print 
linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: How to build a PWM « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.238 seconds with 22 queries.