The first circuit design for the VC-1 was a bit unstable and very dependant on the quality of the control signal. Since the goal here is to control the resistance with a PWM signal from the micro-controller, the control signal is going to be a fixed frequency square wave with a variable duty cycle (variable power-on period). I had tried an RC filter with no success. I ended up using a transistor and a programming trick to push the PWM frequency out of the audio range. The PWM programming became tricky, as a wrong value would load the response curve, to the point where distortion became a problem. In effect, some values would push the circuit into a nice “receiver” mode and I could hear radio talk on the amplifier!
Also, the circuit was using two PWM pins from the micro-controller, each with its own code to modify the response curve and additional code to balance the responses of the two opto-couplers used.
Here’s the new circuit (adapted from the Silonex web site):
How it works
As before, the INPUT signal goes into the first opto-coupler, while the second opto-coupler is connected to ground. This is known as a “series/shunt” volume control circuit. The audio signal goes through the first LDR. That’s the “series” part. The output audio signal is tied to ground (analog ground) through LDR number 2. This is the “shunt” part. The OUTPUT connection is equivalent to the wiper connection on a standard potentiometer.
The changes were made on the control side (left). The control voltage (PWM1) is expected to vary from 0 to 5 volts. When using a potentiometer, the circuit sees a nice regular voltage variation. When using a digital signal, like a PWM signal, the circuit is fed a rapidly switching 0-to-5 volt series of pulses. Because the light from the LEDs inside the opto-couplers will vary rapidly in sync with the control signal, some audio artifact might “bleed” through the analog signal on the LDR side. The solution is to use an RC filter to produce a varying voltage from the switching peeks of the PWM signal. Click here for a good explanation of RC circuits. According to the RC rules(and this site), using a 1.2K resistor with a 22uF capacitor will remove most of the ripple from the signal and still respond quickly to a change in PWM duty cycle, and produce a smooth volume curve with minimum induced distortion on the audio side.
Feeding the LEDs, the 5 volt source voltage is going through 2 diodes in series which lower it to 3.6 V (5 -0.7 -0.7). The idea here is that the resistance of the opto-coupler varies nicely for part of its range, but varies more rapidly near the end. Having a voltage limiter solves part of the problem. The 470 Ohms resistors limit the current through the LEDs. The LEDs inside the opto-couplers have a voltage drop of 2.5 V. All the resistor is doing is controling the current through the LED. If we have 3.6 – 2.5 = 1.1 V max through the resistor, V/R = I, 1.1/470 = 2 mA MAX going through that LED when the PWM duty cycle is zero. The response curve for the opto-coupler shows that the resistance for the LDR varies a lot when current through the LED goes from 0 to 1 mA, effectively going from >25 MegOhms to a few hundred Ohms. Letting more current through (up to 20-25 mA will lower the resistance from a few hundred to around 60 Ohms. I measured a maximum current of 1.6 mA through that LED when zero volt is present on the control input. As the voltage on the control input rises, the LED – connection is becoming “less negative” with respect to the LED + side. At some point, the LED shuts off and goes dark. The LDR’s resistance goes quickly to >20 MOhms. At the same time, as the control voltage goes up, the + side of the second LED becomes more positive than its – side. Eventually, the LED turns ON and shines a little light on the LDR. This will smoothly reduce its resistance and shunt the signal to ground to lower the output volume, while balancing the impedance seen on the output side of the circuit.
Ideally, both opto-couplers should have the same response curve. Silonex recommends using their NSL32SR3S series of matched LDRs. I only had unmatched units to build the circuit but the results were just fine. I suspect that matched components would provide a more balanced impedance, but because I use a good line buffer, the very low impedance going into this circuit is not affected too much by the irregular impedance curve.
I am now ready to build a few PCBs and field-test the device. The PCB will allow some circuit modification to account for variable specs of some of the components. One or both 470 Ohms resistor could be replaced by 500 Ohms potentiometers.
This circuit is (strongly) inspired by the sample circuits provided by Silonex. Take a look at this Silonex sample circuits for level contro PDF file.