The transistor is a simple component that you can use to build many interesting circuits. In this article, you will learn how transistors work so that you can use them in later circuit designs.

Once you know the basics of transistors, it’s actually quite easy. We will focus on the two most common transistors: BJT and MOSFET.

The transistor works like an electronic switch. It turns on and off current. A simple way of thinking is to think of a transistor as a switch without any action parts. A transistor is similar to a relay because you can use it to turn something on or off. Of course, transistors can also be partially turned on, which is very useful for amplifier design.

How transistors work (BJT)

Let’s start with the classic NPN transistor. It is a bipolar transistor (BJT) with three pins:

Base (b)

Collector (c)

Emitter (E)

poYBAGKXDDyACZdVAAApzw1zicw037. png

If you turn it on, electricity can flow through it from the collector to the emitter. When it is closed, no current flows.

In the following example circuit, the transistor is off. This means that no current can pass through it, so the LED is also turned off.


To turn on the transistor, the voltage between the base and emitter is about 0.7V.

If you have a 0.7V battery, you can connect it between the base and emitter, and the transistor will turn on.

Since most of us don’t have a 0.7V battery, how can we turn on the transistor?

It’s simple! The working principle of the base emitter part of a transistor is a diode. The diode has a forward voltage, which “grabs” this voltage from the available voltage. If you add a resistor in series, the rest of the voltage will be divided across the resistor.

Therefore, add a resistor and you will automatically get about 0.7V. This is the same principle that you limit the current through the led to ensure that it will not explode.

If a key switch is also added, the transistor can be controlled through the key switch to control the LED:


Select the value of the component

To select the value of components, you also need to understand the working principle of transistors:

When current flows from the base to the emitter, the transistor turns on, allowing greater current to flow from the collector to the emitter.

poYBAGKXDIeAeKniAADId5o_ 44U919.png

The magnitude of these two currents is related, which is called the transistor gain.

For general purpose transistors, such as bc547 or 2N3904, this may be around 100.

This means that if you have 0.1mA flowing from the base to the emitter, you can have 10 MA (more than 100 times) from the collector to the emitter.

What resistance value R1 do you need to get a current of 0.1mA?

If the battery is 9V and the base to emitter of the transistor reaches 0.7V, there is still 8.3V on the resistor.

You can use Ohm’s law to find the resistance value:

pYYBAGKXDJ6AcSE8AAAbdfld9-g720. png

So you need an 83 K Ω resistor. It does not mean that it must be the standard value. 82 K Ω is OK, and it is enough.

R2 can limit the current to the LED, and can select the resistance value used to connect the LED and the resistance directly to the 9V battery when there is no transistor. For example, 1K Ω should meet normal operation.

How to select transistors

NPN transistor is the most common bipolar transistor (BJT). But there is also a PNP transistor. It works the same way, except that all the currents are in the opposite direction.

When choosing a transistor, the most important thing is to remember how much current the transistor can withstand. This is called collector current (IC).

Operating principle of MOSFET transistor

MOSFET transistors are another very common type of transistor. It also has three pins:





MOSFET symbol (n-channel)

The working principle of MOSFET is similar to that of BJT transistor, but there is one important difference:

For BJT transistors, current flows from base to emitter, which determines how much current can flow from collector to emitter.

For MOSFET transistors, the current between the voltage gate and the source determines how much current can flow from the drain to the other source.

Example: how to turn on a MOSFET

The following is an example of a circuit that turns on the MOSFET.

poYBAGKXDMKAFCXvAAB2aihjvww589. png

How MOSFET transistors work

To turn on a MOSFET transistor, you need a voltage between the gate and source that is higher than the threshold voltage of the transistor. For example, bs170 has a gate source threshold voltage of 2.1V. (noted in Datasheet)

The threshold voltage of the MOSFET is actually the voltage at which it turns off. Therefore, to turn on the transistor correctly, you need a slightly higher voltage.

