Foundation of Computers

Computers can seem massively complicated, and they are.  However, the foundation of computers is fairly simple to understand, and even for you to recreate yourself at home.  If you can get your head around the fact that computers just contain lots and lots of simple things, shrunk down to a microscopic scale, and connected together, then the technology of computers can be much less intimidating.

Computers from Switches

The fundamental component in a modern digital computer is the switch.  Just like most other switches that you’ll have come across, their purpose is to turn the flow of electricity on and off.  The main difference is that where you might be used to a switch turning on a light, in a computer the switch might turn on another switch, which might turn on another switch, and so on.  A clever arrangement of switches, along with other elements, can add up to the complexity of a computer.

It’s an idea that can be very difficult to believe; but that will change once you have made some for yourself.


The switches found in computer processors are far too small for you to mess around with.  However, the electronic switch that is both easy to handle and relatively cheap is the transistor.  Transistors can also be used for other things, but we’ll skip over those for now.

A transistor

A transistor

A transistor has three “legs”.  Electricity comes in one leg, and tries to go out of the one on the opposite side.  The leg in the middle is how you turn the switch on and off – apply a small electrical current and the switch will turn on; cut the supply to the middle leg and the switch will turn off.

Equipment You’ll Need

If you want to try things for yourself, then you’ll need to buy some components.  If you use the “breadboard” listed below, then you can re-use the same ones over and over.

  • Breadboard: This is where you arrange your components.  They can be pushed into the holes, and later removed and reused.
  • 2N2222 Transistor: These are a particular type of transistor that is ideal for use as a switch.  There are others that could work equally well (some equivalents are listed here), but none that I’ve tested.  You’ll need at least 2.
  • LED: A Light Emitting Diode can be thought of as a small, low-powered bulb.  The ‘diode’ part means electricity can only flow in one direction – so if it looks like it isn’t working, then try flipping it the other way.
  • Resistors: These reduce the flow of electricity (technically current) in a circuit; and in our case are used mainly to protect vulnerable components like the transistors and LEDs.  You can tell them apart by the coloured bands, and the examples below use 4.7k (yellow, purple, red bands) and 10k (brown, black, orange bands) resistors.
  • Wires: Although parts of the breadboard are connected together on the back, you’ll still need some wires.  Any wire that will poke into the breadboard and be a snug fit will do, but there are specific jumper wires that you can get.
  • 6V Battery Holder (4 x AA): A plastic box to power your project.  You’ll also need the batteries.
  • Optional Switches: In the examples below I used some small push-to-make switches to trigger the transistors, but you could just connect and disconnect wires to achieve the same thing.

You can visit a nearby shop, perform a web-search, or try online retailers like oomlout, or Farnell.


Your First Transistor Switch

We’ll start with the most basic circuit – turning an LED on and off using a transistor.  The setup is shown below.  The red and black wires at the top are where you connect the battery.  You should be able to turn the LED on and off by controlling the flow of electricity to the middle leg of the transistor (via the diagonal green wire).

Breadboard layout for simple transistor switch.

Breadboard layout for simple transistor switch.

Remember that the LED needs to be put in the correct way.  The long leg (if there is one) should be on the left, and the flat edge (if there is one) should be on the right.  Also note where the flat edge of the transistor is.  In each vertical (numbered) set of holes, a to f are connected, and g to l are connected.  That’s how the red wire is connected to the blue and green ones.

Of course at this point you are the one connecting or disconnecting the flow of electricity to the middle leg.  However, keep bearing in mind that inside the computer the electricity could have come from another switch.

Logic Gates

Now that we have a switch, we can start combining them together to create ‘logic gates’.  These are just slightly more complicated switches, and the easiest two logic gates to grasp are the AND gate, and the OR gate.  Unlike a single transistor that turns on and off based on the supply of electricity to its middle leg, the AND and OR gates both respond to two inputs.  The AND gate will only output electricity if it receives electricity to both of its inputs.  The OR gate will output electricity if it receives electricity to either of its inputs.

You probably won’t be surprised to find that these use two transistors (one for each input).  The different behaviour all comes from how the switches are connected – in a row or side-by-side. In the animation below, note that the AND gate (left) only passes on a signal if both switches are pressed, while the OR gate (right) passes on a signal if either switch is pressed.

Animation showing the equivalent of an AND gate (left) and an OR gate (left)

Animation showing the equivalent of an AND gate (left) and an OR gate (right)

Now remember that we are using transistors as switches.  The finger pressing the switch above is equivalent to supplying power to the middle leg of the transistor.  Circuit diagrams are available on this site, but the breadboard layouts are included below.

And gate Breadboard layout

AND gate Breadboard layout

Or gate Breadboard layout

OR gate Breadboard layout


Another type of basic gate is the NOT gate, which only takes a single input.  It’s effect is simple enough to understand – you get out the opposite of what you put in.  Put in a signal, and nothing comes out.  Cut off the supply, and a signal comes out.  The way that it is constructed is slightly different, and is shown below.

Not gate Breadboard arrangement

NOT gate Breadboard layout

Soldering Circuits

By their nature, your arrangements on the breadboards are only temporary.  If you want to make something more permanent, then your next step should be to solder the components onto stripboard.  There are several different types, but it is possible to get some that matches the connection types of the breadboard:

Stripboard with similar connections to a breadboard.

Stripboard with similar connections to a breadboard.

Soldering is a technique that requires a fair amount of skill and practice.  You will get much better results if you watch some YouTube videos on the subject, and do some test soldering first.  The image below shows an AND gate arrangement fixed in place:

AND gate soldered onto stripboard.

AND gate soldered onto stripboard.


What next?

We’re still a long way from modern computers, but we’ve taken some significant steps towards them.  The Waiting For Friday site shows how you can take the things learnt above, and use them to build a computer capable of adding two numbers between 1 and 8.  Again, that might not sound too impressive, but with two identical circuits connected you could look at adding two numbers between 1 and 255.  With four identical circuits you could add numbers between 1 and 65,536.

That is the fundamental nature of computers.  Transistors can be used to build simple logic gates.  Simple logic gates can be used to build more complicated logic gates, such as the XOR.  Logic gates can be used to build half-adders, which when doubled create full adders.  Through these small increments in complexity, and repetition on a massive scale, the complexity of a computer can be achieved.

Comments are closed.