In this guest video, Tanner from TannerTech explains how to build a frequency counter using the CD4026B IC.
Check out his channel here: https://www.youtube.com/channel/UCR1ARVDHnmTC3sUOkS4mUsg/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
๐ Likecoin โ Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Check out his channel here: https://www.youtube.com/channel/UCR1ARVDHnmTC3sUOkS4mUsg/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
๐ Likecoin โ Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Hello my name is Tanner and I am in charge of the Tanner Tech YouTube channel on my channel. I make all kinds of videos covering a wide variety of different topics. I'm currently making a video right now about how to make this custom PCB and this PCB will actually be driving my MIDI Christmas lights this year. I've also made videos about how to make induction heaters, vacuum tube amplifiers, and one of my personal favorites, the stepper motor keytar.
Now you may be wondering why I am here on a Eevblog today. That is because Dave Jones graciously invited smaller electronics channels to be on this channel while he is gone. So I Think him very much enjoy my video. Frequency counters are really cool.
Now in order to understand what a frequency counter can do, we need to understand what frequency is in Hertz. So imagine you had a light and it blinked on for half a second and then it blinked off for a half a second and it kept repeating. So the total time was on combined. If the total time was off is one second and so as in sad, one cycle in one second, that means it was blinking at a frequency of one.
Hertz Now this is just a very, very low frequency. Some things go up to extremely high frequencies. For example, the video transmitter in my Fpv drone goes up to five point eight gigahertz. Now that's a very high frequency now.
A lot of frequency counters such as this signal generator and frequency counter are pretty expensive. For example, this one was like $58 Now in this video, we're going to be trying to build our own frequency counter that's relatively simple. It's a very rudimentary frequency counter. And the bill that we're going to be using these CD 40:26 Decade Counter chips and I'll explain how these work in just a second.
But this frequency counter well be pretty cool. It won't be very accurate and it won't be really nice to look at, but it'll work. So let's get started. So this is the CD 40 26b microchip and it's a typical 16 pin chip and is compatible with these common Cathode 7-segment display chips right here.
So these are the two chips we're basically going to be using inside this video. All right. So pretty much what this chip has is: it has a bunch of different connections to connect to the different pins of the 7-segment display. So you see, we have pins ABCD efg.
Now all those pins connect to the corresponding ABCD Efg pins on the segment segment display. Check. Of course you've got 0 volts or ground and VCC Obviously C4, the CD 4026 can be anywhere between 5 and 15 volts. so it'll probably work at 12 volts for this project.
And the CD 4026 has some interesting pins. Clock is one of the most important pins on this chip. So pretty much what happens is whenever you give a pulse to clock just a singular pulse, it will increment the display by one digit. So for example, when the starts it'll have digit of 0 which means these four segments or six segments will all be lit up.
now. as soon as you give it one pulse, then it's going to increment to the next digit on the 7-segment display which will be a 1 and so on until you reach 9, after which it'll reset back to zero. So that's pretty much what the clock does. Now, the disable clock pin pretty much disables the clock. It's whenever you have a high signal to disable clock. it'll pretty much disabled whatever you're doing here on clock and will freeze the display. Now disable clock. Those will all be together in parallel again with all the three other Cd40 26 chips display enable.
You really want to bring that high all the time because this will allow all these they just to be turned on. An able out is pretty much this pin, but it could go out to the other chips and so you can daisy chain that enable out to enable in on all the other chips. That'll be helpful. Okay now Decade Out.
That's another important pin. Decade Out will give one pulse and every time this goes back to zero. So this will pulse. Once it'll go from zero to one, it'll keep pulsing on.
and then as soon as this pulse hits zero after it hits its tenth pulse, then this Decade Out will give one pulse. and this allows you to have multiple displays daisy chained together in multiple CD 40:26 chips. That way you can display larger numbers that go beyond one digit. Let's say, for example, you had a few of these chips right here.
So this chip right here would be tied to the first CD 4026 chip and it would start counting from zero to nine. Now as soon as this hits nine and then it goes back to zero, this one will go to one which will make ten and then this one will keep going from zero to nine again. so that will be 10 11, 12, 13, 14, 15, 16, 17, 18, 19 and then it'll reset back to zero and it will give another count. Up to this one will should bring the total display up to 20.
Now you can put as many of these as you want together to get as high as the number as you want. You just use Daisy Obtain More CD Forty 26 chips. So in this video, we're probably going to have three of these daisy chained together. So that way we can get a number up to 999 and that just means we'll have to have three separate CD 40:26 chips all together.
Now when you're looking at all these numbers, you may be thinking that the first CD 40:26 chip with the clock and needs to be this one, but it's actually not the first clock in. CD for 226 chip needs to be the farthest one to the right. This is because the decade out will need to go to the next chip to the left to increment that one every time. This one goes every ten times.
So now we get to a really important pin and that is the reset pin. Now the reason the reset pin is so important is because as soon as you pull the reset pin, it'll set whatever number is on your chip back to zero. All right. So now that we have most of the basics regarding the Cd40 26 chip out of the way, let's take a look at the 7 segment display chip. Now this is relatively straight forward. In the seventh segment. LED display chip you just have a lot of LEDs You have one, two, three, four, five, six, seven, eight, LEDs inside there and each one can be turned on by a different pin and they all have the same common cathode. All right.
So let's build a simple circuit on a breadboard that consists of these three seven segment display LCD chips and three of these decade counters together. This may take a little bit, but once it's done, we should be able to put a clock signal on here and see that this thing counts all the way up and then goes back to zero once it hits 999. You All right? So as you can see right now, I have this thing working pretty good I Have all that decayed counters wired up in this huge rat nests of wire and as you can see, it's counting up right now. I Have this whole setup hooked up to my frequency generator and as you can see, it's putting out a square wave right now.
110 Hertz Now if we look at the square wave, you can see that it's running at a duty cycle of 20% Which means it's on 20% of the time and off the other 80% of the time. So if we look at the frequency, we can actually a mess around with this and we can change the speed at which the numbers count up. So right now it's set up so it's incrementing ten times per second. And that's true because you can see that this one counts about one every second.
Now if I increase the frequency to a hundred Hertz you can see that this one is now the number increasing every one second. Now, if I move it all the way down to one Hertz then you can see that this number increases every second. So as you can see, this really works very well at counting how many pulses of the square wave come every second. Now we can actually play with the reset button.
so this wire right here goes through set and so anytime I can reset it back to zero. And now we can also play with another pin called the clock pin right here. and so at any time when it's running, let's put it up to a very high frequency of let's say 60 Hertz We can actually stop this at any time and see exactly how much time has passed since it was last frozen. All right.
So now that we have this Decade Counter Timer circuit all built, let's scoot it aside and go in some theory about how we can actually make frequency counter And so let's draw a block diagram right here. So we have the Decade Counter circuit and that is just represented by this box and that goes to our three displays right here. Now we also have an input signal that is a clock signal and it will increment this counter by one every time a clock signal is sent to it. Now, in addition to this clock pin, we also have a reset pin which will reset all of these counters back to zero.
Whenever one pulse is applied to the reset pin, then we have one more pin right here and this pin is going to be the freeze pin. This is clock disabled and what happens is if a pulse is sent on here or this pin is brought high, then it'll freeze whatever number is on this screen right now. And so with all these three inputs, we can have a very lot reliable frequency counter. And so let's take a look at how this would work. So let's say that we have a 10 Hertz signal in on the clock pin. That means that this pin is going to increment once every 10 seconds and then this one will increment once every one second. Now we want to freeze this every second to get our frequency in Hertz. So what we would have to do is we'd have to have a clock disable pin.
So that way we can read the frequency at that moment, the clock disable pin would need to run maybe one second, maybe a half a second and then immediately following this clock disable pin, we'd have to have a quick burst of the reset pin. Now between this reset time and the next clock disable time, we have to have that at a frequency of 1 Hertz if we want to display the number on the screen in Hertz. So in this case, this is what the waveforms would look like for the clock, the reset, and the clock disable pins. So of course we'd have the clock and the clock would just be the input frequency from whatever we're getting it from Now on.
a separate time line. we can look at the reset and clock disabled pins. So we'd start with a clock disable pulse on this line and the clock disable pulse would last about 0.5 seconds and then it would just go on and then we'd have the reset pulse. Now the reset pulse would immediately follow the clock pulse right here.
After this reset pulse, there's going to be a length of time between our next pair of reset and clock pulses. the first one being the clock disabled pulse. This length of time right here in between the reset pulse and the next clock disabled pulse is going to be the multiplier that we will multiply by the the frequency right here to get what the actual frequency is in on the clock pin. So for example, if we have let's say a frequency.
let's say we have a time right here of one second between each clock disabled and reset pulse. Then that one second time period will give us approximately a one Hertz thing on here. And so that means that this number that is going to be read out on the 7-segment display would be the number of Hertz that is being put in on the clock pin. Now if we shorten this time right here to that, say 0.1 seconds, then we'd have to add an extra 0 right here.
In order to get the right pulse, we have to multiply our signal on the 7-segment display by 10 to get the right number right here. and then let's say we divided that by a smaller number. We divide this again by 10. We'd have to add another 0 right here to get the right frequency.
And by doing this, we could get almost any frequency on this frequency counter, but it wouldn't be accurate because you'd be adding more zeros. So we'd have to add more 7-segment displays so this is most accurate up to one kilohertz. But if we added more this displays we get it more accurate. And so these waveforms are the waveforms that we will need right now in order to adequately read our frequency counter. This is the basics of making this frequency counter work. Now, if we want to make this look a little bit better, we can turn off the display during the time when it's to be counting because the time in between here and here the display is going to be counting up really fast and you might not want to see that. And so what we can do is we can add another pulse that starts as soon as this pulse ends and it will end as soon as this pulse starts Again, It'll be this specific time in between. whatever time here we were talking about before and pretty much this will be another pin.
which is the display. an able pin. All right. So I didn't talk about this when I was first drawing the block diagram.
The display: an able pin pretty much just turns on and off the display and so if it's high, then the numbers will be on. and if it's low, the numbers will be off. So in that case, I will actually need to invert this frequency right here. So that way it starts high and during this time, it goes low, shutting off the display for that annoying counting sequence before turning it on again to actually read the numbers.
So we have these three different waveforms and we will need to generate to put into the CD 4026 chip in order to get a really good frequency reading. Now, if I had multiple different Five Five Five timers or a signal generator, then I could easily generate these three waveforms. but my frequency generator only has two channels and so that makes it a little bit difficult. And also I really don't want to go through the pain of getting out a bunch of Five Five Five timers and wiring up a bunch of different oscillators.
So in this case, we're just going to try and generate these waveforms on. and Arduino Nano All right! So I've made an Arduino code and this main purpose is to generate those three different waveforms on three different pins of the Arduino. Those pins are pins 12, 11, and 10 respectively. I've uploaded this to an Arduino Nano Let's test it out.
Okay, so I am stoked right now cuz this thing works perfectly. So first off, let me bring you down all the way to zero. So right now this thing is operating at 0-0 Hertz Now let's turn it up to ten. Hertz As you can see, we're registering a 1 on the display screen and if we add another zero right here after the 1 or we multiply this display by 10, we get 10 Hertz Now if I move this up to 100 Hertz you can see that we have 10 on here and so I'm gonna multiply that by 10 and we get 100 Hertz Now let's move this out and bring it up a lot higher to 1,500 or 1.5 killers. As you can see, this screen reads it perfectly at 15. If I crank this up a little more all the way to. let's say 55 kilohertz. We're registering 499 and that is pretty close.
So let's see what happens if we crank this all the way up to almost its max value which is 10 kilohertz. As you can see, it's perfect. It doesn't reset, acting back to 0 accidentally, it goes up to 999. and if I crank it up all the way, it kind of messes up because it's not meant to go that high.
but up until 10 kilohertz, it functions almost exactly as planned. Now if I did this same thing and I added more decade counters, I could get a very, very accurate frequency counter. So now to recap. So inside the CTD 4026 chip, we have a bunch of different pins including the clock pin which is directly inputted from the signal generator.
Now, every time the clock pin is high, then increments this display by 1 and we have a series of pulses being fed by the Arduino into the clock disabled reset and display enable pins and the clock disabled is high that disables the clock and freezes the display. It, whatever was last set on there, the display enable is high, which means it makes it. come on then. We also have this little part right here when it resets it and that is just a quick read, set poles and the display is still high and then it brings the display low for just a little bit of time.
when it lets it count up to whatever frequency is on there. after it brings it up to the right frequency, then it freezes the display at whatever frequency is on there. So right now you can see that the frequency is 539 which means it's Five Point Three, Nine Kilohertz and that is really accurate to my function generator which is it 539 Kilohertz. -.
Alright, so for the future I may actually make this display a lot better. I may use Nixie tubes I may even just replace it. How do we know with a completely analog signal generation source where I can just control the control voltage pin of the Five Five Five timer so we can trigger each pulse at the right time now. Also, this only works with square waves for the time being, but in the future I could actually make this work with sine waves? Alright, so in a sine wave, whenever it goes high, we can use a comparator and that comparator will read whenever it goes high for each time and every time it goes high, it'll just give one pulse like this.
Now that will give us an adequate reading if we use sine wave. So in the future I'll make this frequency counter a lot more accurate and more usable for other applications by replacing the Arduino with some analog circuitry like will also use some comparators to make this thing able to read sine waves and I'll add a lot more digits to make it more accurate. but there you go, That's all. It's pretty cool, so that's it.
Thanks for watching! I Hope you guys learned something really cool about how to utilize the Cd40 26 chip and how you can actually use it to make a quite accurate frequency counter. As always, thanks for watching and stay tuned for next time.
u can make alot of money maybe if u can make a fast one.
was nice.. sun i ear arduino.. stop the vid and click dislike
I thought your explanation of the operation was very good. Well done.
Interesting content, but It's hard to take someone that young serious. Also, the finished product came out looking like an IED controller.
that project has more coloured wires you could poke a stick at, it looks like a time bomb from the movie Speed ๐
…….. Subscribed ! , Well done Mate,
Go Tanner! Thanks Dave for featuring him!
Nice to see a fellow FPV drone pilot.
Using the set-up you had, a little more code you could have made it auto ranging 3 digit display. withe the Dp indicating 1, 10, 100 Khz.
Great job Tanner!
Great video – very well described and interesting. Subscribed Tanner.
Excelent Video. Thanks Dave to let us know new channels with sutch great contain. Maybe you can make a better presicion clock with a crystal oscilator and the correspondent dividers.
Great video! Keep going!
Great to see your age interested in basic logic electronics, understanding basic is fundamental, than you can step up and have much better success in micros ๐
Hey, I just saw you with Keystone Science the other day… way to make the rounds, young bro!
You can use a multivibrator for the reset and display signal generation. To get the short reset pulse you would only need to add a small capacitor in series to the second output of the multivibrator. To get the display disable you could pair both outputs from the multivibrator through diodes into an inverting transistor amp. Multivibrators are very stable as i've found and with some optimization can be used as a crude frequency reference. You could also add a switch to change the resistors in the multivibrator for higher/lower frequencies.
Nice explanation and construction, but you really need some decoupling capacitors on those counters, otherwise the circuit will not be dependable
"56$" "expensive"
FINALLY someone! unlike dave's "affordable" "5999$"
subbed lol
Wow, impressive! Thanks dave, the guest videos are (partially) REALLY good. This one is my favourite so far.
Anybody else notice that these youngsters have a lower pitched voice than dave? ๐ ๐ ๐
This bloke has an odd accent. Can we have subtitles? ๐
ISTM that there's only one clock required… To enable the counter. Display latch is its inverse and the reset pulse is on the falling edge of counter enable.
If you want a speedier frequency counter using a similar approach, the faster 74xx logic is a natural "upgrade" from the 4000 series.ย
Sure, most of the faster ones are binary counters. But you could use them as cascaded 4-bit counters with a reset on 10 (they aren't more expensive) and add in a single BCD-to-7SD decoder (a 4xxx series would be fine) if you wanted to keep things really, really simple.
Using one of the faster logic families (S, AS, even AC), you should be able to measure >10MHz without much of an issue.
Also, throw in a Schmitt trigger (implemented with a couple of fast BJTs or a fast comparator) to enable measurement of non-rectangular wave forms.
Anyway, good video! Excellent to see younger people learning this stuff!
Nice project, but you talk a lot about accuracy, without talking once about the accuracy of the reference timebase. This is very crucial, you can add as many digits as you want, but the reading still won't be accurate, unless your timebase is. And the crystal on an arduino board is really not that great.
GIMME DA HEETA!