This video demonstrates how to design a discrete logic circuit using 4000 series CMOS components (CD4538 monostable, CD4093 Schmitt trigger, and CD4017 counter) to detect three horn beeps within a 5-second window and activate a relay to open a gate, showing how digital logic circuits can implement software-like functionality for practical applications like farm gate control systems.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Discrete Logic Circuit DesignAdded:
Okay, in this video, we are going to have a look at discrete logic circuit design.
Now, I've been asked, do people still design circuits with discrete logic because all they see is microcontroller projects online? And I still do. Here's an example of one. I'm going to cover this in this video.
So, back in the day before microcontrollers, we designed our circuits with TTL. It's a 7400 logic series.
Then after that, upgrade to CMOS, the 4000 series CMOS.
And that was brought to us by RCA.
You probably remember them.
They came out with 4000 series logic.
And while they're at it, they they actually made a microprocessor, the CDP1802.
So, if you wanted to start designing with discrete logic components, grab yourself a bunch of 4000 series uh CMOS logic and start building. Okay, so here is the problem that we have to solve. Now, on our farm, we have many automatic gates on our driveways to keep the animals from getting out, to keep unauthorized people from coming in.
So, the guys that come in regularly, like the irrigation guy or the diesel mechanic or the produce truck, we give them a fob. It's like a garage door opener so they can open up the gate. But sometimes we have a truck that comes to the gate that has never been there before and he gives us a phone call. He says, "I'm at your gate." So, we got to run out there and open the gate for him.
So, we came up with a solution that if the guy would beep his horn three times, it will open the gate. So, we could just tell the guy, "Honk your horn three times, the gate will open and you come in." So, that's the problem we have to solve using our our circuit, our discrete logic circuit design on my breadboard. Okay, here's a block diagram of our system. Now, the top part is existing. So, we have an RF board and in my case, it's made by LiftMaster. So, when you activate the fob, it receives it on the antenna and activates a relay.
So, we have a contact closure for about 1 second, and that's going to short out two terminals on the control board. And that will start the sequence of opening the gate. So, the gate opens, and then there's a presence loop. It's a metal detector. It sees that if there's a car there or not. It waits for a car to leave, then it'll close the gate.
Now, my add-on is this board here. So, I have a microphone like this.
So, it picks up the the horn.
And three beeps, it's going to activate a relay, same thing.
And it's going to short out the same two terminals on the control board, which will open the gate, check for presence of a vehicle, and when it's gone, close the gate. Okay, so let's check out how this circuit works.
Now, when I was designing the circuitry, I did not use my microphone module. I didn't want to be beeping a horn every time I wanted to test.
So, I replaced it with a touch switch, which gives the same output. So, when I touch the switch, that's the same as beeping a horn.
Now, this LED here is a drive to the relay that gives the contact closure to open the gate on the control board.
So, if I beep my horn three times, the LED will come on for 1 second. There it is. Drives the relay, which opens the gate.
I'll do it again.
Three beeps.
Now, a car horn could beep faster, so we do three fast beeps.
Opens the gate. Now, a truck has an air horn, so the beeps are longer. So, one, two, three.
Now, what happens if we beep four times?
One, two, three, four.
Doesn't pick it up. I'll do it again.
I'll do it fast. One, two, three, four.
So, if you get continuous beeps, let's say a wedding procession is going by and the guy's honking his horn, or if you have a car with the alarm going off by your place, it's not going to activate the relay.
So, it's pretty smart. It wants to see three beeps, and it activates the control board, which will open the gate. Now, the three ICs I'm using is a CD4538.
That's a dual monostable.
The next IC is a CD4093.
It's a Schmitt trigger NAND gate. And the last chip is a CD4017, and that's what's doing the counting. It counts how many beeps. So, when I do three beeps, it actually detects that, and a LED comes on to open the gate.
Okay, so let's talk about the beep counter for a second. So, here's a simple block diagram. We have a microphone that picks up the horn. So, after three horn beeps, it's going to turn on this LED. So, in the simple circuitry, what could happen?
A car could drive by, and could beep at a dog on the road. So, that's beep number one. 10 minutes later, another car could drive by and beep at a friend.
That's two beeps. And then another 10 minutes go by, and another car drives by and beeps, and that's three beeps, and that will activate the LED. So, we don't want that. So, we create a window, and this window is 5 seconds, and it's controlled by a monostable. So, the first beep will kick up the monostable. So, now you have 5 seconds for the next two beeps. Then then the monostable will will drop down and reset the counter.
So, with this window in here, we won't get the problem of having three beeps counted over a long period of time. It's only within the 5-second window. Now, when designing logic circuits, all you need is a good logic probe for troubleshooting, which you can see here.
But, this probe is from Heathkit. I've had it for a long time. Some of you know what I'm talking about.
So, right now we're going to look at monostable that gives us a window, a 5-second window.
So, I'll beep the horn and you'll see it go high for 5 seconds and then drop down again. So, I'll give it a beep. So, it goes up, goes high.
5 seconds later down. Do it again.
High, it's a window.
Now, when it goes from high to low at the very end it will give a pulse to the 4017 to reset it. So, we can look at that reset pulse.
So, right now it's low.
So, I'll kick it up.
Now, after 5 seconds when it drops down, you'll see a small pulse.
Right there.
Do it again.
Goes up for 5 seconds.
When she comes down it resets the counter.
Okay, here's the full schematic of the circuit that I built on my breadboard.
So, you can freeze it here and go through it yourself. Then I'll go through it section by section.
Okay, next we are going to have a look at the operation of this circuit. So, here's our touch switch which simulates the horn. Every time we touch it, we get a clock into this monostable. Now, this monostable creates our window.
So, she'll kick up for 5 seconds, well actually 4.7 seconds. 470k * 10 microfarad will give us 4.7 seconds. So, she'll go up for 4.7 seconds and come down. As she comes down, we're going to get we're going to get a pulse generated by this circuit here. This is called a half monostable with a 0.1 microfarad capacitor and a 22k ohm resistor which is edge triggered. Now, I'll give us a pulse and that's fed down to reset the 4017.
Now, the 4017, you've probably seen these as LED chasers where you you clock it and you'll see the LED being chased one at a time.
So, when it's reset, pin three will be high.
Pin two, four, seven, and 10 will be low. So, on the first clock pulse, pin two will go high. Second clock pulse, pin four will go high. The third clock pulse, pin seven will go high. So, that's three horn blasts. And if it stays at pin seven long enough for this RC time constant, it's going to trigger this monostable.
And its RC time constant is 100k * 10 microfarad, that gives a 1-second output. So, that's going to drive the relay for the gate.
Now, if we do four pulses, it's going to go 1 2 3 4, and it's going to end up on pin 10, and that's going to feed it's going to feed a high into the clock enable, and that's going to disable the clock. So, once we get a high on pin 10, we could clock this as much as you want, you could honk the horn as long as you want, and all will be locked until we get the reset. Then it goes back to uh pin three going high, ready for the next three clock pulses to operate the gate.
Now, also there's a power-on reset. Now, we need that.
So, this will generate a pulse into the 4017, and it'll reset it on power up. Cuz if you don't have this, the first time you try it, it won't work until it gets the pulse from from the monostable. So, usually when you have a logic like this, you always have a power-on reset with an RC time constant, and that pulses the reset pin on the 4017.
Okay, so that's how you make digital logic circuits act like software.
Now, when I did build these boards, I built my own microphone amplifier that had filters that would be more sensitive to horns, so somebody clapping their hands couldn't activate it. Plus, I put it in a PVC pipe to make it directional.
And I had a timer on it, so it shut off during the night. So, it's only active during working hours.
Now, the last few videos that I have made, they were requests from some of my friends who are students, uh hobbyists, uh members of some of my clubs. And that's how it's going to be from now on.
Cuz before when I made a video, I had to put a disclaimer that it's a beginner's video. Otherwise, people who are advanced would say, "Oh, I already know that. You're wasting my time." Or if it was too advanced, they would complain it's you know, it's over their head.
They don't understand.
So, this way I know if I'm making a video, there's somebody that's going to get something out of it. Now, I notice YouTube is noticing this because there's a lot of electronic channels uh shutting down. A lot of good ones. Some of the ones I've been watching.
So, they've taken away the dislike um uh counter on uh on viewers. And now they're they're taking it away actually on the creators.
But still, I think you can't make everybody happy. So, I think people are burning out and they're shutting down their channels.
So, I'm just saying that uh there might be long intervals between my videos that I'm making for my friends.
Related Videos
U.S. Military Just Flexed The Most Dangerous Aircraft Ever Built The F-47
MaxAfterburnerusa
11K viewsโข2026-05-29
Heating Staying On On The Hottest Day Of The Year
PlumbLikeTom
507 viewsโข2026-05-29
๋ฐ์ ํจ์จ์ ๋์ด๋ ํ์๊ด ์ถ์ ์์คํ ์ ๊ธฐ์ ์ ์๋ฆฌ #๊ณตํ #๊ณต์ #ํ์๊ด #์๊ณ ๋ฆฌ์ฆ #์ฌ์์๋์ง
์ฐํ์ฅ๊ธฐ์
2K viewsโข2026-05-29
์ง๊ด ๋ฐ ๊ณก๊ด ๋ฐฐ๊ด ๊ฒฐํฉ ๊ณ ์ ์์ #worker #process #fabrication #pipework #clamp
์๋์ด์ด
2K viewsโข2026-05-30
Wire To Wire Connection Trick | Strong And Secure Electrical Joint #shortvideo #wireworks
ElectricianTips-b1h
5K viewsโข2026-06-02
Peterborough to Newark Northgate Driver's Eye View aboard an InterCity 225 - East Coast Main Line
TrainsTrainsTrains
822 viewsโข2026-05-31
AI turbine design: hypersonic cooling leap #shorts #ai #hypersonic
bobbby_rn
671 viewsโข2026-05-31
How Far Can A Tomahawk Missile Actually Travel?
WarCurious
13K viewsโข2026-05-28











