Skip to content Skip to sidebar Skip to footer

Widget HTML #1

How to make a transistor as a switch and its calculations

Transistor as a switch

Transistor as a switch and its calculations - When we use a microcontroller in sharing our projects, sometimes we need a large current to control a device. 

Microcontrollers are generally only capable of outputting a maximum digital pin current of 40mA. This means that if you want to turn on a Brightness LED or Relay that requires a current above 40 mA, then you have to use a driver.
 
Some components that can be used as drivers are BJT transistors, Mosfet, SCR and others.
 
The advantages of BJT transistors are that they are small and cheap. The disadvantage is that they are current driven, not voltage driven like MOSFETs, and are generally more suitable for low power applications, such as driving multiple LEDs, small motors or relays. 
<div style="text-align: justify;"> <h1 style="text-align: left;"><span style="text-align: justify;"><strong><strong>Transistor as a switch</strong></strong></span></h1> <p style="text-align: left;"><span style="text-align: justify;"><strong>Transistor as a switch and its calculations</strong></span><strong>&nbsp;- </strong>When we use a microcontroller in sharing our projects, sometimes we need a large current to control a device.</p> <div style="text-align: left;">&nbsp;</div> <div style="text-align: left;">Microcontrollers are generally only capable of outputting a maximum digital pin current of 40mA. This means that if you want to turn on a Brightness LED or Relay that requires a current above 40 mA, then you have to use a driver.</div> <div style="text-align: left;">&nbsp;</div> <div style="text-align: left;">Some components that can be used as drivers are BJT transistors, Mosfet, SCR and others.</div> <div style="text-align: left;">&nbsp;</div> <div style="text-align: left;">The advantages of BJT transistors are that they are small and cheap. The disadvantage is that they are current driven, not voltage driven like MOSFETs, and are generally more suitable for low power applications, such as driving multiple LEDs, small motors or relays.</div> </div> <p>&nbsp;</p> <table class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;" cellspacing="0" cellpadding="0" align="center"> <tbody> <tr> <td style="text-align: center;"><span style="margin-left: auto; margin-right: auto;"><img title="Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya" src="https://1.bp.blogspot.com/-zw4B5MYaPFc/XcNpbnyoUOI/AAAAAAAAAaI/7T_o2e1ZTREde8jTsMZ83JTm8Cu6mnYUwCLcBGAsYHQ/s16000/RELAY.PNG" alt="Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya" border="0" data-original-height="392" data-original-width="895" /></span></td> </tr> <tr> <td class="tr-caption" style="text-align: center;">Figure 1. LED Driver (left) and Driver Relay (right) using transistors</td> </tr> </tbody> </table> <p>&nbsp;</p> <div>A good first step to creating a driver is to do calculations. Two important calculations here are getting the values of the two resistors RB (Base resistor) and RL (Load resistor).</div> <div>&nbsp;</div> <div>Some loads (such as a motor or relay as shown in the image above-right) will not need a load resistor as they already have their own resistance (based on the datasheet), but they may require a fly-back diode.</div> <div>&nbsp;</div> <div>Fly-Back diode is a diode that is used to prevent reverse EMF which can damage Mosfets or resistors.</div> <div style="text-align: justify;">&nbsp;</div> <div style="text-align: justify;"> <h2>What does EMF mean?</h2> <br /> <div>EMF or Electromotive force, in Indonesian is called GGL or Electric Motion Force. In simple terms, we can say that EMF is a magnetic field that produces electricity.</div> <div>&nbsp;</div> <div>Mains, if given an electric current, then some of the electric current will turn into a magnetic field. When the current is stopped flowing into the inductor, the magnetic field quickly returns to electric current.</div> <div>&nbsp;</div> <div>If this happens, current will flow into the circuit. If this condition occurs in the relay, this current will flow quickly and "hit" the transistor.</div> <div>&nbsp;</div> <div>To be able to prevent this impact, the current is flowed back to the inductor using a diode.</div> <div>&nbsp;</div> <div>For non-inductive loads (eg LED) this diode is not required. Fly-Back diodes must have fast switching (eg 1N4001) or Schottky.</div> </div> <div style="text-align: justify;">&nbsp;</div> <h2 style="text-align: left;">A. Calculation of load resistors (RL) or load resistors</h2> <div style="text-align: justify;"> <div>Let's assume that we want to drive an LED with 20 mA with a 5VDC power supply, and we determine that the LED has a forward voltage drop of 1.7V (from the datasheet, or by measurement).</div> <div>&nbsp;</div> <div>We can see from the data sheet for the transistor (2N2222 as a current example) that the Collector - Emitter Saturation Voltage V CE (sat) is approximately 0.4V with a load of 15 mA.</div> </div> <div style="text-align: justify;">&nbsp;</div> <table class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;" cellspacing="0" cellpadding="0" align="center"> <tbody> <tr> <td style="text-align: center;"><span style="margin-left: auto; margin-right: auto;"><img title="Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya" src="https://1.bp.blogspot.com/-J4T_K-ddgqc/XcNzrxQz0rI/AAAAAAAAAaU/1x6lYVBxJ3YmLY7Ds2rTTti7br9ZeHi_ACLcBGAsYHQ/s1600/Saturasi.PNG" alt="Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya" border="0" data-original-height="577" data-original-width="1144" /></span></td> </tr> <tr> <td class="tr-caption" style="text-align: center;">Figure 2.2N2222 Transistor Saturation Datasheet</td> </tr> </tbody> </table> <p><br /> Thus the voltage drop across the resistor is:</p> <div style="text-align: center;">&nbsp;</div> <div style="text-align: center;">V = 5 - 1.7 - 0.4 = 2.9 V</div> <p><br /> And since we want 20 mA to flow, we can use Ohm's Law to calculate RL:<br /> </p> <div style="text-align: center;">RL = 2.9 / 0.020 = 145 ohms</div> <p>&nbsp;</p> <div>On the market (to my knowledge) there are no resistor values for 145 ohms, so we will use a standard value of 150 ohms for RL.</div> <div>&nbsp;</div> <div>The power dissipated by this resistor is using the formula = I ^ 2 * R, which will be:</div> <p><br /> </p> <div style="text-align: center;">PL = 0.020^2 * 150 = 0.060 (60 mW)</div> <p><br /> <br /> So a 1/8 watt resistor will fine.<br /> </p> <h2 style="text-align: left;">B. Base Resistor Calculation (RB)</h2> <div style="text-align: justify;"> <div>We want to fully power the transistor, a sufficiently large amount of current is required. The data sheet quotes "Collector - Emitter Saturation Voltage" as one when IC is 150 mA and IB is 15 mA (Figure 2), so we can conclude that (at current levels) the transistor will only get a gain of 10 that is, 150/15 when saturated, then we will need a current of 2 mA to flow through the Base to the Emitter (i.e., 20mA / 10).</div> <div>&nbsp;</div> <div>The data sheet says that, Base - Emitter Saturation Voltage VBE (sat) is around 1.3V with a load of 15 mA, so the voltage drop across the resistor is:</div> </div> <p><br /> </p> <div style="text-align: center;"><strong> V = 5 - 1.3 = 3.7 V</strong></div> <p><br /> </p> <div style="text-align: justify;">Since we want 2 mA to flow, we can use Ohm's Law to calculate RB:</div> <p><br /> </p> <div style="text-align: center;"><strong> RB = 3.7 / 0.002 = 1850 ohms&nbsp; &nbsp;</strong></div> <p><br /> </p> <div>On the market (to my knowledge) there are no resistor values for 1850 ohms but we can use the 2K resistor value approach.</div> <div>&nbsp;</div> <div>The power dissipated by this resistor is I ^ 2 * R, which will be:</div> <p><br /> </p> <div style="text-align: center;"><strong> PB = 0.002^2 * 2000 = 0.008 (8 mW)</strong></div> <p><br /> <br /> So a 1/8 watt resistor would be fine here too.<br /> </p> <h3>C. Transistor Power Dissipation Calculations</h3> <p><br /> Next we need to calculate the power dissipated by the transistor which will be the sum of the base-emitter power and collector-emitter power.<br /> </p> <div style="text-align: center;"><strong>Power = (VBE(sat) * IBE) + (VCE(sat) * ICE)</strong></div> <p><br /> VBE(sat) = 1.3V&nbsp; (datasheet)<br /> IBE = 0.002 (2 mA)<br /> VCE(sat) = 0.4V (datasheet)<br /> ICE = 0.020 (20 m)<br /> R&Oslash;JA = 200 &deg;C/W (datasheet)<br /> </p> <div style="text-align: center;"><strong>Power =&nbsp; (1.3 * 0.002) + (0.4 * 0.020) = 0.0106 (10.6 mW)</strong></div> <div style="text-align: center;"><strong>&nbsp;</strong></div> <div style="text-align: center;"><strong>Heat gain =&nbsp; 0.0106 * 200 = 2.12 &deg;C</strong></div> <p>&nbsp;</p> <div style="text-align: justify;"> <div>The net result here is that we are using 2 mA from the Arduino output pin to control the 20 mA LED.</div> <div>&nbsp;</div> <div>Now, an Arduino can drive 20 mA directly, but the above should allow you to calculate resistors for other loads.</div> </div> Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya
Figure 1. LED Driver (left) and Driver Relay (right) using transistors
  
