Shop OBEX P1 Docs P2 Docs Learn Events
Using PWM for Analog Output: Application note #15 questions. — Parallax Forums

Using PWM for Analog Output: Application note #15 questions.

Wolverine69Wolverine69 Posts: 31
edited 2009-01-07 13:30 in BASIC Stamp
· I have·a BS2 & Board of Education that I've been trying to use to generate an analog voltage that varies between 0 & +10 volts.· I've been referring to 'Basic Stamp Application Note #15: Using PWM for Analog Output' and have built the op-amp buffer circuit displayed in Figure #4.· I'm using a TI UA741CP op-amp instead of the CA5160 that is used in figure #4 though.

· My first problem is that I can't get the op-amp buffer circuit to output more than 4.9 volts even when I have the Duty Cycle value set to 255 in the PWM statement.·· According to page 142 of the app. note, the gain is set to 1 due to component values, so I've tried changing all the resistor & capacitor values one by one and the max. voltage output is still limited to 4.9 volts.· I've also tried varying the supply voltage from 5 to 18 volts, still no change in max. output voltage. So how do I change the gain to approx. 2X so that I can get a max. voltage output of approx. 10 volts?

· The second problem is that the op-amp buffer circuit will not output any voltage lower than 1.9 volts, even if I ground the input to the circuit.

· Any ideas or suggestions?

Here's the very basic code that I'm using right now for testing.

' {$STAMP BS2}
' {$PBASIC 2.5}

DO
· PWM 0, 255, 255
LOOP

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-01-07 13:30
    ·Lets assume you can get 0 - 5 volts out of the Stamp by making the connections as shown in the Help File under PWM.

    · Note that this connection cannot drive much current into a load; hence the need for the op-amp.

    · Now, if the op-amp has a gain of 1, the maximum output will be 1 times whatever the input voltage is. Coming off the Stamp, this is a maximum of 5 volts. So, the op-amp output will be 5 volts, max.

    · To get a higher output, you'll need to set the op-amp gain to at least 2. And, the op-amp will have to be able to swing at least to the level you'll be expecting; this will usually be indicated by the op-amp supply voltage being a bit above your expected max output.

    · Any book on op-amps will show you how to change resistor values to adjust gain.

    · I've attached one of my standard op-amp circuits which will probably work for you. On the far left of the sketch, take out the input resistor and feed your 0-5 volts from the Stamp into Vin.

    · Cheers,



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
Sign In or Register to comment.