NPN Transistor Switching 12V - grounds with different potential
You must connect the transistor's emitter to the ground (negative end) of the 12V supply. If you cannot connect the switching signal source directly to the emitter then you probably want to use an optoisolator to drive the transistor's base.