Shop OBEX P1 Docs P2 Docs Learn Events
PWM component — Parallax Forums

PWM component

chrisblancchrisblanc Posts: 6
edited 2009-11-17 18:45 in BASIC Stamp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-02 14:22
    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.
  • chrisblancchrisblanc Posts: 6
    edited 2009-11-02 14:40
    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
  • chrisblancchrisblanc Posts: 6
    edited 2009-11-16 16:50
    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
  • jbalatjbalat Posts: 96
    edited 2009-11-17 10:10
    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..
  • chrisblancchrisblanc Posts: 6
    edited 2009-11-17 10:24
    Give me a few days and I will post all the information. I hope it will work for you too.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-11-17 18:00
    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
  • chrisblancchrisblanc Posts: 6
    edited 2009-11-17 18:45
    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
Sign In or Register to comment.