linear1 forums
[part of the linear1 network]
+ [linear1 case mods]
+ [LED Center]
+ [privacy policy]
Welcome, Guest. Please login or register.
March 12, 2010, 04:59:27 PM

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 15610 times)
Uzaree
Strong like bull
*
Offline Offline

Posts: 10


« on: December 09, 2005, 05:06:10 PM »

Hey guys first post here.  They for the site, I have been a programmer for years but have really gotten interested in electronics.  I'm wanting to do some things with LED's and from what I understand PVM's seem to be the way to go.  If someone could help me out and tell me what I need to do to make one.

THanks

Chris
Logged
Rob
LED guy
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1970


The constant-current gardener


WWW
« Reply #1 on: December 09, 2005, 05:08:22 PM »

Welcome to the boards.

There are a few chips dedicated to doing just that, generating a PWM pulsetrain. Or you can build your own from things like the 555 timer.

Recommended reading assignment:
http://www.cpemma.co.uk/pwm.html

Logged

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

Posts: 122



WWW
« Reply #2 on: December 11, 2005, 07:21:56 PM »

Thanks for the plug, Rob.  Grin

For LED control I think I'd go for this one, it will control 0-100%.

Whereas a single 555's PWM range is around 5-95%, OK for motors but will leave a LED dully glowing at the bottom end.
Logged
Uzaree
Strong like bull
*
Offline Offline

Posts: 10


« Reply #3 on: December 12, 2005, 10:03:45 AM »

The reason I'm asking is I wanted to make some under car LED lights and AutoX Systems said he was using a PCB with 24 LED's with 3 PIC's and every LED has its own PWM with 128 set Resolution.  I"m just trying to see how I need to plan these things out on the board and how I can link them all together like he does.
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #4 on: December 12, 2005, 10:21:59 AM »

you didn't specifiy how you wanted to achieve PWM, so the posts above are the most direct route to a PWM pulse train.

all PWM is, is a switch turning on and off rapidly, with the on time and off time adding up to a certain frequency.

there is some example code on picbasic.org/forum showing how to create eight 8-bit PWM outputs on an inexpensive PIC microcontroller... each of these will give you 256 steps, although, really only 128 of them are usable in your application, since the bottom 128 are just dim colors.

that sounds like what autox is doing, since 24 / 3 = 8 ... he is probably using a protocol like RS485, I2C or SPI to communicate each 'tube'
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 #5 on: December 12, 2005, 10:34:28 AM »

Thanks JustDIY.

What else do I need to use the protocols on these boards.  I hate sounding like a noob but I'm just now getting into electronics but I've been a software dev for 6 years now so programing isn't a biggie.  Just getting the logic down for the components is giving me a hard time.
Logged
cpemma
Global Moderator
Smart like tractor
*****
Offline Offline

Posts: 122



WWW
« Reply #6 on: December 12, 2005, 10:39:01 AM »

Quote from: Uzaree
he was using a PCB with 24 LED's with 3 PIC's and every LED has its own PWM with 128 set Resolution...

I  hate to say it (as a fanboy of 'dumb' electronics), but the uPC/PIC way is probably best for dimming LEDs. The dim is by no means linear with duty cycle or current, and with programmed control you can set the size of the steps to give a visually-right effect.
Logged
Uzaree
Strong like bull
*
Offline Offline

Posts: 10


« Reply #7 on: December 12, 2005, 10:48:06 AM »

What is uPC?
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #8 on: December 12, 2005, 11:08:59 AM »

μPC = Micro Processor?  ... μC = mcu = Micro Controller

I wouldn't worry about protocols at this point - get yourself a PIC, get eight LEDs dimming, and then worry about connecting them together.  I'm here to help, but you're putting the cart before the horse Wink  To use any 'complex' serial protocol, you either need a lot of complex code to emulate a piece of hardware or a microcontroller with appropriate hardware built in.   Most of the PIC uC offer built in SPI/I2C hardware and RS485 hardware, so its just a decision on your part what you want to use.   Now that I think about it, all those protocol are a lot more than you need... something like simple synchronous serial, shift out the bits one bit at a time with a fast clock, and use an interrupt routine in the 'slave' pics to detect the clock transisiton, and start buffering data.  then its a matter of programming if you want to use some addressing scheme or just a fixed number of bits per transmission to determine which slave acts on what data.
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 #9 on: December 12, 2005, 02:10:44 PM »

Ok next question then.  I was looking at this site,http://www.electronic-kits-and-projects.com/pic_programmers.htm at these PIC programmers.  Which of these things should I get?

Keep in mind I have a $2000.00 budget but I'm wanting to spend as little as I can to get the best value.  I'll spend what I need if the quality is as it should be.  My budget also acounts for parts etc.
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #10 on: December 12, 2005, 02:21:25 PM »

I'm currently using the 3128

http://www.electronic-kits-and-projects.com/3128.htm

however, its an 'end of life' programmer and newer processors from Microchip are not going to be supported by it (like the new 24F series.  it is an excellent programmer, very fast and supports all the chips i need it to, plus very inexpensive as far as USB programmers go.

On a popular online auction site, you can find something called a microchip ICD/2 clone ... its a nock off of a very full featured programmer sold by Microchip - it should support nearly any processor released by Microchip, and its upgradeable.    I believe it comes in both serial and USB versions, plus it supports inline debugging of the processor while it's in circuit.

however, you shouldn't need to buy anything to 'get started' with PICs ... there are a lot of plans on the internet for building simple yet functional PIC programmers from spare parts - check out google for information on the JDM type programmer.


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 #11 on: December 12, 2005, 04:10:49 PM »

Yea I was reading your thread about the JDM type programmer a while ago. 
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #12 on: December 12, 2005, 04:19:55 PM »

i just checked the website of the manuf. for that programmer, the 3128, also known as the K128  ... it appears no work has been done on the 'new version' for some time now, so I'd consider it a dead project (literally, the lead developer has died)

manuf website:
http://www.kitsrus.com/

you might also check out www.sparkfun.com - they have a LOT of microcontroller (not just PIC) programmers and development boards.
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 #13 on: December 13, 2005, 02:12:32 PM »

JustDIY,

I am reading in a book that I have (I bought a Radio S*ack electronics kits for my son this year) that says the 4049 Hex Inverter is used to make a simple clock pulse generator.  Would a 4049 be better than a NE555 for PWM?

Thanks
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #14 on: December 13, 2005, 02:30:37 PM »

i've never done PWM with discrete / logic components ... perhaps someone else can provide some feedback.

pwm is just a switch, turning on and off, very fast... with the off time and the on time adding up to a constant number (the pwm frequency)

I imagine there is a hundred different ways to generate a pwm pulsetrain

speaking of the devil (ray-de-o-shak), they sell a kit called "Whats a Microcontroller, Basic Stamp Kit" ... it comes with a fairly powerful basic stamp processor, a programming guide and everything you need to 'get started'
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.237 seconds with 19 queries.