Shop OBEX P1 Docs P2 Docs Learn Events
Convert PWM Signal into DC Value — Parallax Forums

Convert PWM Signal into DC Value

onarollonaroll Posts: 1
edited 2005-08-02 20:13 in BASIC Stamp
Hello
I have a 2XSX stamp and I want to input a PWM signal that will be between 1.0 ms and 2.0 ms and output a DC voltage level between 0-5V who's voltage level is proportional to the inputted pulse width. For example a Pulse width of 1ms outputs 1V; 1.5ms outputs 2.5V; 2ms outputs 5V... Any Ideas???????///

thanks

Comments

  • YanroyYanroy Posts: 96
    edited 2005-08-02 17:54
    I believe you can use the PULSIN command to get the length of the pulse.· You could then output this to a DAC (digital to analog converter) which would give you 0 to 5V.· There's probably an even simpler way someone else can suggest...
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2005-08-02 18:19
    onaroll,

    In addition to Yanroy's suggestion, you can use the PWM output of the Stamp in combination
    with an OP-Amp configured as a "voltage follower".


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-02 20:13
    You may be able to do away with the stamp altogether, you can generate an analog voltage by driving a capacitor and resistor with a PWM signal. By choosing the value for the resistor and capacitor can provide a degree of scaling of the output analog voltage. The output is connected to the op amp which will buffer the voltage and provide better drive capabilities, also by setting the gain and reference voltage you can do additional shifting and scaling of the output voltage.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.