Wednesday, July 10, 2013

Transistor-Output Optocouplers for Voltage Control

I once took apart an old computer monitor (like the ones with CRTs for screens). Among like a thousand other parts, I got 3 Sharp PC123's - that is, transistor-output optocouplers. With a bit of fiddling, I learned that these can be used for voltage control.

If you do not know, this is a transistor-output optocoupler (well, the inside of one):
How it works is this: you apply a current (voltage through a resistor, because resistors are voltage-to-current transformers) to the anode of the LED, and you ground the cathode. This is how you would normally power an LED. The base of the transistor is light-sensitive, and just like applying a voltage to the base of a normal NPN transistor, the collector and emitter act like a directional variable resistor. I say directional because the direction of the voltage going through the transistor has to be moving from collector to emitter (follow the arrow) to properly act as a resistor. I've never had much luck going the other way.

Now, why use this over a normal NPN, or even a FET? Well, mainly because I can never get transistors to work right, but also because optocouplers prevent high voltages from destroying receiving circuit. And, given that you are controlling an LED instead of the ever-so-scary depletion region in transistors, it is far easier to work with.

Before I move on to circuits, I should point something out: my exact opto's (Sharp PC123's) are hard to get your hands on because you either need to get them in a bulk of over 9000 or from older electronics. Thankfully, there is an easier-to-get equivalent: the Fairchild FOD817C (Mouser: 512-FOD817C). It is the EXACT same thing as the PC123 (just compare specs), but you can get them for like $.40 each and can buy as many or few as you want.

Now, on to circuits that allow us to use these optocouplers as voltage-control elements!!!

Here is a test circuit. Vary the input voltage with the pot (100k works best for direct connections to voltage sources), and watch the resistance change on the output side. Be sure to measure with the positive (usually red) probe on the collector side.

Here is a square wave VCO. You can swap out the capacitor to smaller values for higher frequencies; I recommend around 22nF for decent low and high frequency response. This exact circuit is more for LFO speeds. Output is the OpAmp output.

Here's a VCA. You can use smaller values for the input resistor. Note that the maximum gain of the amp is 2, and it has a capacitor on the end to even out any DC offset. Always be sure to put the optocoupler nearest to ground when used as a VCA. You can also do without the opamp stage and just have a voltage-controlled attenuator.

Here is a VCF. Neat thing about this circuit: given the large 1uF capacitor, this lowpass filter actually has some resonance! You can't really control it, though...

There are literally hundreds of different uses for this kind of setup. The above are just a few examples (that just so happen to end up making a full synth: VCO, VCF, VCA). A few things to keep in mind when designing circuits using this form of control:
-The 100k pot can be a CV input as well.
-The optocoupler tends to act the opposite of how you would think: increasing input voltage decreases output resistance. You can use an inverter with a DC offsetter to give you a positive voltage reflecting the opposite of the input.
-NEVER use a negative voltage for the optocoupler's input. You can use a diode facing away from the voltage source to protect from this.
-Using ground as the voltage input may cause problems. This may only be my experience, though.

Happy synth building!

1 comment:

  1. You totally can apply a negative voltage to the opto-couplers input, you just need to make some small adjustments to your schematics - first of all, tie the cathode to V- instead of GND, all the LED needs to work is for the anode to be a higher voltage than the cathode, so current flows the right way. You will need a bigger resistor in series with the LED because this will mean more forward current can flow, in my experience, too much forward current is much more likely to break an LED than a reverse voltage/current. Then you can set up your potentiometer voltage divider to sweep between +V and -V, connect a bipolar oscillator and the works! :)