DIY Voltage-Controlled Amplifier



What is a voltage-controlled amplifier?

Like it’s name suggests, it is an amplifier whose amplification, or gain, is controlled by a voltage. By varying a voltage input, we can change the amplitude of a signal, making it quieter and louder by supplying a smaller or larger voltage as a control signal. Technically, they are usually current-controlled, but when you put a current through an element like a resistor you convert a current to a voltage. The people who first made one decided to call it a voltage-controlled amplifier, so we honor them by sticking with their name.

The Problem with an 8-Bit Digital VCA

Let’s discuss the problem I encountered that led me to learning about VCAs. Hopefully, you’re familiar with the concept of bit depth, that is the number of bits used by the system to represent numbers. In my case, the bit depth is 8, meaning numbers, particularly, the audio output level are represented by 8 digit binary numbers. With 8 digits, we can represent 2^8 = 256 different numbers. In the digital world, 0 is the starting point, so the largest number we can have is 255. With digital amplitude scaling, meaning changing the amplitude of a signal, we are just multiplying the signal by a fraction. For example, if the signal is a simple square wave with amplitude of 255, a signal that is 1, half the time, and 0, the other half of the time, and we want to scale it to half of the output amplitude, we multiply the signal by 127/255 and you end up with a signal that is 127, half the time, and 0, half the time. Well, that can work to some end, particularly for square waves ,which are easy to scale. But, what happens when you have a sine wave that isn’t just two numbers but can be any number in between? Well, when you perform the same scaling you effectively end up with a 7 bit sine wave. See, instead of representing a sine wave with numbers from 0 to 255, we only have from 0 to 127. A 7 bit sin wave actually doesn’t sound miserably unlike an 8 bit sound wave but it’s incrementally noisier. What if we want to make a really small sin wave? Well, the smaller you go, the smaller the effective bit rate until you end up with a signal which sounds nothing like a sin wave. It sounds particularly terrible if you try to make a VCA which has to go from really small to full size over time. As it progresses from tiny to full-scale, you get all sorts of artifacts which are incredibly disconcerting. Believe me, I tried it. This option would certainly work much better in a 16, 24, or 32 bit system, but in the 8 bit world, we’ve got to find another way.

Off the Shelf Solutions

If you’ve got the money, you can buy a VCA in a chip and it will perform generally better than anything you could build yourself. But, what would be the fun in that? If you decided to go the easy way, you could get a DBX2150 or one of it’s modern equivalents, like the THAT 2181, or 2002.  These chips are not cheap, $3.00-$5.00 per.  These chips are what you’ll find in mixers tied to the faders and a large component of a large mixer’s cost.


One option to build your own is a JFET, junction field effect transistor, based voltage-controlled amplifier. A JFET can function like a variable resistor. With a p-channel JFET, you apply a positive voltage to turn it off. Incrementally lower voltages turn the JFET on more, lowering it’s resistance. You can think of applied voltages as blocking current flow through the device. This being the case, you can use it in the bottom of a voltage divider, like so:

Higher voltages closer to the JFET pinch-off result in higher resistances which yield minimum attenuation. Lower applied voltages yield lower resistances which yield greater attenuation.

If this circuit worked ideally, we would be in business. Unfortunately, there are a few spoilers. The control relationship between applied voltage and resistance is sadly non-linear. If we sweep the control voltage from high to low, the attenuation changes very little for a large part of the range and then at the end falls suddenly. The other big problem, for me at least, is variability from JFET to JFET. The problem is so bad that JFETs are specified with wide ranges of pinch-off voltages rather than a nice specific number with a little tolerance.

There are some things that can be done to address this issue. You can apply logarithmic voltages to work out some of the non-linearity. 8 bits makes generating smooth logarithmci voltage beyond tough. A common solution is to add half of the drain-source voltage back to the gate. This has a linearizing effect. Introducing an op amp or two for the output and the feedback of the voltage is a traditional practice commonly found in guitar pedals with gain controls. For me, the variability from piece to piece is too much and I learned about a better way.