How high the voltage is depends on how much current you want to pass (it will be noted in the datasheet). If you are a few volts above the threshold, it is usually enough for low current things, such as turning on an LED.

Please note that even if you use a high enough voltage to pass 1A current, it does not mean that you will get 1a. It only means that you want 1a to pass through, and the actual circuit connection characteristics determine the actual current.

Therefore, you can go to the current you want, as long as you ensure that you do not exceed the maximum grid source voltage limit (bs170 is 20V).

In the example above, when you press the button, the gate is connected to 9V, which turns on the transistor.

Select the value of the component

The value of R1 is not important, but about 10K Ω should work normally. Its purpose is to turn off the MOSFET.

R2 is used to set the brightness of the LED. For most LEDs, 1K Ω should work well.

Q1 can be almost any n-channel MOSFET, such as bs170.

How do I turn off the MOSFET?

An important feature of MOSFET is that it also acts like a capacitor. That is, the grid and source part. When you apply a voltage between the grid and source, the voltage will remain until the discharge.

poYBAGKXDNCAZ_ H9AACbWs2j9Vw145. png

Without the resistor (R1) in the above example, the transistor would not turn off. With the resistor R1, the gate source capacitor has a closed-loop discharge circuit, which turns off the transistor again.

How to select MOSFET transistors

The above example uses the n-channel MOSFET and the p-channel MOSFET in the same way, except that the current flows in the opposite direction, and the grid to supply voltage must be negative to open it.

There are thousands of different MOSFETs to choose from. But if you want to build the above example circuit and want a specific proposal, BS 170 and IRF 510 are two very common ones.

There are two things to remember when selecting MOSFET:

This gate source threshold voltage. You need a higher voltage to turn on the transistor.

This continuous leakage current. This is the maximum current flowing through the transistor.

There are other important parameters to remember, depending on what you are doing. But this is beyond the scope of this article. With these two parameters in mind, you have a good start.

MOSFET gate current

If you want to control a MOSFET, such as MCU, Arduino or raspberry PI, there is another thing you need to remember: when you turn on the transistor, the current flowing into the gate.

As mentioned earlier, the gate to source MOSFET acts as a capacitor, which means that once charged, no more current will flow. Therefore, when the MOSFET is turned on, no current flows through the gate.

But when the MOSFET is turned on, there is a current, just like when you charge a capacitor. In a very short time, there may be a large amount of current flow.

To protect your microcontroller or Arduino (or anything you are using) from excessive current, you need to add a MOSFET gate resistor:


For this, 1000 Ω is usually a good value. Use Ohm’s law in conjunction with your specific situation.

Why do you need transistors?

A common question is, why do we need transistors? Why not connect the LED and resistor directly to the battery?

The advantage of a transistor is that you can control a larger current and voltage with a smaller current or voltage.

This is super useful if you want to control things such as motors, high-power LEDs, speakers, relays, and more from a raspberry pi/arduino/ microcontroller. The output pins from these boards usually only provide a few milliamps at 5V. Therefore, if you want to control your 110 V room exposed table lamp, you cannot supply power directly from the pin.

Instead, you can use the relay. However, even relays usually require more current than pins can provide. So you need a transistor to control the relay:


Connect the left side of the resistor to the output pin (starting from Arduino) to control the relay.

But transistors are also useful for simpler sensor circuits, such as this optical sensor circuit, touch sensor circuit, or H-bridge circuit.

We use transistors in almost all circuits. It is indeed the most important component in electronics.

Transistor as amplifier

Transistors are also what makes the amplifier work. It is not only two states (on / off), it can also be anywhere between “fully open” and “fully closed”.

This means that a small signal with little energy can control the transistor and produce a stronger signal at the collector emitter (or drain source) of the transistor. Therefore, the transistor can amplify large and small signals.

Here is a simple amplifier to drive the speakers. The higher the input voltage, the higher the current from the base to the emitter, and the higher the current through the speaker.


Different input voltages change the current in the speaker, resulting in the level of sound.

Leave a Reply

Your email address will not be published. Required fields are marked *