Building a computer in the silliest way possible

This story goes far beyond toy cars

--

All computers work on the same basic principles. They use certain systems, called logic gates, to make decisions and do computations. There are only a total of 7 logic gates, and these logic gates are all you need, to do everything you do on your computer, from watching YouTube, to reading this blog. Let’s take a closer look at a few of these gates.

The AND gate is a logic gate which has an output of 1 if both the inputs are 1 but has an output of 0 otherwise.

AND gate logic table Source: https://www.tutorialspoint.com/computer_logical_organization/logic_gates.htm

The OR gate takes in 2 inputs and produces 1 output. If either of the inputs are 1, then the output will be 1.

OR gate logic table. Source: https://www.tutorialspoint.com/computer_logical_organization/logic_gates.htm

The XOR (EXCLUSIVE OR) gate is similar to the OR gate, but different in 1 crucial way. If either of the inputs are 1, then the output should be 1, but if BOTH the inputs are 1, then the output is 0.

XOR gate logic table. Source: https://www.tutorialspoint.com/computer_logical_organization/logic_gates.htm

The title of this blog promised you some fancy contraption and we will get to that, but it was important you knew the logic gates first. Now that you understand how your computer works, let’s get to the interesting part.

In your computer, logic gates are made out of resistors, transistors, and diodes, but technically you can make them out of anything. I was first introduced to a mechanical computer when I got a Turing Tumble. Turing Tumble is a computer powered by marbles which can add, subtract, multiply, and divide. There are different parts in Turing Tumble, which represent things in an electrical computer. It’s named after Alan Turing, who is known to be the father of computer science. Turing built the first modern computer during WWII to detect and decode encrypted Nazi messages. I’m not going to go into the details of Alan Turing and the Turing Tumble, but I definitely recommend you check it out. A little later, I watched Steve Mould’s and Matt Parker’s videos about the water computer and the domino computer. This is what really got me interested in mechanical computers.

With this inspiration, I set out to make a mechanical computer of my own. Almost immediately, I had an idea. I would make my computer out of Hot Wheels cars. For those of you that don’t know, Hot Wheels cars are small toy cars which ride on a track. I would need to figure out a way to build logic gates out of Hot Wheels. Before we get to that, let me explain how to do addition with logic gates.

A computer counts in binary, which is another type of number system. Binary only has 2 digits (1 and 0), as opposed to the 10 digits in the decimal number system (0–9). Counting in binary makes it easy to represent numbers with everyday objects. How do logic gates come into the picture? Well think about the way you would add a 4 digit decimal number:

Addition of 4 digit decimal number

Whenever the sum goes above 9, I carry the 10s digit to the next place value. You’ve probably done this before. The cool thing is that we can do this in binary too!

Addition of 4 digit binary number

Because there are only 2 possible inputs, we can relate these to logic gates. Let’s take the first column for example. The sum is an XOR gate, because when both of the inputs are 1, the output is 0. The value of the carry is just an AND gate, because when both of the inputs are 1, you carry a 1, otherwise you carry a 0. This is how a computer does addition! If I could build these logic gates out of Hot Wheels, I would be able to add 2 numbers with cars. How would I represent 1s and 0s? Well, the car itself would represent it. Basically if a car is there, that equals a 1, but if a car is not there, that’s a 0. For example, if I put a car in the launcher, that means my input is 1, but if I don’t, then the input is 0.

So, the 2 logic gates I need to start with are the AND gate and the XOR gate. This is shown in the following diagram.

Half adder logic diagram

This is called a Half Adder. It doesn’t do the whole job, because when adding other columns of the addition, you would need to account for a carry. The diagram which does account for the carry is a little more complicated, and it’s called a full adder.

Full adder logic diagram

I needed to base my computer off of these diagrams. I decided to build a half adder first, but before that, I would need to define my logic gates. This was probably the hardest part of building a half adder. Once I had the gates, I just had to arrange these gates in a way that matched the diagram. So, how did I build the gates? Well, a lot of it was trial and error and trying to improve on my earlier designs. This is what I came up with for an XOR gate.

Hot Wheels XOR gate

The inputs are circled in black and the output is circled in white. As you can see, if only one of the cars is launched, then they will make it to the output fine, but if both of them are launched, then they will collide in the middle and not make it to the output. I can adapt this for an OR gate by making the lengths of the tracks before the split different, so that they don’t collide in the middle. By the way, the blue part in the middle was 3D printed, and I got it online.

The AND gate is a little trickier. I had to make some “modifications” to some tracks for it to work. Here is a picture:

Hot Wheels AND gate

The inputs are circled in blue and the output is circled in white. As you can see, the car on the left pushes the “modified” output track forward so the car on the right can make it to the output.

I taped cars to the bottom of the output track to help it roll easier. This was based on my original idea of hitting the track on the edge to turn it into place. In the end, this was too unpredictable so I thought about making the car hit the track in the middle. This didn’t work either, because if the car was going too fast it would just skip over the track and not push it, but if it was going a little slower it would not push the track enough. After all this testing, I had the idea to tape some cars to the bottom of the track. This worked like a charm, and I was very surprised at how consistent it was.

This story isn’t over yet, but it’s for another time. Remember to stay tuned for part 2 to see the completed half adder and where I take it from there.

--

--

Ankit Durbha
Computer Science: A teenager’s perspective

I created the publication Computer Science: A teenager's perspective with the goal of creating a community of like-minded, technology enthusiastic peers.