Electronics Basics – How a Transistor Works

Transistors are semiconductor devices with three terminals that can act as amplifier controls or electrically controlled switches.

  • Amplifier: when it works as an amplifier, it takes a tiny electric input current at one lead and produces a bigger output current at the other lead
  • Switch: a small electric current through a lead can switch on a bigger current flow through the other leads of the transistor

In the figure below you can see several types of transistors:



Transistors are made of silicon which is a semiconductor. A semiconductor is a material that is not a pure conductor, it has higher resistance than a conductor, but much lower resistance than insulators.


We can introduce impurities into silicon, so that it works in a specific way, this process is called doping.

If we dope the silicon with chemical elements such as phosphorous, arsenic or antimony, which have 5 valence electrons, the silicon gains free extra electrons that can carry an electric current.

When we add these elements, we are introducing electrons. As electrons are negative, this type of semiconductor is called N-Type (negative type).


On the other hand, we can dope silicon with other elements like boron or gallium. As these elements have only three outer electrons, when they are mixed into the silicon matrix, they create “holes” with absence of electrons.

So, this type of silicon has less extra free electrons, and so it is called the P-Type (positive type).

Figure adapted from hyperphysics

Water Analogy

To understand electronics basic concepts there’s nothing better than a water analogy.

Imagine a faucet in which water is flowing. The water comes from somewhere (in flow) and comes out of the faucet (out flow). The flow of water can be controlled by a control knob.

The same happens in a transistor, the current flows from one lead to another. The current that flows from one lead to another depends on a small voltage/current applied to a control lead. So, the control lead controls the electric flow through its two leads.


The two major families of transistors are bipolar junction transistors (BJTs) and field-effect transistors (FETs).

  • Bipolar junction transistors require an input or output current at their control leads
  • Field-effect transistors practically don’t require current, only voltage

Bipolar Junction Transistors (BJTs)

Bipolar junction transistors consist of a three-layer sandwich of doped semiconductor materials.  We can have two types of bipolar junction transistors: the N-P-N and the P-N-P. Each layer has a pin. On bipolar junction transistors the three pins are labeled:

  • Collector (C)
  • Base (B)
  • Emitter (E)

In the figure below you can see the symbols for NPN and PNP transistor respectively.


NPN transistor

In an NPN transistor, the current flows from the collector to the emitter. The base of an NPN transistor must be connected to the positive voltage for current to flow in.

With the increasing current to the base, the transistor is increasingly turned on until conducting the current fully from the collector to the emitter.


PNP transistor

In a PNP transistor, current flows from the emitter to the collector, for that the base must be connected to the ground.

We can say that a PNP transistor is normally off. However, when there’s a small output current and negative voltage at the base in relation to the emitter, the transistor will turn on, and a larger current will flow from the emitter to collector.

Basically, the PNP transistor will conduct current from the emitter to the collector, if the base and collector are negative in relation to the emitter.


Mini Project – Automatic LED Light

In this section, I’m going to share with you a simple transistor application.

We will use an LDR (light dependent resistor) to turn on an NPN transistor that powers an LED.

When it’s dark, the LED turns on, and when there’s light the LED turns off.

Parts Required

Here are the components that you’ll need:


You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!


Here’s the circuit diagram for this project:

LDR-transistor-1 (1)

Place all the components into the breadboard and test your circuit. Here’s the schematics:


Testing the Automatic LED

When the light turns off the LDR activates the transistor that ultimately turns the LED on. Here’s the final result:

transitor GIF

You can measure the resistance of your LDR using a multimeter with different light intensities (from dark to light), so you can see what’s going on.

You may need to adjust the value of the 47kΩ resistor to another value depending on the light intensity of your surroundings. For that, it may be more useful to replace the 47kΩ resistor with a potentiometer.

Feel free to solder all the parts of this tiny little circuit and apply it in whatever application you want.

I hope you’ve found this post and project useful.

Share this post with a friend that also likes electronics!

Thanks for reading,

-Rui Santos

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »

Enjoyed this project? Stay updated by subscribing our newsletter!

5 thoughts on “Electronics Basics – How a Transistor Works”

  1. Hi, very nice explanation and sweet little project to show how NPN transistor works. How about same-sized project for PNP transistor to show different usages of those two types.


Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.