>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