I am attempting to build a computer from prime principles. Am I crazy? Probably. But I have a plan.

I have a plan

Let's start from the beginning

Why, oh why?

Because not knowing how stuff works bugs me to no end. It's not enough for me to use a programming language. In the past I dabbled and spent more than a little time playing with lower level stuff like assembly. I also spent considerable time thinking architecturally about systems -- in fact I have been a senior software architect (whatever that means, lol). This is to say: I try not to be monodimensional and I like to approach systems from different angles, I like taking a look from orbit and zooming in with a microscope -- and all the views in between.

My knowledge has gaps when going from the transistor to the computer. I know the parts and how to assemble a computer, but not how, for example, to build a CPU or memory chip. I want to find out! I have come across two things that tipped me over the edge and got me started

  • I subscribed to the "From NAND to Tetris" on Coursera and bought the relative book. While the course is very nice, it focuses on understanding the theory behind how a computer is built. It's not about building the hardware.
  • My birthday came about and I bought myself an Arduino kit, which comes with breadboard and components which in turn gave me the tools to get started (almost).

The reason why I want to build a computer is that doing something in practice is way more interesting that studying how it should be done.

The evil plan

I am not deranged enough (yet...) to literally build a computer transistor by transistor. Would you spend years soldering together memory banks bit by bit? It makes no sense. What I plan to do is cheat by removing the tedious parts and leaving the fun ones. I will do so by "scaling". If I built something, say, an adder, I'll let myself buy premade adders like a TI-7483. So as long as what I'm avoiding to do is a repetition of what I've done, I'm fine.

I am not sure if this makes all the step necessary feasible, if not, I'll cheat more, because YOLO. I will take basic electrical components for granted, too -- I know how transistors, resistors, caps, LEDs, etc. work from my physics labs days.

In detail, here's what the current journey plan looks like:

  1. Physics: valves, transistors, caps, LEDs and other basic things. (I am skipping this)
  2. NAND gate. They tell me everything can be built with these.
  3. Basic gates (AND, OR, NOT, XOR)
  4. Adders
  5. ALU
  6. Memory and registers
  7. CPU
  8. Bare bones computer, machine code

I don't know if I'll be able to go to all the way to point 8. Stuff gets harder as we go down the list. On top of that, there are BIOSes, OSes, compilers, etc. Also there's a factor of costs involved to consider. We shall see.

Building a NAND gate

NAND gates are interesting because they are easy to build and you can use them to build every other kind of gate. I think it's a good starting point to build a computer!

I've taken the circuit from hyperphysics and modified it to suit my needs. Here's what I came up with:

nand circuit

Which should look like this once on the breadboard:

nand breadboard

I expect the led to be ON if no buttons are pressed, or if only one button is pressed, and OFF is both buttons are pressed.

I am using a Sunfounder Arduino UNO clone to power this circuit. All schematics made with fritzing.

Result

Success! The circuit behaves as expected. It even ran on the first attempt! Here's a pic of the running circuit, attached to my Arduino as power source.

running nand gate

For someone as fat fingered as I am, with no experience in electronics, this was a lot of fun! I can't wait to take the next step!

(discuss on hacker news)


A software engineer & Stack Overflow alumnus in London. I write about software development, coding, architecture and team leadership. I also speak at conferences worldwide.

About me

Follow me on Twitter

Gleanings

How Aristotle Created the Computer
Chris Dixon • Mar 20, 2017

What began, in Boole’s words, with an investigation “concerning the nature and constitution of the human mind,” could result in the creation of new minds—artificial minds—that might someday match or even exceed our own.

Read more…