Controlling a relay with a transistor switch