If you use a relay, be sure to connect a protection diode reverse biased across the relay coil, as illustrated in this diagram:
This will protect the transistor from harmful voltage surges when the relay is turned off.
If you use a relay, be sure to connect a protection diode reverse biased across the relay coil, as illustrated in this diagram:
This will protect the transistor from harmful voltage surges when the relay is turned off.