I'm using PIC16f877a along with ULN2803 to switch on the solenoid valve on/off continuosly. The problem is the PIC is resetting randomly or somtimes in the starting itself when the solenoid valve is connected. its a 12VDC valve and takes about 2A. Please tell me why this is happening and can it be controlled using proper filters at MCLR PIN of PIC?
This problem is usual when working with the solenoids. The reasons may be suddenn current drop at starting solenoid will consume double the rated current. Try using seperate power supply and optocoupler to avoid resetting of PIC.