Need an interface that gives me a steady 0 with 220V in and a steady 1 without 220V in using a 4N25 or TIL111 or any other opto that gives galvanic isolation.
What about a transformer, diode and a simple RC filter ?
You can use a transistor for the switching, as the transformer gives the isolation.
If you want even more isolation you can always connect the circuit to simple optocoupler.
The idea is to use a bridge rectificador with diodes 1N4007 it filters with a capacitor ceramic superior at 400V Taking the the voltage of exit of the bridge is subtracted 2. 5V, it is divided by the value of the current of the diode 4N25 this it is the value of the resistor in series with the diode (+-15k) on the collector of the transistor takings the zero or the one .
For precausion it is necessary to put a diode antiparalelo with the diode of the 4N25 .When the interrupor this closed one is a zero in the collector.
:idea:
Hello.
Glue a photocell to a 230V operated neon bulb.
Take the 0/1 output from the photocell side fed by a 10K resistor from +5V. The other end of the photocell to common of the 5V supply. Add a capacitor in parallel to the photocell to smooth the neon pulsation due to AC.
Miguel