A good first step to creating a driver is to do calculations. Two important calculations here are getting the values of the two resistors RB (Base resistor) and RL (Load resistor).
 
Some loads (such as a motor or relay as shown in the image above-right) will not need a load resistor as they already have their own resistance (based on the datasheet), but they may require a fly-back diode.
 
Fly-Back diode is a diode that is used to prevent reverse EMF which can damage Mosfets or resistors.
 

What does EMF mean?


EMF or Electromotive force, in Indonesian is called GGL or Electric Motion Force. In simple terms, we can say that EMF is a magnetic field that produces electricity.
 
Mains, if given an electric current, then some of the electric current will turn into a magnetic field. When the current is stopped flowing into the inductor, the magnetic field quickly returns to electric current.
 
If this happens, current will flow into the circuit. If this condition occurs in the relay, this current will flow quickly and "hit" the transistor.
 
To be able to prevent this impact, the current is flowed back to the inductor using a diode.
 
For non-inductive loads (eg LED) this diode is not required. Fly-Back diodes must have fast switching (eg 1N4001) or Schottky.
 

A. Calculation of load resistors (RL) or load resistors

Let's assume that we want to drive an LED with 20 mA with a 5VDC power supply, and we determine that the LED has a forward voltage drop of 1.7V (from the datasheet, or by measurement).
 
