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.


I am the Chief R&D at BaxEnergy, developer, hacker, blogger, conference lecturer. Bio: ex Stack Overflow core, ex Toptal core.

Read more

Newest Posts

TDD and the Zero-Defects Myth

TDD can’t guarantee zero-defects. Let us debunk this software development myth.

Read more
What can Stack Overflow learn from ChatGPT?

Stack Overflow could benefit from adopting a using conversational AI to provide specific answers

Read more
Fan mail

Multiple people with my name use my email address and I can read their email, chaos ensues!

Read more
Intelligent Trip

After years of building, our top-notch consultancy to help start-ups and scale-ups create great, scalable products, I think it is high time I added an update to how it is going and what's next for us.

Read more
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

Gleanings

And the Most Realistic Developer in Fiction is...
Julia Silge • Mar 28, 2017

We can say that Mr. Robot is having a moment. The main character was one of the top choices and thus is perhaps the most/least realistic/annoying/inspiring portrayal of what it’s like to be a computer programmer today.

Read more…