Electronic – Interfacing open-collector optoisolator to 3.3V microcontroller

3.3vlevel-shiftinglogic-levelopen-collectoropto-isolator

I have a bit of a puzzle on my hands trying to interface a Fairchild MID400 optoisolator (popular "logic level" optoisolator for mains detection) to a 3.3V GPIO pin. The MID400 is a 5V part [*] and has an open-collector output which is pulled up internally to a 5V logic high level. This is the aspect that's causing me problems as otherwise I could just pull it up externally to 3.3V and all would be well.

The microcontroller and optoisolator are metres apart and I would like to perform the level shift on the optoisolator end of the wire where only 5V is available. I can't see how it can be done using diodes or resistors but happy to try out anything suggested.

Switching frequency is low, rise/fall time unimportant. Thanks for any suggestions.

[*] Just in case anyone should happen across this question wondering if the MID400 might work at 3.3V albeit out of spec, I tried it and it doesn't at all.

Best Answer

That open collector output V o is not pulled up internally according to the datasheet. Zero mention of it, and every diagram shows a simple npn open collector.

Power the VCC at 5V, and pull up V o to 3.3V vía a external resistor or your microcontroller internal pull-up resistor.

Worst case, use a voltage divider to bring the signal at V o down to 3.3V.