Building Ben Eater's 8-bit CPU Clock (part 1)

Okay so, I know I said I'd cover continuous integration in Azure this week, but I've been putting off this 8-bit CPU project for too long, and today is the day. If you don't know, Ben Eater runs a fantastic YouTube channel on digital electronics.

For me, spending most of my career doing high-level software engineering, this channel served as both an excellent intro into digital electronics, but also to demystify the topic entirely.

Getting Started

So, Ben Eater sells kits for his 8-bit CPU on his really well structured website. I'm a sucker for good documentation, and Ben Eater has aced it here.

You can find his website here:
https://eater.net/8bit

Now, you don't need to actually buy the kit from Ben, you can see the parts list that he has kindly included for you. I'm not that ambitious, I'd rather save the time and effort and just get the kit. But if you're short on cash, you can pick up these parts on the cheap.

Tools

There's a number of tools you'll want to have on hand before you start. If you're a DIY computer nerd like me, you might have some of these on hand, but you'll need a small screwdriver set, a wire stripper that can go as small as 22 gauge, (my 20 gauge stripper did not get the job done here, so I needed to order one off Amazon). And finally, you'll want a decent light source.

You'll also want an oscilloscope. You can spend lots of money on really fancy oscilloscopes, but I'd recommend just picking up this one off Amazon:

https://www.amazon.ca/Digital-Oscilloscope-Handheld-Pocket-Sized/dp/B08VWD9J1W/ref=sr_1_41?dchild=1&keywords=oscilloscope&qid=1623624075&sr=8-41

Now, I'm admittedly no expert on oscilloscopes, but this one lets me freeze and zoom in on the waveform, and for the price, gets the job done.

So Now You Own a CPU Kit

So I got a little ahead of myself and just started on some of Ben's videos (below). But fundamentally, you'll need to understand a few things if you're like me and you haven't worked on digital circuits before. Firstly, learn how a breadboard works, there's a great video here:



Secondly, if you're like me and you're starting on the clock, you'll want to crack open the Registers and ALU kit. It's got some spools of wire that are going to be helpful in getting your circuit powered and looking pretty clean. If you're a non-kit buyer, get some solid core wire spools to get started, and consider a jumper kit of pre-cut wire.

Next you'll want to connect the power supply with the power plug adapter included in the kit. Don't plug it in yet, we're going to cut a length of red and black wire, and screw it in, so we can power our circuit.

Am I an Electrical Engineer Yet?

Not even close. Okay so, I'm literally sitting here with a breadboard, a bunch of jumpers, and a bunch of components unboxed in front of me. I've got one of Ben's fantastic videos up:

 
Admittedly, I'm googling a lot of things. What the heck is a flip flop? Well, Ben has a video about that too:




So, after much thinking and watching Ben explain his circuit, I actually have a grasp on how it's supposed to work. The 25μF capacitor soaks up charge, and as the charge increases on the line, it triggers the SR Latch inside the 555 chip. When the latch is triggered, the charge can drain through the ground connection on the 555 again triggering the SR latch. The output is a nice square signal off of pin 3 on the 555. You can also watch the voltage rise and fall if you connect your oscilloscope probe to the 25μF capacitor line., not a square wave, but consistent with what we expect.

So Ben will do a way way better job than I ever could explaining how this circuit is supposed to work, but what I'd like to do is point out any head scratching moments, such that you might save a bit of time.

If, like me, you're trying to follow Ben along in his video, you'll notice at one point he has a 100k Ohm resistor going into pin 7 on your 555 chip. Mystified, I didn't actually have a 100k Ohm resistor in the clock kit. So, the trick is to watch your video through to the end; Ben installs a 1 M-Ohm variable resistor, which is what you'll need to do to get up and running.

The resistors are direction agnostic, so you don't need to worry about installing them backwards, but the capacitors in the kit are slightly different than what you see in the video. Make sure your capacitor is installed in the right direction. On some, the stripe is marking a positive end, on others, the stripe is marking the ground. A little googling will get you a bunch of picture examples which should clear things up. In my case, the stripe was marking the ground side with a bunch of 0's on the stripe.

Finally, keep in mind your components can be defective too. I had a bad LED, which led to much head-scratching until I finally tried a different LED. (Okay I might have cooked the LED by accident, but I'm not sure; there have been worse casualties in my time with hardware).

Let There Be [a] Light


As you can see I wound up with a nice little square wave on my oscilloscope, and a flashing LED light for each cycle. I've still got a long way to go in the world of digital circuits, but I have a great grasp on what's going on thanks to Ben and his fantastic educational content.

I'll do some additional posts as I work through the rest of this clock module, and the rest of the CPU project. I'm definitely looking forward to getting it up and running.

Comments

Popular posts from this blog

Creating HID Override Layouts for the Unity Input System

Managing API Keys for Serverless Functions with Azure KeyVault