Separate out Grounds fom eachother

Great idea! I removed the optocoupler and am now using a transistor with a VCE rating of 40V. I also added a TVS diode with a clamping voltage of 40V across the collector and emitter to protect the NPN transistor from any voltage spikes caused by the coil. Thank you so much for giving your valuable time ! @jim-p