Post

Layer 0 - Transistors 🔌

The concepts in here are definitely a step up from the basics of electrodynamics, especially when we get to pMOS and nMOS transistors, which I am still sort of struggling with, but once again, I do understand the concepts well enough given the layer 0 concepts that they are (I’m not trying to be an electrical engineer!). All of this stuff is super interesting and I’ve really been considering buying one of those circuit kits and build my own little latches and simple memory systems - something I might showcase in a future post. Anyways, on to the theory.

Semi-conductors

Alright, so the Veritasium video for transistors is really good, but I ended up watching a lot of videos and taking a lot of notes to understanding what was going on. Basically, the transistors that comprise our computers and devices today are made of a material called Silicon, which is in between being really good at conducting electricity, and really bad at it. But, by adding in small amounts of other chemicals, like phosphorus or boron, we can physically manipulate how conductive silicon is, and this is super useful. This process is called doping such that when we add a chemical that allows negative current to flow (like phosphorus which has 5 rather than 4 electrons in its valence shell), we call this n-type doping. When we add an element like boron into the lattice, which has 3 rather than 4 electrons in its valence shell, we call this p-type doping because the lack of an electron in the lattice creates a hole where an electron could be, making it a positive charge that is carried. It’s important to note that the material is still neutrally charged because the number electrons equals the number of protons, but, the charge that the material can carry has changed.

This property of silicon is crucial since we can block and allow the flow of charge by manipulating it, just like with a switch.

Diodes

Diodes are the next conceptual progression after learning about semi-conductors, specifically silicon and the different forms of doping. A diode is composed of both n-type and p-type material, as can be seen in the following visual:

Diode structure/cross section

By placing the p-type and n-type material side by side, the excess electrons in the n-type migrate to fill the positive holes in the p-type, and vice versa. However, the charges from either side are not able to move any further because they are blocked by the same-parity of charges on the other side - this creates what is shown in the diagram as a depletion layer - the electrons can’t move because there are electrons on the other side blocking their flow. Because of this, diodes work to prevent the flow of electrons when they are in a “resting” state, i.e. when there is no voltage applied across both ends. A reminder that voltage is potential difference, and a potential difference is created when there is a difference in charge density in one part of the circuit as opposed to another, like a wave having more water than the beach its about to crash into. Sticking with this analogy, the wave (or build up of electrons and charge) moves from a high point to a low point in order to reach electrostatic equilibrium, or in other words, to make everything balanced again.

The cool thing about even a simple diode above is that if we apply a voltage in the right way, we can push the electrons with enough force to allow a current to flow, but if we reverse the voltage direction, then the exact opposite will occur. In this situation, when we place a battery with the negative side connected to the n-type end, you can imagine that electrons are generated from this batteries end, which pushes the electons and carries the charge. This pushing effect allows the electrons in the depletion layer to push further into the p-type layer as the electrons behind are forced forward. This leads to a flywheel effect called forward biasing where current is able to flow because electrons are being pushed and pulled in the direction of the p-type material, overcoming the depletion layers lock. The opposite occurs when the voltage is high at the p-type end. In this situation, the positive holes of the p-type material are attracted back towards this negative charge, and on the other end of the voltage, the negative electrons in the n-type are attracted to the positive terminal. This pulls the negative and positive charges completely away from another, to opposite ends of the diode, and further prevent the flow of current.

Bipolar Junction Transistor (BJT)

Using this idea of diodes and forward/reverse biasing, we can create a BJT transistor. A BJT transistor comes in 2 varieties:

Types of BJT's

These are the NPN and PNP BJT’s. Honestly, its a little confusing, especially when we start considering the different types of current, direction of voltages, how each p-n junction is supposed to be separately biased and how we also need 2 separate sources of voltage being applied. It’ll take a while for me to explain it so I am just going to try and be concise with my explanation, even if it might not be super precise. Basically, for an NPN BJT, we have 3 parts: the emitter, the base and the collector. I’m going to work with electron flow because screw conventional flow. The emitter is heavily doped, so lots of free electrons, the p-type material is very thin and only slightly doped, so a small amount of positive holes that get filled up to create the depletion layer. The collector is moderately doped so also a lot of free electrons. Now, when a current is passed from the base it causes the a forward bias for the electrons in the emitter to pass into the base wire and also the base material. In the collector, a reverse bias is induced because the p-n junction is facing the opposite direction, but together, both parts of the BJT work together to push negative charge from the emitter, across the base and through to the collector. Now, the PNP works in the exact opposite direction. A current is still passed into the base, but instead of negative charges, positive charges instead move from the emitter to the collector, or if we want to talk about electron flow, negative charges move from the collector to the emitter, and so often, the PNP BJT transistors are flipped when they are used.

Capacitors

I’ll quickly cover capacitors and capacitance although I’ve sort of covered it in the previous post. I see capacitance as just the build up of charge that gets locked into placed by opposing magnetic fields. Here’s a visual of a capacitor:

Capacitor structure/cross section

As you can see, because of the differing charges on each side of the capacitor, an electric field is created which locks the charges in place and allows capacitors to store charge, at least while the voltage difference is greater between the plates then another point. Note that metal conductive plates are also not connected and are separated by a dielectric, or a material that doesn’t allow current to flow from one plate to another. This is key to locking the field in place and is pivotal to understanding how different types of transistors work.

Metal-Oxide Semi-conductor Field Effect Transistors (MOSFETs)

MOSFETs are the most common type of transistor found in computers and digital devices and unlike BJT’s, they’re controlled by voltage as opposed to current. The structure of a MOSFET is different from that of a BJT; MOSFETs have a gate, drain, and source, whereas BJTs have an emitter, base, and collector. They do however look quite similar:

MOSFET diagram

This example is called an nMOS transistor - n because the wells of material for the source and drain are made of n-type doped semi-conductor. In MOSFETs, you still have p-n junctions which create depletion layers, but the passage of charge is regulated by an electric field from the gate. It works as a temporary capacitor. The gate is a conductive material, but it is separated from the p-type material beneath from an oxide layer, which operates like a dielectric and prevent conductance fo electrons, but allows the formation of an electric field.

When the gate is positively charged for an nMOS transistor, the positive holes in the p-type layer are repelled and electrons (negative charges) from the source become forward biased, creating a channel across the top layer of the p-type material and allowing electrons to flow from source to drain. When a negative charge is applied to the gate in nMOS transistors, the positive holes in the p-type material are attracted to the gate and become locked in place, prevent electron flow from source to drain. In this way, by changing the voltage applied to the gate we can regulate the flow of current from source to drain.

A similar thing happens for pMOS transistors, but obviously in the opposite direction. What you find is that nMOS transistors are really good at showing 1’s while pMOS transistors are really good at showing 0’s, so, we pair them both up into a group called a Complimentary Metal-Oxide Semi-conductor transistor where the best of both types of transistors is used.

Then, we can combine CMOS, nMOS and pMOS transistors in various ways and create the simplest of gates like OR, AND and NOR gates. These are represented in schematics, and it was good fun learning these and drawing how they would look for different configurations.


All this information was super important for me personally - I feel that I am at a point now where I can move to the next layer of abstraction and understanding. I’ve done a lot more research and written down my own personal set of extensive notes about layer 0 with physics and transistor theory - now I finally understand the absolute base layer of computer science and also electrical engineering to a certain extent. Now, I should be able to move to boolean logic and algebra and the next layer of understanding with the right backing.

This post is licensed under CC BY 4.0 by the author.