News:

SMF for DIYStompboxes.com!

Main Menu

voltage scaling?

Started by loss1234, December 20, 2008, 08:52:17 PM

Previous topic - Next topic

loss1234

I have found there are many cases where i need to change the RANGE of a voltage. (in the case of getting a CV ready for an LDR or an FET for example)
I know that voltage scaling CAN be done with opamps but i have no idea how.

any articles, links, or old threads would be highly appreciated.


thanks

R.G.

Easy. Set the gain.

If you have a control voltage that needs to go between 1 and 6V and what you have goes between 2 and 3V, then you need to correct both the AC and DC positions. The average DC of the first one is 3.5V. The average DC of the second one is 2.5V. The AC (i.e. signal swing peaks) range of the first is 5V, the second is 1V.

So you need an opamp circuit which takes on the second signal, (2.5V +/-0.5V) and outputs the second one, 3.5V +/-2.5V.

Right away we know that the forward gain needs to be five, so if we use noninverting, the gain equation is G = 1+Rf/Ri, and then Rf/Ri must be 4. But all by itself, if you feed 2.5V +/-0.5V into a non-inverting gain-of-five, you'll get 12.5V+/-2.5V, which is correct for the AC part but not the DC. We need to subtract out some DC. And we only get that if we connect the Ri back to a source of 2.5V, the DC value seen on the + input. But if we connect Ri to some other voltage, then the difference between that DC voltage and the 2.5V average on the (+) input gets subtracted from the output. We need to get rid of 9V, and we have to leave the gain at 1/4 (we lose the "1+" because we're now inverting) so we need the voltage on the Ri to be 1/4 of 9V higher than 3.5V. 1/4 of 9V is 2.25V, and then the voltage it needs to connect to is 3.5V +2.25V, or 5.75V.

The essential are: figure the gain (or loss) you need to get the peak to peak swing to be right. Then figure the DC offset to get it into the right place. Generally you want to figure the center of the swing. As a final step, you need to check the opamp datasheet to be sure that it can do what you're asking it to. If its output will only go as close as 1.5V to either power supply like the TL072, it's not going to go to ground even if the inputs ask it to. If the inputs can't be taken any closer than 2V to ground or +V, the opamp may do nasty things like oscillating or latching up if you try to make it. It's like working with donkeys. Donkeys are not really stubborn. But they will NOT do anything they think will cause them to hurt themselves. Horses don't think that much. You can make a horse hurt itself pretty easily. Older opamps are like horses, they'll try to do whatever you tell them to and get hurt. Modern opamps are more like donkeys and just refuse to play if you ask them to do something fatal.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

loss1234

ok. thanks for the great answer! when the baby stops crying i will try to dive in but first let me ask...i understand the average AC levels...but the DC makes less sense.  how do you get 3.5v out of 1 to 6? this an area where the theory side of electronics is still SO new to me (practical application of schematics and techniques is much easier than understanding the underlying theories)

sorry for being such a noob

thanks again

"If you have a control voltage that needs to go between 1 and 6V and what you have goes between 2 and 3V, then you need to correct both the AC and DC positions. The average DC of the first one is 3.5V. The average DC of the second one is 2.5V. The AC (i.e. signal swing peaks) range of the first is 5V, the second is 1V."

R.G.

Nope, good question.

On the 1 to 6:
The "ac" part of the signal is 6-1 = 5V. Of that, half is a swing up from the middle of the signal, and half is a swing down. If the waveform was 5V peak to peak with a zero DC level, it would be +2.5V and -2.5V. But we want 1 to 6. So we have to move the "middle up until the peak hits 6 and the bottom is at 1. So we add a volt. That gets us to +3.5, -1.5. Hmmm.... need another one. Ok with a +2V average offset, we get to +4.5, -0.5. Still not enough. Up another volt. That's +5.5, 0.5. Hey, close! Add another half volt and we have it: +6, +1.

That's not how I did it. I just took half the peak-to-peak and subtracted that from the absolute peak.  Actually, you can get it from simply averaging the two voltages: 6V +1V = 7V, then take half of that, 7/2 = 3.5. Which is what it ought to be, since we were looking for the average.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.