A circuit to simulate an a.c input opto coupler. Based on https://www.circuitlab.com/circuit/bdxks2/optocoupler-01/ (The actuall opto coupler is the LED's, Current Controlled Current Sources and the Transistor)
Caution! Dont play with mains ever!
Designed to detect the presence of 230vac and output an acceptable logic level to an RPI.
The opto I'm attempting to simulate is the VISHAY VOL628A-3X001T (http://www.farnell.com/datasheets/1911452.pdf) The input current is 1mA with a worse case CTF of 100%. Note: Switching the A.C current off and on causes the LED's to "explode". This should not happen on the Vishay as its maximum current rating is 60mA. (I only saw a peak in ruch of 5mA. I will calculate this later)
The input stage limits the current to the leds by the reactance of the capacitor and the resistance of the resistor. See http://www.marcspages.co.uk/tech/6103.htm for more info.
The output stage is to smooth the signal so that the logic output stays stable when the input crosses the zero point. Desinged to input to a RPi