Thanks, that's what I'm looking for. On the DC side, can I use a=20 capacitor to ground to eliminate the software filter? This will be very=20 low speed circuit where the period might be measured in many minutes. :) :) On 9/16/13 9:34 AM, Isaac Marino Bavaresco wrote: > The opto-isolator is a good idea and is what I use. > > If the speed of detection is not critical and you don't need to know the > phase or zero-crossing instant then a simple LED+Transistor opto can be > used. > > If the opto is not designed for AC it has as single LED and you will > need to connect a diode in parallel with the LED, in the opposite directi= on. > In series with the opto (or opto//diode) use a capacitor in series with > a low-value resistor (120 Ohm is good) just to limit the inrush current > in the capacitor. > > The capacitor can be calculated easily: Xc =3D 1/(w*C). w =3D Omega = =3D > 2*Pi*F > > So, if you have 120V 60Hz (USA, right?) and want an average current of > 15mA then Xc is approx. 8000 Ohm > > C =3D 1/(w*Xc) > > C =3D 1/(2*Pi*60*8000) =3D 331nF > > Use a Mylar capacitor with working voltage of 250V for 120V line voltage > and 400V for 240V line voltage. > Note: Do not use metal-film resistor, just a plain old carbon film one. > The wattage can be 1/8W. > > When on, the output will be pulsating. You can filter it with a physical > low pass filter or do it in software. > > > Best regards, > > Isaac > > > > Em 16/09/2013 09:33, Carl Denk escreveu: >> I have a home project coming down the road mainly HVAC stuff of digital >> inputs to a PIC probably a 18F??. THe inputs would be only to sense >> on/off. The voltages would be 24 VAC, 120 VAC, and 240 VAC. I'm thinking >> through an Opto isolator with a resistor and capacitor on the AC side. >> Values ? Configuration? or something else? >> >> This is a low priority at the moment, but thought I would generate some >> traffic for Bob. :) >> >> Thanks again. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .