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

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

Gleanings

No, I Don’t Want to Subscribe to Your Newsletter
The Bureau of Programming • Feb 25, 2017

No, I don’t want to subscribe to your newsletter. No, I don’t want to complete a short survey. And no, I don’t want to become a member.

Read more…