You can use a very simple circuit with a resistor in series with the emmitting diode of an optocoupler. When the power is accross the diode resistor network, the diode will emit and forward bias the phototransistor. You can size the resistor simply with Ohms Law by knowing the diode specs from the manufacturer. If you use a darlington, the diode current will be small. You can probably size the resistor so that it will work for 120VAC or 240Vac. Good luck. Let me know how you make out. Rich ---------- > From: Luis Fernandez > To: PICLIST@MITVMA.MIT.EDU > Subject: Detecting AC power line on/off > Date: Thursday, April 23, 1998 12:00 PM > > Hi list, > > Would like to know your opinion in how to detect activity (power on) of > devices connected to mains power supply (220V 50Hz here) in order to provide > a clear input into a PIC I/O pin. > > Goals are: Isolation from power line, Reliability, Low cost and low size > > Relays with 240V AC coil are usually big because they are made to switch > heavy loads, so expensive and the coil can fail. The samallest I could find > was a 24V AC relay + resistor, but still not very reliable. > > What about using a neon lamp and some kind of optical detector > (fototransistor) and may be an RC network to integrate the pulsing light of > the neon. What kind of optodetector can be used with this arrangement ?. > Any other idea ? > > > > > Luis Fernandez Cormenzana > RadioBit Sistemas, S.L. > Sistemas de control de rondas > Patrol presence controllers > Control de patrullas y veh’culos > Patrol vehicle fleet control > http://www.dragonet.es/users/radiobit > Tel/Fax: +34-96-5856457