Operational Transconductance Amplifier VCA

Operational Transconductance Amplifier

The answer to my VCA problem is the operational transconductance amplifier, or OTA. There are many uses for an OTA and a pretty good VCA is one of them.  I’ve learned some things about how to operate it though and I’ll pass my lessons on to you.

High Gain

The circuit inside the OTA

Op Amps without feedback, or open loop, have very high gain, often 100,000 and up.  In this circuit, the OTA  has no feedback path, so it has very high gain potential.  But unlike other op amps, the OTA has an input which allows us to limit the gain.  If you look at the guts of the op amp, you’ll see the “Amp Bias Input” which is a current input.  We can basically starve or saturate this input with current which is a current mirror for the op amp input.  This current will be exactly the current available to the input stage of the op amp.  More current means more gain and less current less gain.  One thing to note is that the voltage on the bias input needs to be at least twice the base-emitter turn-on voltage, meaning a voltage at least around 1.2-1.3V.  Below this voltage, the OTA will output nothing because the transistors will be off and zero current will be available to the input stage to amplify the signal.

This is a screen capture from the Rockit 8 Bit Synth Schematic of my implementation of a VCA.

The other consideration with the high gain is that the input needs to be very small, less than about 5mV.  You’ll notice in my schematic that the voltage divider on the input reduces a 5V peak signal down to a 5mV peak signal.  You can exceed this voltage but you’ll encounter gain non-linearity meaning the gain will no longer increase and decrease linearly with increases and decreases in input signal level.

Control Signal

The control signal is a filtered PWM signal going into R36.  By supplying a range of duty cycles, we generate the control voltage which is then turned into a current by R35.  Increasing and decreasing the value of R35 will have a dramatic effect on the output signal level.  This value can be determined experimentally by messing around measuring inputs and outputs which is what I did, or it can be calculated roughly with the formula for the gain which is:

A = Vout/Vin =  (Voltage Divided Input)*19.2*Ibias*Rload

and Ibias will be equal to:

(Vcontrol – 1.2V)/R35

This is a very rough calculation because the 1.2V is not really accurate as the base emitter input voltage could be higher.  The gain formula isn’t perfect either.  It gets your values in the ballpark, but you’ll have to experiment to get it just where you need it.

Op Amp Output

The output of the OTA is a very small current.  The maximum current output is down in the microamps.  In order to make this useful, we’ll have to use a resistor, Rl, to convert it to a voltage.  At the same time, we obviously can’t load down this output because any load will dramatically effect the voltage because no current is available.  You’ll notice that the OTA has a built in Darlington pair transistor on the chip.

Manufacturer Suggested VCA

As shown in this manufacturer image, the darlington pair can be used on the output as a buffer.  The darlington pair will supply the necessary current for the next stage in the signal path, sparing the OTA  the load.

In my case, I can’t use the darlington buffer because of the limit it imposes on the voltage rails.  The darlington pair will have a minimum voltage drop across it of 1.0V meaning that’s as close as the signal can get to the maximum circuit supply voltage before it distorts. My maximum supply voltage is 5.0V, so that would eliminate 20% of my operating range. Unacceptable.

Op Amp Buffer

Unity Gain Op Amp Buffer

The solution is use an rail-to-rail op amp as a unity gain buffer.  This reduces the upper limit on the output voltage and we can get pretty close to full swing output capability.

Final Thoughts

This voltage-controlled amplifier is fully functional and tested.  Things that can force changes to this circuit are many, but are mostly limited to larger and smaller input signals and higher or lower supply voltage ranges.  In order to make it useful, you still have to supply the control signal with signals which allow the voltage gain to change over time.  I’ll present my code for an amplitude envelope generator some other day.  Cheers and happy hacking!

