I'm trying to make a circuit that will allow me to switch on a relay that will turn on an LED. However, the relay is rated for 12 V, and I only have an input of 5 V, so I'm using an NPN transistor (data sheetNPN transistor). to switch the power to the relay on and off. Here's the circuit diagram.schematic:
However, I'm confused about a few things (Note the ground for both the 12 V power supply and the 5 V power supply are unspecified):
If my 5 V power supply is an arduinoArduino, can I use the ground for that for the ground of the 12 V power supply?
Is it okay for the base and the emitter to have different grounds on the transistor? Or do they have to be the same?
If my 12 V power supply is 8 AA batteries (not sustainable, but I'm just using it for testing), how would I connect that to the same ground as the arduino, instead of the negative side of the batteries?
How can I figure out what the R1 and R2 should be, based on the transistor? I read some things online, but am still confused.
Are there any other things that I'm not taking into account that I should be?
I'm completely new to this, so any help is much appreciated.