Placeholder Image

字幕表 動画を再生する

  • There are a lot of ways to build a clock circuit for a computer.

  • But you know, we want something that's relatively flexible.

  • We can adjust the speed.

  • You know, we don't want to run too fast.

  • We wanna be able to see what's going on.

  • And so I'm gonna use the 555 timer.

  • This is a classic integrated circuit here, the Triple Five timer.

  • And that's that's what this chip is here.

  • And so you can tell Pin one here is by the defense And 12345678 And right now I'm powering this with just five volts coming in from a cell phone charger that I've cut into the USB cable pulled the five bolts out and the power of the chip power comes in five volts here on pin eight and ground to pin one.

  • You can actually go up to 17 volts or 16 bolts or something.

  • With this chip, five volts works and to control the timing, you've got to resistors and a capacitor.

  • And so the first resistor here is going from five volts to pin seven.

  • This is a one K home resistor and then from pin seven to pin six.

  • I've got ah, 100 k own resistor and then pin sex is connected around a pin, too.

  • And then from pin to ground, I've got this capacitor and this is Ah, this is one micro fared capacitor and you could see the positive side is connected here to pin too.

  • So the negative side of connected to ground make sure that's in the right way.

  • And so those resistors, in the capacity of control the timing, we'll see how that works in a minute.

  • But the output of this chip is on pin three, and so that's just connected to this led.

  • And you know, the output can drive a fair amount of current.

  • So we want to make sure we have a current limiting resister.

  • This is just a 220 ohm resistor here limiting the current through the led so we don't burn up our led.

  • So how does it work?

  • Well, good place to start, of course, is the data sheet is a data sheet for the 555 timer and you can see they actually give you a whole schematic of what's going on inside that chip, which way won't go through all that.

  • But they also give you Ah, bunch other stuff in here.

  • One is this sort of block diagram that gives a little higher level view of what's going on.

  • And so you can see there's, Ah, a couple Comparator Tze there's you know these three resistors.

  • There's a flip flop that these comparator is connect into.

  • And then there's this output stage.

  • So this is this is pretty interesting.

  • I don't personally like the way that this is drawn.

  • It's kind of drawn to line up with pins here.

  • They give you a different version of it a little bit later on in here.

  • This is a sort of a different view of the same thing.

  • But I don't really like this one either.

  • It doesn't share.

  • That actually should be a connection from here to this comparator and you don't really know what these inputs are is like Okay, there's three things going into the flip flop.

  • But what what are they?

  • I don't know.

  • I don't particularly care for these diagrams.

  • Eso I drew up my own That I think explains a little bit better and you can see just like those other diagrams.

  • There's the two Comparator Tze there's ah, flip flopped actually an s r latch.

  • I think it's probably a better way to describe what this thing is.

  • Um and you just kind of walk through what's going on here.

  • So everything inside this blue box here is is kind of what's going on inside the inside the timer itself, and then the green stuff that I've drawn out here is is the rest of the circuit.

  • So we kind of go through and look at what we've got.

  • So this one K is the one k resistor going from five volts to pin seven and then between Penn seven and six.

  • That's this 100 k resistor here.

  • And then you see pin six and two are connected.

  • That's his little green wire gone around here and then between pin too and ground, we have this one micro Farid capacitor and then over here we have our led and this is our thing.

  • It was a 220 ohm resistor over here.

  • So this is this is our circuit and understand how it works.

  • We can kind of look at what's going on inside the Triple five timer.

  • So I just start by looking at this this path through here, you can see we've got our plus five volts up here.

  • And then, of course, I ground down here.

  • Zero volts.

  • Um And then there's these three resistors, and I think each of these resistors inside here is five K's, five K five K five k.

  • I think it's a complete coincidence.

  • That's a 555 timer, but anyway, but what they do is they set up a voltage divider.

  • And so, at this point here, you're you've got 1/3 of the voltage between zero and five volts.

  • So that's, you know, one in 2/3 volts.

  • 1.67 volts will call it.

  • And then at this point here, we've got 2/3 of our five old supply.

  • So this is 2/3 is 3.33 volts.

  • And so you got this.

  • Vultures dividers.

  • Five volts.

  • To go through this resistor, you're down to 3.3 years.

  • Other resister you down to 1.6667 whatever.

  • You go through those other resistor and you're down here at ground zero and what that does that sets up these inputs for these Comparator Tze And the way the Comparator is work is there's a positive input in a negative input.

  • And if the positive input is above the negative input than the Comparator switches on and the output is ah is five volts And if the positive put is below the negative input, then the current switches off and the output here is zero votes.

  • So let's think about what happens when we when we turn this thing on, get this out of the way here for a second.

  • So what happens his Let's assume that these inputs over here, this is all zero volt.

  • So we've just turned this on.

  • This stuff is zero volts.

  • Um, so we've got zero votes coming in here that is below 1.6 volts.

  • And so this comparator turns on and so that triggers the set pin of the RSR latch.

  • And if you don't know what s R latches, I've got a video on that, but basically it's gotta set in a reset.

  • And when the set goes high than the output comes on and when the reset goes high, then the output turns off.

  • And then, of course, if they go lower than it remembers its last state.

  • And there's both the output here.

  • And then there's the inverted output here, which is which is always the opposite of our output.

  • So we have zero volt here.

  • We got zero votes here.

  • This Comparator will be on because zero is below 1.6 and this Comparator will be off because zero is not above 3.3.

  • So this one's off.

  • This one's on and said the latch is gonna be set, which means our output will be will be on.

  • So the led you'll be on, we're gonna start on So we'll do a little, uh, graph here.

  • And if our output is on than that are are not output are inverted que here is gonna be off.

  • And so this transistor will be off, So nothing, nothing's gonna happen here.

  • We can kind of ignore this this whole discharge thing here for now.

  • So what's gonna happen is we're gonna have a current flowing through this one k resistor through the 100 k resistor and into this capacitor down here, this one microphone capacitor and a capacitor is going to start to charge.

  • And so, if you look at the charge on the capacitor, which is also the voltage here going into pin, too.

  • It's gonna start move.

  • This gets here.

  • Uh, it's gonna start here at zero votes, and it's going to start to climb, and it's gonna keep climbing and climbing and climbing as this capacitor charges.

  • And so what's happening is the voltage here is increasing, and at some point it's gonna increase above 1.6 volts.

  • And if it's above 1.6 holds, this comparator will turn off because 1 26 is no longer above, uh, whatever this voltages compared to turns off, that's fine, right?

  • Because the latch is gonna latch its output.

  • So we're not We're not asserting the set pin anymore this set signal, Um, but, you know, if we haven't reset it yet, it's still gonna be We're still gonna have a high output here, but eventually this voltage is going to reach 3.3 volts.

  • It's gonna it's gonna maybe go a little bit above 3.3 volts.

  • And at that point, uh, you know, that voltage is gonna be above 3.3 volts and this comparator will turn on because the positive input here is above the 3.3 old negative input.

  • Um, and this will turn on and this will reset the latch.

  • I guess I didn't give myself enough room here, so Nor that s so this is our output output is gonna get reset when this hits 3.3 volts.

  • Yeah.

  • So this is this is, like, 3.3 volts on our capacitor here.

  • Maybe this down here is 1.6 volts, and we'll say this is zero.

  • So we started at zero.

  • We went through 1.6 volts.

  • You know, nothing happened.

  • We turn off the set pin with state latched on, and then we get up to 3.3 volts, and at that point, our output turns off.

  • But the other thing that happens is are not output.

  • Are are inverted output.

  • This turned on, and that's gonna cause current to flow from here through into the base of this transistor.

  • And that'll turn on this discharge transistor.

  • And so then what happens is you know, current can now flow through the one k resistor through this discharge to ground.

  • Okay, that's that's not very exciting.

  • But what's more interesting is that current can also flow from the capacitor through the 100 k resistor.

  • So before we were charging the capacitor in this direction Now we're discharging the capacitor current is flowing from the capacitor through the 100 k resistor and through this discharge into the capacitor is going to start to discharge and it will discharge for for a while.

  • And of course, little you know, Soon as it started charging, it'll drop below the 3.3 volts and so the reset will turn off.

  • But again, this is latched, so nothing happens.

  • But eventually the capacitors of voltage will drop below 1.67 volts.

  • And now with this below 1.67 the set Comparator turns on and it sets the latch again.

  • And so when we set the latch, when this gets down to 1.6 volts, we set the latch, we turn the output on.

  • We also turn the discharge transistor off.

  • So we turn this off so we're no longer pushing current through the base of the transistor into this transistor is off and so no longer is a capacitor discharging.

  • We're back into the state where the capacitor is charging again.

  • Pastoral charge.

  • Our output is on and eventually pass will get back up to 3.3 volts.

  • This will switch.

  • We'll start discharging again and this will turn off pastoral discharge.

  • It's off capacity charged discharge.

  • And so we get the capacitor is charging and discharging kind of like this, but our output here is this nice, clean square wave.

  • And that's what we see when we look at circuit here we see our led flashing.

  • And of course, we can control the rate that the lady is flashing based on the values of these resistors and capacitors.

  • Right, because, you know, the rate is is is, uh, set by how quickly this capacitor charges and how quickly it discharges.

  • And so how quickly a charges is going to be dependent on you know, these two resistors and capacitors.

  • So the bigger these resistors are, the slower it's gonna charge.

  • And of course, the bigger the capacitor is, the longer it's gonna take charge.

  • Um, and if these resistors are smaller than it'll charge faster, pastor smaller, it will charge faster on, and then for discharging to the time when this is low.

  • It's just discharging through the one resister here on.

  • So you know again, if if this is a bigger resistor, it'll take longer to discharge and so this will be low for longer.

  • If it's a smaller resistor, it'll be faster.

  • And so, by adjusting these components, we can kind of control the rate here.

  • And so one thing I notice is that, you know, I chose 100 k resistor here and then a relatively smaller one k resistor here.

  • I mean, this is only 1% of this and that's because because we're charging, we're charging through.

  • Both and we're discharging were only discharging through this one.

  • But I wanted this square wave to be fairly symmetrical on dso by this only being like a 1% difference in the charging from discharging.

  • You end up with essentially essentially the same time that it's off.

  • That it is, that is, on its sort of what's called the duty cycle.

  • And if you look at the data sheet, they actually give you, um, some formulas here for figuring out the time that it takes to charge or discharge.

  • So charged time discharge time on, and they actually show a nice little graph looks very similar to the one that I just drew.

  • Um, but you can see, you know, they give you They gave you the charge.

  • Time is based on our A plus R B, and we're calling this our A and this is our b times, the capacitance, which is the sea here.

  • Where's the discharge?

  • Time is just based on our be right, because we're only discharging through that one resister so you don't see our A in there and then the total period is our A plus two r B.

  • Because it's our A plus, you're going through our be twice for the for the total period times are capacitance and so we can figure out our total period.

  • Just using this formula, you pull out a calculator here, and so just sort of order of operations.

  • Here.

  • Resistor be is 100,000 homes of times, too.

  • And then we can add in Resister is 1000 homes are one k resistor, and we'll multiply that by our capacitor, which is it's a one micro Farid capacitor.

  • So I think that's that's one micro fared and then we multiply that by this 0.693 and you know, the reason you're multiplying by that is you know, you know, the Resistance times the capacitance gives you the time constant, and that's used in the to sort of give you this exponential.

  • See what I'm doing here.

  • They curve for this exponential function.

  • Um, but, you know, we're not We're not going the whole way.

  • And, you know, we're just going from 1.6 bowls to 3.3 volts.

  • And so they've They've done some of the math for you to figure out what, what coefficient and to use to get from the time constant to the actual period.

  • And so what?

  • We come up with 139 milliseconds 1390.139 seconds, and so that's the period that are that are led is flashing.

  • Now, if we want, we can double check all of this for ourselves by hooking up to a telescope here.

  • So I'll just hook up ground for my probes here, and then I'll connect one probe to the output, which is the pin three here.

  • And then I'll hook the other probe up to the capacitor so we can watch the charge on the capacitor and Here we go.

  • We can see our output, which is which is this nice square wave.

  • And then we can also see the charge and discharge the capacitor.

  • And so, if you look, zero volts is down here.

  • So this is 12345 volts.

  • You can see the charge and discharge the capacitor is going from.

  • You know, this is about one and 2/3 of a volt up too, you know.

  • 123 and a little bit.

  • Three and 1/3 volts.

  • It's exactly what we'd expect from that.

  • You know that voltage divider?

  • Now the output you see is going from zero votes here, Thio.

  • 123 and a little bit here.

  • Three and 1/2 colds.

  • Maybe you might expect it to go all the way to five volts.

  • But but actually the data, she does talk about this.

  • It does say, Look at the, uh, output voltage here for our five volt says typical is 3.3 volts, and we're getting, you know, a little bit more than that.

  • But it says the minimum is 2.7 viable, So we should be getting at least a minimum of that which is fine.

  • That's enough for a logic high level.

  • So if we're per feeding this indoor or any kind of digital logic will be okay with that.

  • And then we should see, uh, 139 milliseconds here.

  • So this is 50 milliseconds per division.

  • So this is 102 100.

  • And huh?

  • So that's not quite not sure why I double check this.

  • Well, I figured out the mystery, so we calculated 100 and 39 milliseconds, and we're seeing about double that.

  • And the problem turned out to be these capacitors.

  • So, you know, looking, it's capacitor.

  • It says one m f d 50 v.

  • So I would assume that that means it's a one Micro fared capacitor 50 volts.

  • It's got this 10 to 2.

  • I assume that that's ah date code of some sort.

  • Maybe it's manufactured in 2010 the 22nd week of that, and that's all it says on it.

  • So I would assume is the one Micro fared capacitor, uh, turns out when I hook it up to my meter.

  • He had measures had to micro Farage's, so I don't know what's going on with that I got a whole bucket of these things and they all say one M f D on him, and they all released all the ones I measured measure to Micro Fareed's.

  • So instead of one micro ferrets to my preferreds And so you know, if we if we plug that into our formula, we had one micro fair there.

  • Instead, we plug to were basically multiplying by two.

  • So multiply that by 2 278 milliseconds, and you know, we're measuring 263 milliseconds period here, and that's Ah, that's much more in line.

  • That's that's certainly within.

  • You know, we've got 5% tolerance is on this resistors and stuff.

  • So 263 278 close enough.

  • So very interesting.

  • I always assumed these were one micro fair, but apparently apparently not.

  • If anyone knows why they're marked that way, maybe maybe I'm missing something obvious, but I would assume that one m f d means one Micra fired, but apparently one m f d means to micro parents go figure.

  • Yes, the 263 milliseconds that that's much more what we do expect.

  • And so if we take one over 263 milliseconds.

  • We get about 3.8 s O that tells us that should be flashing about 3.8 times per second.

  • And that little visually seems about right.

  • So I think we're almost done with this circuit.