A computer from scratch - Fish and chips

In the first installment of "A computer from scratch", I've built a NAND gate. I've also introduced the my "scaling" rule: if I build something, I can buy it pre-made, because I only have one lifetime to spend on this :-)

Therefore. I've bought a bunch of 4011 CMOS NAND gates, here they are:

4011

And here's what they do:

4011 Pinout by Inductiveload

With this in mind, and with the diagrams in my second installment, I proceeded with building NOT, AND and OR gates. Of course this wasn't without confusion and questions, but fortunately I could count on the help of the Electronics Stack Exchange community when I got stuck.

The results

Here's what I built. Honestly, after getting stuck on where to put my resistors, all the builds were super easy.

NOT gate

A NOT gate is built by short-circuiting the inputs of a NAND. The circuit is very simple, it connects a button to pins A3 and B3, and connects the output Q3 to a LED.

NOT plan

The build looks like this

NOT result

AND gate

An AND gate is built by taking the result of a NAND and inverting it through a NOT. The circuit is also simple, it connects a button to pins A2 and another to B2, and connects the output Q2 to the previous NOT gate at A3/B3.

AND plan

The build looks like this

AND result

OR gate

An OR gate is built by negating both inputs and passing them throug a NAND. The circuit thus requires three NANDS. It connects a button to pins A2/B2 creating a NOT gate, and another button to A1/B1, creating another NOT. It then connects the two outputs Q1 and Q2 to A3 and B3 respectively. Q3 is connected to the LED as before

OR plan

The build looks like this

OR result

Next Steps

In the next steps I'd like to try and build XORs, half adders and full adders. I'd also like to build some testing script via Arduino, although I'm not sure I can pull it off.


Hi, I'm Marco Cecconi. I am the founder of Intelligent Hack, developer, hacker, blogger, conference lecturer. Bio: ex Stack Overflow core team, ex Toptal EM.

Read more

Newest Posts

Guest blog: Building, in partnership with communities by Shog9

A lesson in building communities by Stack Overflow's most prominent community manager emeritus, Shog9

Read more
Can you migrate a company from on-premise to remote-only?

Some lessons learned over the past 8 years of remote work in some of the best remote companies on the planet

Read more
Announcing Intelligent Cache, our caching library

Our newest open source initiative, intelligent cache, is available for use

Read more
Guest Blog: The mythical 10x programmer by Antirez

In this post, Salvatore Sanfilippo puts together a list of qualities that I believe make the most difference in programmers’ productivity.

Read more
Team EMEA

Today I want to introduce our second engineering team: Team EMEA

Read more

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…