View Full Version : Convert PWM Signal into DC Value

08-02-2005, 11:44 PM
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???????///


08-03-2005, 12:54 AM
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 Schwabe (Parallax)
08-03-2005, 01:19 AM

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 (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Paul Baker
08-03-2005, 03:13 AM
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.