One of the signals needed in my servo controller is a PWM signal to control the motor driver. From the Papilio FPGA board I plan to use, comes a 3.3V signal and there's two things that it will need.
- Isolate it from the "nasty" high voltage/current sections
- Translate it from 3.3V to 5V+
I had an 8 channel PC817 based Futurlec Opto-Isolator Mini Board ($5) lying around (it uses 560Ω series input & 1kΩ output pull ups), and wondered how it would perform. I rigged it up and was initially pleased.

PC817 based opto @ 1Khz
The bottom trace is the 3.3V input, and the top trace is the 5V output (both 2V/div).
Then I moved the frequency from 1Khz up to 25Khz...

PC817 based opto @ 25Khz
At 20Khz the output is barely exceeding 3V and certainly couldn't be called a square wave. At 20% duty cycle, it's basically off, and at 80% - completely on. If we produce a 25kHz signal, and want ~1% accuracy on the duty cycle, we'll need an opto capable of switching in around 1% x 25Khz Cycle = 1% x 40μS = 0.4μS. The PC817 has a quoted 4µS rise & fall time.
It was time to find a higher performance opto, and "common" DIP optos include the 6N13n family (manufactured by Fairchild, Vishay, Avago, etc):
- 6N138 & 6N139 - 0.1Mbs 10/35μS (High-Low/Low-High) switching
- 6N135 & 6N136 - 1.0Mbs 1.5 & 0.8μS switching
- 6N137 - 10Mbs - 0.1μS switching
It looks like the 6N136 should perform as required. A dual channel version, the HCPL2531 is available as well (and so I ordered a couple).
The HCPL2531 has a stated Input Forward Voltage of 1.45V and maximum average mitter current of 25mA. Passing 3.3V thru 220Ω will give IF=(3.3-1.45)/220=8.4mA. Maxium Average Output Current is a paltry 8mA (vs slower 6N138/9's 60mA), so the output side required a 2.2KΩ pull up to 5V (2.2mA). HCPL2531's propagation delay charts show the best "standard" results for IF=16mA & RL=1.9KΩ (close enough to my 8.4Ma/2.2KΩ setup).

HCPL2531 based opto @ 25Khz
The HCPL2531 was much better, and much more suitable to the PWM signals. Top is 3.3V input and the bottom is 5V output (the upper & lower traces are swapped from previous photos before).
The PC817 would still be suitable for slower signals (errors,home switches, etc), and will probably get used for exactly that.