Scale and offset voltage range from DAC to VCA

Started by JK Sleepling, February 26, 2024, 02:03:17 AM

Previous topic - Next topic

JK Sleepling

Hi all,

Still tinkering with my VCA based effect mixer. I control multiple DACs (MCP4922) which send control voltages to the VCAs (AS2164). Untill now I've just fed the DACs a reference voltage of 3.3V to create a CV span of 0-3.3V. Any gain I need is added afterwards by an op amp. Easy but not great regarding attenuation and noise. So to use the full range of the AS2164 VCA i need a CV span from -0.66 to 3.3V

I've read a lot about using an op amp to scale and offset, but still a bit puzzled. I could really need an actual example that is close to what I need.

I have +-9V bipolar source to drive my opamps and VCAs
And I have a +5V source to drive my digital board.

My thought is to feed the DAC a 5V reference which will give me 0-5V DAC output.
So how do i get from 0-5V to -0.66 - 3.3V?


ElectricDruid

Firstly, the inverting op-amp mixer is your friend for jobs like this. Sometimes the "inverting" part is a pain in the neck, but since you *want* some negative voltages, it's not really going to be too much of a problem this time. The worst case is you have to stick another unity-gain inverting amp after the mixer to flip everything the right way up.

The second thing to say is that "scaling" is just a way of saying "adding gain or atentuation"

So...let's have a look at the numbers.

You want -0.66V to +3.3V out, which is a range of 3.96V. 4V more or less.
You've got a 5V input range, so you need to cut that down to 4V, so a "gain" of x0.8.

Start with some typical value for the feedback resistor on your inverting mixer, say 10K.
The first input on your inverting mixer therefore needs to be 5/4 = x1.25 larger, which is 12.5K. Not very convenient. Since I need a 5-to-4 relationship, a 16K feedback resistor would be good, since then I could use 20K for the input resistor and we have the required x0.8 gain.

That deals with getting the *range* right. But our 0 to 5V input is now a 0 to -4V output. It needs shifting up to get to where we need it. We'll need to move it up by +3.3V. Since it's an inverting op-amp, that means you need a negative voltage going into the input to get a positive offset on the output.
You might be able to find a -3.3V voltage reference that you could use to provide the required offset, in which case you'd just add another 16K resistor connected to your -3.3V and off you go.
But what happens if you don't? Say you've got a -5V reference instead. That voltage is also going to need scaling down a bit, this time by 3.3/5 = 2/3rds, x0.66. So the required input resistor would need to be 5/3.3 = x1.5 larger than the feedback resistor. That's 24K for a 16K feedback resistor.

So use a -5V reference (I've used a 79L05 as a "budget volt ref" but it's not fantastic and I was being a cheapskate...;) ) and connect it with 24K. Your DAC voltage goes in via 20K, and you have 16K for the feedback. Add a big cap across the 16K feedback to provide some CV filtering and keep the noise down. That should be it.

*Don't* start cutting corners and using the -9V rail as the voltage reference. Any noise on that voltage reference is going straight into your VCAs, so you want these CVs to be as clean as possible.

Hope this helps. Good luck!

JK Sleepling

Thanks a lot @ElectricDruid - that made a lot of sense! I will find a -5V reference and try it out. Might need to draw the schematic first though. What about the powering of the op amp? just 5V and ground?

JK Sleepling


ElectricDruid

Yes, exactly like that.

For the power, you'd be better off using your +/-9V. You need to avoid clipping in this kind of voltage mixer circuit just like you would in an audio circuit, and a 0-5V supply won't give you enough headroom.

For the cap value, you need to think about how fast you want the output voltage to change. 2u2 gives you a cutoff of 4.5Hz, and takes around 180msecs to change from one voltage to another. I suppose the other question is whether you can easily *get* a bipolar cap that large!

Finally, one other thing I forgot to mention - due to the inversion, this circuit puts out +3.3V for 0V from the DAC (e.g. -100dB attentuation from the VCA) and -0.66V for 5V from the DAC (e.g. +20dB gain). That's flipped over from how you previously had it, so you'll have to account for that in your software.

JK Sleepling

Awesome thanks!

Regarding Caps:
What is the difference of putting a Cap here(Cf) and making a lowpass filter right after the DAC output? I mistook this cap for a lowpass filter cap. Maybe a 100nF is more appropriate as a bipolar?

The inversion only makes it more logic in the end (in my head). Higher bit value send to DAC = higher volume :)


ElectricDruid

Quote from: JK Sleepling on February 27, 2024, 03:20:30 PMWhat is the difference of putting a Cap here(Cf) and making a lowpass filter right after the DAC output?
That would be possible too. But since you've got an op-amp here doing the mixing/scaling/offsetting, you might as well add some filtering.
In fact, I was taught that for lowest noise, you always limit the bandwidth to only the part you're interested in - otherwise, you're just unnecessarily amplifying noise.

QuoteI mistook this cap for a lowpass filter cap. Maybe a 100nF is more appropriate as a bipolar?
You didn't mistake it. It is a lowpass filter cap. It forms an RC lowpass with the feedback R.

QuoteThe inversion only makes it more logic in the end (in my head). Higher bit value send to DAC = higher volume :)
Yes, I agree. It starts to look like the VCA was *intended* to be used like this, with a mixer to sum various input CV sources ;). In much the same way, I initially wondered why the VCA was inverting, but then I realised that it's because it has a current output, and the typical way to turn that into a voltage is an op-amp I-to-V stage as per the datasheet, and those are inverting, so there's no overall inversion in the complete circuit. It *does* all make sense!