Well, the low-tech solution is two ferrite toroids. Wind around 8 turns of light-duty but mains-rated wire for the primary - this is in series with the bulb, of course, and 16 or so turns of normal hookup wire as the secondary. Assuming a 100W lightbulb you have around 0.5A per bulb flowing which gives you plenty of current in the toroid. The secondary voltage will probably be a volt or so - feed this to a comparator of some sort - IC or a couple of transistors, depending on your preferences and supply voltages etc, and there you are. Fully isolated and very cheap. Also won't blow up if the light bulb shorts out. > ---------- > From: Reginald Neale[SMTP:neale@SERVTECH.COM] > Reply To: pic microcontroller discussion list > Sent: Tuesday, December 09, 1997 3:34 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Interfacing to ac powerlines > > >Hi all! > > > >I need to do some simple interfacing to 220V powerlines. > >A PIC16C84 must monitor eight different lights to determine if they > >are switched on or not. All the switches are situated together, so if > >I could find a way to "tap" the powerlines, and feed this to the PIC, > >I don't hafta lay km's of wire to the lights themselves (this won't > >be practical anywaty). I'm a little nervous about connecting mains to > >the PIC. Also, I hafta keep the component count really low, mainly > >for budget-, and space-related reasons. > > > >Anyone have some simple suggestions that could help me? > > > >Thanx! > >Gaffs. > > It is possible to sense the voltage directly. Use a couple of > high-value > (several meg) resistors in series to a PIC input. Senses only the > positive > half-cycle, of course; the internal diode clips the negative one. > However, > there are safety issues here; doubtless you know about the potentially > fatal danger of having your logic circuitry share a common with the > power > line. One safe way is to use a special optocoupler that HP makes for > providing a logic output from a power-line input. > > Also, monitoring the switched voltage doesn't tell if you if a lamp > has > burned out. Can you steal a few milliamperes from the lamp current to > feed > the optocoupler? That would be more fail-safe. > > If the lamp current is high enough, it might be possible to use a > clamp-on > inductive sensor to sense lamp current and provide isolation at the > same > time, but that's probably a more expensive approach. > > Reg Neale >