Thank you all for your help. My relay is driven by a 2N3904, whose base is connected to the PIC through a 4.7K resistor. I did use a diode (cathode to +) across the relay, and the 0.01uF cap between Vdd and ground. However, whenever the PIC output high, the serial communication between the PIC and the DS1620(thermostat chip) become unexpected. I think the noise or the magnetic field from the coil of relay might: 1. interfere the communication 2. affect to the normal working conditions of the PIC or the DS1620 Please give me some advises. Thank you. ----- Original Message ----- From: Reginald Neale <neale@SERVTECH.COM> To: <PICLIST@MITVMA.MIT.EDU> Sent: Wednesday, April 07, 1999 11:07 AM Subject: Re: Relay problem > > Whenever the 5V output from PIC is applied to relay, the microprocessor > >will run unexpectedly. If I put relay in a separated board, it's OK. I think > >the problem is the noise from the inductance of relay. Can anyone tell me > >how to eliminate this problem? Thank you. > > Hi Peter. I'll try not to avoid the dyslexia that plagued me > Sunday when I tried to help someone else with a similar problem. > :-( > > If you could find a relay that would operate on 20mA of current, > you could theoretically drive it direct from the PIC, but it > would still be a bad idea. > > Don't drive the relay directly. Drive the base of a switching > transistor thru a series resistor. For a typical low voltage > relay, use a 2N2222 and put the relay in the collector circuit. > Use a 470 ohm resistor to drive the base. In parallel with > the relay coil, place a general-purpose diode with the CATHODE > toward the (+) supply voltage. > > It's a good idea to return the (-) side of the relay supply > directly to the transistor emitter, which should also be > logic ground. > > Make sure that MCLR is asserted high and that your supply will > deliver the current your circuit is demanding from it. > > If that doesn't stop the resets, email me directly and I'll > try to help you further. > > Reg Neale > ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download.html