Microcontroller › 8051 › How to interface MOC7811 sensor with 8051 Microcntroller › Hi VishalMake connections in
Make connections in the following manner: Short both these pins, anode of RX (emmiter) and cathode of TX, and then connect them to the GND pin of microcontroller. Also give +5 V to TX's anode using a current limiting resistor(1K would be fine) in series. Pull-up the RX's cathode (collector) using a 10K. This cathode-10K junction would now give you the analog voltage that you'll need to work with. This is so because the RX part behaves like a 3 pin NPN transistor with its emmiter and collector pins as told above while the base pin is the IR light it receives from the TX part.
Hope this helps