We can see from the data sheet for the transistor (2N2222 as a current example) that the Collector - Emitter Saturation Voltage V CE (sat) is approximately 0.4V with a load of 15 mA.
 
Cara Menggunakan Transistor Sebagai Saklar Dan Perhitungannya
Figure 2.2N2222 Transistor Saturation Datasheet


Thus the voltage drop across the resistor is:

 
V = 5 - 1.7 - 0.4 = 2.9 V


And since we want 20 mA to flow, we can use Ohm's Law to calculate RL:

RL = 2.9 / 0.020 = 145 ohms

 

On the market (to my knowledge) there are no resistor values for 145 ohms, so we will use a standard value of 150 ohms for RL.
 
The power dissipated by this resistor is using the formula = I ^ 2 * R, which will be:


PL = 0.020^2 * 150 = 0.060 (60 mW)



So a 1/8 watt resistor will fine.

B. Base Resistor Calculation (RB)

We want to fully power the transistor, a sufficiently large amount of current is required. The data sheet quotes "Collector - Emitter Saturation Voltage" as one when IC is 150 mA and IB is 15 mA (Figure 2), so we can conclude that (at current levels) the transistor will only get a gain of 10 that is, 150/15 when saturated, then we will need a current of 2 mA to flow through the Base to the Emitter (i.e., 20mA / 10).
 
The data sheet says that, Base - Emitter Saturation Voltage VBE (sat) is around 1.3V with a load of 15 mA, so the voltage drop across the resistor is:


V = 5 - 1.3 = 3.7 V


Since we want 2 mA to flow, we can use Ohm's Law to calculate RB:


RB = 3.7 / 0.002 = 1850 ohms   


On the market (to my knowledge) there are no resistor values for 1850 ohms but we can use the 2K resistor value approach.
 
The power dissipated by this resistor is I ^ 2 * R, which will be:


PB = 0.002^2 * 2000 = 0.008 (8 mW)



So a 1/8 watt resistor would be fine here too.

C. Transistor Power Dissipation Calculations


Next we need to calculate the power dissipated by the transistor which will be the sum of the base-emitter power and collector-emitter power.

Power = (VBE(sat) * IBE) + (VCE(sat) * ICE)


VBE(sat) = 1.3V  (datasheet)
IBE = 0.002 (2 mA)
VCE(sat) = 0.4V (datasheet)
ICE = 0.020 (20 m)
RØJA = 200 °C/W (datasheet)

Power =  (1.3 * 0.002) + (0.4 * 0.020) = 0.0106 (10.6 mW)
 
Heat gain =  0.0106 * 200 = 2.12 °C

 

The net result here is that we are using 2 mA from the Arduino output pin to control the 20 mA LED.
 
Now, an Arduino can drive 20 mA directly, but the above should allow you to calculate resistors for other loads.

Post a Comment for "How to make a transistor as a switch and its calculations"