I've been trying to switch a solenoid valve using a relay controlled by a signal from a microcontroller. The circuit works fine when connected to a normal load like a light bulb, but some random behavior (of the digital circuitry) was observed when connecting the circuit to the (highly inductive) solenoid valve. The problem was reduced to some degree by adding a snubber circuit between the terminals to the load and increasing the decoupling capacitor for the circuit to 1000uF. Although the circuits works now (with the occasional randomness, about 1 in 100 false trigger of the relay), there is one more persistent problem. The relay contacts close with a very large noise (almost like a crack of a whip). The contacts open with no problem. The relay also switches normally with a lightbulb load. Does anyone have any idea why this is and how I can fix it?
The circuit I used is shown below.
The valve used is a 230V Danfoss solenoid valve.