Posted in General Electronics, Rockit and tagged , , , , , , , , , , , , , , .


  1. If you use a DAC for your 8 bit output, and it has a vref pin, you can make a VCA that does not need any OTAs, just use another DAC or filtered PWM output with envelope/volume etc to control the vref. that way you do not lose any bit depth. and still don’t use much hardware.

    • You certainly could. It would be an external DAC chip, right? I looked at those a while back and they were a little on the pricey side. I was trying to keep costs down for Rockit, but I’ll keep it in mind for the future. It would definitely be lower parts count and probably cleaner on the noise side. Cheers.

      • when i made the “neutron scarab” (its on youtube) i used a very cheap parallel DAC called DAC0808, which this worked perfectly on (2 actually) but you need a lot of pins for that. for serial (SPI) you could use one of the nice cheap 12 bit MCP, like
        MCP4921, $2.50. they are quite easy to interface with even if you dont have SPI, or those pins are taken up on your microcontroller, you can bit bang the values just when you need to.

        • Awesome sound out of your synth. That price sounds about right. I’ll have to look into that next time around. I am hogging up the SPI bus with the filter. The one nice thing about this solution for me is very low processor overhead. Just set audio register bits to pwm1 and level bits to pwm2 and you’re done. I don’t think I’ve got the time to bit bang but there might be time to handle the filter and audio out at the same time. I’d have to run the numbers.

          • if you have 8 spare pins then use an 0808 you just directly output the levels with “portx =” (and sort it out with logic for pins on other ports) and it is the absolute fastest way to get a signal out anyways. no way i could do 4 oscillators with serial output.

          • You’re right. That’s quick. I’m using all 40 pins on the micro with the current setup. I’m using a bunch to directly multiplex all the LEDs and the display, which in previous iterations I did with i/o expanders and of course could be done with shift registers. But, doing it this way reduced the overall system cost as low as I could figure out how. I think I could manage 1 more oscillator, but I’m using a lot of clock cycles to do other things like calculating the filter envelope, filter values, pitch shifts, and the LFOs. I’m sure I could free up 8 pins, but I’d have to add several more parts to manage the LEDs but then we’re talking a $5-$10 change.

  2. Pingback: Synth DIY : Software for Generating ADSR Envelopes | HackMe Electronics

  3. ahh, i love this – i’m looking for circuits to do an open tablet design that will, for one reason or another, need to use an STM32F for the mic, speakers and the webcam. mostly the reason for that is to reduce the BOM and the cost.

    would you be willing to help by pointing me at a more complete circuit diagram and allowing me to use it? i can do circuit diagrams in PCB CAD programs but i don’t fully grok what i’m doing (it’s been 25 years since i did electronics circuits at school). in particular, what values did you use for the RC circuit to smooth out the PCM input?

    i literally need pretty much the exact same circuit, for the exact same reasons: an STM32F has only a 12-bit range on its DAC and its ADC, and there’s a limited number of pins so i have to use PCM for the volume control.

    btw if you’re not busy and have some spare time and e.g. a leaflabs maple handy and/or would be happy to help out on a commission basis when the tablets go into production, i could really use your help.

  4. Hi, I would like to amplify a 100-200 mv pulse to 5v DC. The frequency of the pulse would vary between 20-600 per second. At lower frequency the pulse is 100-200 mv, So I would like to amplify it to 5 volt. But at higher frequency the pulse goes upto 30-50 volts. So I would like to maintain the pulse to 5 volts at all frequencies So I need the schematics for it or the desired changes in the above schematics. Plz PlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlzPlz

    • It sounds like you’re looking for an automatic gain control, not so much a simple voltage controller amplifier. Altering this design for that purpose is something you’ll have to DIY. You’re looking to attenuate as well as amplify. The circuit you’ll need will be substantially more complicated than the above design. I wish I could say that I could help you, but time is in short supply. If you do manage to solve the problem, I’d love to hear about it.

Leave a Reply