PDA

View Full Version : PWM component



chrisblanc
11-02-2009, 02:32 PM
Hi,
I am new to the forum and to Basic Stamp. I am looking for a pwm component that I could use with the BS2 (such as the pwmpal) but I need to be able to change frequency (from 10000 Hz to 25000 Hz with step of 100 Hz) and the duty cycle (1 to 99%) on every frequency. I need the duty cycle to be changed on the low (0) phase to avoid blinking (I am controlling led light).
Thanks for your help

Chris

Mike Green
11-02-2009, 10:22 PM
The pwmPAL is the closest thing to what you want for the Stamp. You'll do much better if you use the Propeller for this. It has the speed and precise timing and there is PWM code already available in the Propeller Object Exchange although I don't know if it makes changes only during the off phase. It would be easy enough to do that if you wrote your own code.

chrisblanc
11-02-2009, 10:40 PM
Thanks Mike but I am just getting used of the BS2 which is a ready to run product with a very easy language to handle. I am not sure I want to jump on something like the propeller if I can avoid to. I took a look at the language and it is not as attractive as the PBasic to me :-(
Chris

chrisblanc
11-17-2009, 12:50 AM
Hi,

For the ones interested, I find a work around. I had to use 4 components + the BS2 :
LM555 (RS 534-3469) as a pulse position modulator and DAC LTC 1257 to modulate 0-5 V and change the duty cycle
LTC 6900 (RS 506-2176) and a digital potentiometer to change the frequency.
It's working great and I get the smooth transition when dimming the leds I was looking for and couln't get with PWMPAL
Thanks again

jbalat
11-17-2009, 06:10 PM
Chrisblanc..

I have no idea what you mean but it sounds ingenious!
Can you post your circuit and an explanation if you think it will work for me ?

I am trying to use the PWM Pal to generate smooth frequencies for my cars ecu, however everytime I change the frequency I get a re-triggering effect which causes a glitch depending when the change cuts in.. The PWMPal is not smart enough to wait until the last pulse has finished..

chrisblanc
11-17-2009, 06:24 PM
Give me a few days and I will post all the information. I hope it will work for you too.

Phil Pilgrim (PhiPi)
11-18-2009, 02:00 AM
Chris,

Just out of curiosity, why do you need to change the frequency? Doing so will not affect the apparent brightness of the LED; only a change in duty cycle will do that.

-Phil

chrisblanc
11-18-2009, 02:45 AM
Hi Phil,

You are right but I need to light leds through inductive coupling. I look for the right frequency for the coupling then I need to change the duty cycle to be able to dim the leds.

Chris