I have faced this problem many times that I connects Relay with pic microcontroller and whenever I put Load on Relay's Contacts PIC16f877a resets. I some time solve this problem by triggering another relay from basic relay attached to PIC. But this is not a solution. Can any one describes Why pic is affected with this relay spark. And what is really happening which causes pic to reset. Following things I have kept in mind while building circuit
- I have 1K Pullup resistor on pin 1 (Reset pin) of Pic 16f877a
- Fuses are, Power up timer = enable, Brown out detect = enable, LVP= disable, CP=enable
- Power supply is filtered, ceramic capacitor of value .1uf connect across both ends of regulator
- Crystal is 4MHz, and 33pf capacitor across crystal are close to (Circuit works fine, problem of reset occurs only when relay turns on with Load connected)
- Relay is used of 12v/5amp ratings
- C945 NPN Transistor is used to drive the relay
- Reverse biase 1N4148 diode is connected across relay coil to save reverse leakeage
I never faces such problem in Atmel 89c51 microcontroller with same relay interfacing circuit. It is PIC who goes reset every time. But if do not connect any load to relay the circuit works fine. No reset occurs.
Can any-one describes what is the issue with PIC?
Here is schematic, Crystal is attached as mentioned above