Pages

Transistors and Computer Science 22 March, 2013

It feels like there are a multitude of developers who talk about Arduino, Raspberry pi, and computer hardware in general. This being said, I haven't observed many that add this type of knowledge to their arsenal. Over the last year, I caught myself doing the same thing, so I finally took the plunge.

Understanding topics like Ohm's law and current are necessary to get into any detail. If you're a hobbyist, Maker Shed has a great intro. But for a developer looking for the executive summary, the transistor is a good place to start. Not only is the transistor something your dev box is based on, but it has the fascinating application of being able to represent boolean logic in hardware. This lays the foundation for all those truth tables you did in your Computer Architecture/Systems classes.

Here's an example.
Inputs: A, B
Output: C

Here's a truth table for C = f(A, B):
ABC
000
010
100
111

A boolean expression that calculates A and B based on this truth table would be:
A AND B, also commonly written as A∧B or A && B.
If both A and B are 0, or either A or B are 0, C equals 0.
C is only 1 if both A and B are 1.

Here's where transistors come into play. Basic Bipolar Junction Transistors take two inputs, and have a single output. They are perfect for creating AND, OR, NOT, XOR, NAND, and NOR operations. Transistors may need to be chained together while acting as a series of cascading switches to get such benefits, but they can do it.

Once we chain enough of these logic gates together, we can do more complicated computations.


Here's a transistor schematic symbol:
Here's a schematic for an AND gate using two transistors:

Simple, yet interesting.