# Relay TRS-12VDC-SB-L15 Controlled by Arduino

 Updated: 18-08-2019 Category: DIY Electronics
As it is known, the microcontroller for obvious reasons can control the electromagnetic relay only through a special driver and most often this driver is the simplest transistor switch. In this article I will calculate the transistor switch for the relay TRS-12VDC-SB-L15 (12V). For the correct choice of the transistor, it is desirable to consider the so-called strength factor equal to 1.5 (Ic = 12mA*1.5 = 18mA) and for such a load current is quite suitable transistor C1921 with a maximum collector current of 50mA which I have here are in stock.

► 1. The load of the transistor is a relay (TRS-12VDC-SB-L15) with a coil resistance of 970 ohms (Rc). Calculate the collector current of the transistor (Ic):

Ic = Vcc/Rc = 12/970 = 0.012A = 12mA (Vce(sat) => 0)

► 2. The DC current gain (β) of the transistor (C1921) is 30...300, so I take the minimum value β = 30 and calculate the base current (Ib):

Ib = S*(Ic/β) = 4*(0.012/30) = 0.0016A = 1.6mA (S = 4)

► 3. Calculating base resistor value (Rb):

Ib = Vr/Rb => Rb = Vr/Ib = (Vin-Vbe)/Ib = (5-0.7)/0.0016 = 2688Ω = 2.7kΩ

The saturation coefficient of the transistor (S) for such transistor switches is recommended to be taken within 3...5, therefore, in step 2 of my calculation I took S = 4. This ensures a sufficient level of saturation of the transistor to bring one to the open state.

 // Relay testing (blink)  int relayPin = 4;  // Pin D4void setup () {  pinMode (relayPin, OUTPUT);}void loop () {  digitalWrite (relayPin, HIGH);  delay (1000);  digitalWrite (relayPin, LOW);  delay (1000);}  // Arduino IDE 1.8.4 To test this relay module, I used a standard sketch for blinking LED through the 13th pin with a time delay of 1 second, after changing the variable name for this pin and the number of this pin. Everything is very simple here and it does not need a special detailed explanation. For visual control of the current state of the relay module (ON/OFF), I soldered parallel to the relay coil (12V) a LED with a resistor of 1 kilohm and this is not shown on the diagram (left).