Post Top Ad

Saturday, May 25, 2024

I'm Counting Objects and People using circuit 4026!


 I'm Counting Objects and People using circuit 4026! 

It's pretty easy to build circuits with a microcontroller but we totally forget the tons of work that a microcontroller had to go through to complete a simple task (even for blinking an LED). So, how hard would it be to make a digital clock completely from scratch? No coding and no microcontroller and to make it real HARDCORE how about build the circuit in a perf-board without using any printed circuit boards.


This is really a challenging project to do, not because of how the clock logic works but because of how we are going to build the circuit with all these components together on a compact perf-board.


This project was inspired by this instructable (author: hp07) back in 2018, which would be insanely hard to build on a perf-board because of the number of connections and the components used. So, I did a bit of digging online to reduce the complexity but still make it fairly basic and difficult to build on a perf-board.

First, we have to understand the answer to a few questions before we can jump into building this digital clock! how are we going to keep track of time and how can we define time itself?


The solution to this problem is quite simple (If you think of yourself as a rebellious teenager and just pretend over a century physicists never scratched there head about it). The way we are going to approach this solution might be counter-intuitive, where first we'll see how we can keep track of time and then later define time.


But we are missing a major point here, When should we increment this counter value? Let's take a look into simple physics definition

"The second is defined by taking the fixed numerical value of the cesium frequency ∆ν, the unperturbed ground-state hyperfine transition frequency of the cesium 133 atom, to be 9 192 631 770 when expressed in the unit Hz, which is equal to s −1."


If you understood the definition, you should probably take theoretical physics and quit electronics!


Anyway, for simplicity, we'll just assume it's the time taken for a cesium atom to vibrate 9 billion times. Now when you increment the counter every one second or time is taken for a cesium atom to vibrate 9 billion times you got yourself a clock-sort-of-thing! To this, if we could just add logic in such a way that seconds carry over to minutes and minutes carry over to hours when they reach 60 (and hours reset on 24). This will give us a fully functional clock that we are expecting.


Now, let's see how we can bring theory into reality, with some magic of pure electronics!

Let's first figure out the way to display the number (or time). The 7-segment displays should be perfect for this build because it gives a retro look, and it is also one of the simplest display that's available on the market, it's so simple that it's just made of 7 LEDs (8 LEDs, if the point LED, was counted in) placed in a clever way to show alphanumeric values that can be placed in adjacent with multiple 7-segment displays to show a larger value.


There are 2 varieties of these 7 segment displays.


COMMON CATHODE: All the -ve terminal of the led is connected to a common point, and then this common point is connected to the ground (GND). Now, to turn on any part of the segment a +ve voltage is applied to the corresponding +ve pin of that segment.


CATHODE ANODE: All the +ve terminal of the led is connected to a common point, and then this common point is connected to the VCC. Now, to turn on any part of the segment a -ve voltage is applied to the corresponding -ve pin of that segment.


For our application, we'll be using the common cathode version of the 7-segment display, because the digital IC which we'll be using will output HIGH signal (+ve signal).

Each segment of this display is named from A to G in a clockwise direction and the dot (or point) on the display is marked as 'p', remember the segments with their corresponding alphabets, which will be handy while connecting it to the digital IC's.


This step is going to be a bit tricky because finding the exact size of the perf-board is quite difficult and you might not find one. If that's the case you can combine 2 perf-board to make a larger one.


Placing the 7-segment display is quite simple, just place the display evenly with right spacing so you can differentiate the seconds, minutes, and hours (refer the image for the placement of the led).


If you noticed by now I'm using a bunch of 100ohm resistors for each pin of the display, this is totally for aesthetics and it's not necessary to use these many resistors. If you can place a 470ohm resistor between the common pin of the 7-segment display and the ground that should be good enough. (These resistors are used to limit the rent that's going to go through the LED)


Since this circuit has a lot to solder and to make sure not to lose track of what I'm doing, I soldered the 7-segment display pins in an alphabetical sequence to the resistors and the ground to the top of the circuit. It seems useless and complicated, but trust me this will make your job way easier.


While building this circuit I found a cool trick about the 7 segment display, anytime by mistake if you have inverted the 7 segment display upside down, you don't have to desolder the display completely and resolder again. Every pin will remain the same except for the G pin and the P pin, just by adding a simple jumper wire you can fix the problem. (Check the last 2 images where I have used a green jumper wire to demonstrate this problem).

In step-1 we talked about how we can keep track of time using counters and that's exactly how we are going to implement in this step using electronics.


If you want to know more in-depth about the counter and how it works, You should check out this instructable. Here I'm just going to focus only on how we are going to use one and complete this circuit.


There is more than one way to implement this counter in digital electronics. If you're completely insane and have pretty much got nothing to do in your life build six 7-Segment counter completely from scratch just by using transistors. Since you don't even have time to check out my Youtube-channel and subscribe, we'll just stick on to the moderately complicated circuit where we'll use the pre-built IC.

IC 4026. A 7 segment display counter. It counts the number of clock pulse or the number of turn ON and turn OFF cycle on pin 1 and display's the decimal value from 0-9 on the 7-segment display.


The circuit for this counter is very simple, just connect the A, B, C, D, E, F, G pins of the 7-segment display to pin 10, 12, 13, 9, 11, 6, 7, 8 of the IC 4026 and to test this circuit you can use a switch between the pin 1 and +5v just like the circuit diagram. With this switch, we can manually increment the counter from 0-9.

If you can build one counter successfully which can count from 0-9, then the rest of the circuit is just replicating the exact same 4026 circuits 5 more times. But doing this there will be few changes to the clock, reset, and the carry out (CO) pin of the IC.


To make things simpler first, focus on building the connection between the seven-segment display and the seven segment counter, try to use fewer wires as possible to avoid messier connections and difficult to debug later on. So, use single strand copper wire to make tracks/connections between the IC and display. Finally, connect the VCC and ground to the power rail which is running between the resistors and below the IC (You can see the circuit diagram doesn't match much with the clock which I have done because the resistors which are in series is totally unnecessary and it is just for aesthetic, just replace one 470ohm resistor on the cathode side of the 7-segment display).

When it comes to digital circuits there are only 2 states HIGH or LOW (Binary: 0 or 1). This we can relate with a switch, when the switch is ON we can say it's a logic HIGH and when the switch is turned OFF we can say it's logic LOW. If you can turn ON and turn OFF the switch with a consistent timing between ON and OFF you can generate a square wave signal.


Now the time taken to create both and high and low signals together is called Time Period. If you can turn ON the switch for 0.5sec and turn OFF the switch for 0.5sec, then the time period of this signal will be 1second. Likewise, the number of times the switch turns ON and turns OFF in a second is called Frequency.

This might seem not much use at first, but this timing of signal is very necessary to keep everything in sync in digital circuits, that's the reason some digital circuits with clock signals are also called synchronous circuits.


The concept here is still pretty vague because we need the time taken for a cesium atom to vibrate 9 billion times (as we saw in step-1) because that's what will give us one second. This kind of precision using our circuit will be close to impossible but we can do better if we can use an oscilloscope (Where the time is pre-calibrated) to give an approximation of one second.

There are numerous ways to build a clock pulse generator. But here are a few reasons why I used the 555 timer IC and a few reasons why you shouldn't.


Advantage


The circuit is very simple (Beginner friendly)

Requires a very small footprint

Easy to adjust the clock frequency

Can have a wide range of voltage (Not necessary for our digital clock circuit)



At this point, it was completely useless to take pictures after each circuit, as the circuits get very complicated with lots of wires going around in different directions. So, just build the clock circuit separately without worrying about the rest of the circuit, and once that's done, just connect the output(pin 3) of 555 timer IC to the clock pin of IC 4026.

With the previous step we are 3/4th done with the circuit, now's it's just about figuring out how to reset the counter when it reaches 60 and 24.


The solution is simple to figure out if the clock reaches 60, consider the 2nd seven segment display of the and observe the segment E, F, G. This 3 segment will light up only when it reaches 6 or greater than 6. So, with this, we can figure out when our seconds will reach 60. Likewise, we can take the hours part of the circuit, Here segment D, E of the one 7-segment display and segment F of the other display light up only when it's 24 or greater than 24 (with this similar logic you can figure out for 12hr).


To use this as a condition we'll use a 3 input AND gate. So whenever we detect the 3 segments of the display light up, the AND gate will output a HIGH signal further we can use this high signal to reset one counter and increase the next counter. Coincidently with just one single IC[7411], we can add this logic for hours, minutes, and seconds.

It might be really hard figuring out which wire is connecting where, but it's a simpler way if you know the logic and just follow the circuit diagram. The diode in the circuit is used to separate the 40xx(CMOS) series IC and 74xx(TTL) series IC and the 10k resistor act as a pull-down resistor for the reset(PIN 15) and the clock(PIN 1).


Place the IC between exactly in between the board where it is as clock circuit on one side and the other is left for the buttons to adjust the time.

ng of multiple signals is the most common problem faced when we use push buttons. When you press the button once, multiple pulses will be generated because of the mechanical spring action inside the push button. This will cause a lot of problems when you try to adjust the time! When you try to set for 5, because of multiple triggers the counter may overshoot to 6-7.


This is pretty easy to solve and the circuit used to remove this bouncing effect is called a de-bouncing circuit, but in my circuit, I have definitely overcomplicated things by using a Schmitt trigger IC[7414] and a bunch of other components. So I have updated the circuit which can easily solve this bouncing effect just by using an RC network.


There is more than one way to remove the debouncing effect, you can select the one which is easy for you.

The pushbuttons are connected to the clock pin of hours and minutes and the diode is added between the reset pin of the previous IC and the current IC's clock pin to avoid reset of minutes or seconds when the pushbutton is pressed.


To remove the bouncing effort, it is a lot easier to use an RC network which is made of 10k resistor and 1uf capacitor as shown in the circuit. This will filter out the multiple triggers caused by the pushbutton, which we talked about in the previous step.


Then to finish the complete circuit, just add a female DC jack to the positive and ground rail on the perf board, which will take 5v 1amp from a DC adapter. Getting an electronics project into production would be nightmare. To ease you into the production world we have developed a platform (PCB CUPID) for PCB enthusiasts and hobbyists to ask and answer questions related to PCB design, fabrication, and assembly.


In addition to the Q&A feature, this website also has a wealth of blog posts and useful resources to help you learn about developing and manufacturing printed circuit boards. Whether you're a beginner looking for a crash course on PCB basics, or an experienced designer looking for tips and tricks, you'll find something of value on the site


So head on over and check it out, and don't forget to participate in the Q&A community to get help and share your own knowledge. Less of final thoughts and more of an apology, even though on the front of the clock might be good looking to a few it's a total blunder on the other side. In my defense I will tell a few things, this project was done almost 3 years ago and this was the most complicated project that I worked back then so I was learning many things on the go. Secondly, I was very poor at soldering and mechanical work back then. If I redo this right now, I can improve a lot.


But, I really wanna know from you, what changes/improvements can be added to this and how you can make this a better one so leave a comment about your ideas.


For starters, it's really not necessary to cramp in all the IC in a single board. You can use 2 boards, one for just driving the display and the other one just for the logic and clock generator. Use a better and precise clock pulse generator and also can make a great looking case, which makes the whole project aesthetically attractive.


 I'm Counting Objects and People using circuit 4026! 

It's pretty easy to build circuits with a microcontroller but we totally forget the tons of work that a microcontroller had to go through to complete a simple task (even for blinking an LED). So, how hard would it be to make a digital clock completely from scratch? No coding and no microcontroller and to make it real HARDCORE how about build the circuit in a perf-board without using any printed circuit boards.


This is really a challenging project to do, not because of how the clock logic works but because of how we are going to build the circuit with all these components together on a compact perf-board.


This project was inspired by this instructable (author: hp07) back in 2018, which would be insanely hard to build on a perf-board because of the number of connections and the components used. So, I did a bit of digging online to reduce the complexity but still make it fairly basic and difficult to build on a perf-board.

First, we have to understand the answer to a few questions before we can jump into building this digital clock! how are we going to keep track of time and how can we define time itself?


The solution to this problem is quite simple (If you think of yourself as a rebellious teenager and just pretend over a century physicists never scratched there head about it). The way we are going to approach this solution might be counter-intuitive, where first we'll see how we can keep track of time and then later define time.


But we are missing a major point here, When should we increment this counter value? Let's take a look into simple physics definition

"The second is defined by taking the fixed numerical value of the cesium frequency ∆ν, the unperturbed ground-state hyperfine transition frequency of the cesium 133 atom, to be 9 192 631 770 when expressed in the unit Hz, which is equal to s −1."


If you understood the definition, you should probably take theoretical physics and quit electronics!


Anyway, for simplicity, we'll just assume it's the time taken for a cesium atom to vibrate 9 billion times. Now when you increment the counter every one second or time is taken for a cesium atom to vibrate 9 billion times you got yourself a clock-sort-of-thing! To this, if we could just add logic in such a way that seconds carry over to minutes and minutes carry over to hours when they reach 60 (and hours reset on 24). This will give us a fully functional clock that we are expecting.


Now, let's see how we can bring theory into reality, with some magic of pure electronics!

Let's first figure out the way to display the number (or time). The 7-segment displays should be perfect for this build because it gives a retro look, and it is also one of the simplest display that's available on the market, it's so simple that it's just made of 7 LEDs (8 LEDs, if the point LED, was counted in) placed in a clever way to show alphanumeric values that can be placed in adjacent with multiple 7-segment displays to show a larger value.


There are 2 varieties of these 7 segment displays.


COMMON CATHODE: All the -ve terminal of the led is connected to a common point, and then this common point is connected to the ground (GND). Now, to turn on any part of the segment a +ve voltage is applied to the corresponding +ve pin of that segment.


CATHODE ANODE: All the +ve terminal of the led is connected to a common point, and then this common point is connected to the VCC. Now, to turn on any part of the segment a -ve voltage is applied to the corresponding -ve pin of that segment.


For our application, we'll be using the common cathode version of the 7-segment display, because the digital IC which we'll be using will output HIGH signal (+ve signal).

Each segment of this display is named from A to G in a clockwise direction and the dot (or point) on the display is marked as 'p', remember the segments with their corresponding alphabets, which will be handy while connecting it to the digital IC's.


This step is going to be a bit tricky because finding the exact size of the perf-board is quite difficult and you might not find one. If that's the case you can combine 2 perf-board to make a larger one.


Placing the 7-segment display is quite simple, just place the display evenly with right spacing so you can differentiate the seconds, minutes, and hours (refer the image for the placement of the led).


If you noticed by now I'm using a bunch of 100ohm resistors for each pin of the display, this is totally for aesthetics and it's not necessary to use these many resistors. If you can place a 470ohm resistor between the common pin of the 7-segment display and the ground that should be good enough. (These resistors are used to limit the rent that's going to go through the LED)


Since this circuit has a lot to solder and to make sure not to lose track of what I'm doing, I soldered the 7-segment display pins in an alphabetical sequence to the resistors and the ground to the top of the circuit. It seems useless and complicated, but trust me this will make your job way easier.


While building this circuit I found a cool trick about the 7 segment display, anytime by mistake if you have inverted the 7 segment display upside down, you don't have to desolder the display completely and resolder again. Every pin will remain the same except for the G pin and the P pin, just by adding a simple jumper wire you can fix the problem. (Check the last 2 images where I have used a green jumper wire to demonstrate this problem).

In step-1 we talked about how we can keep track of time using counters and that's exactly how we are going to implement in this step using electronics.


If you want to know more in-depth about the counter and how it works, You should check out this instructable. Here I'm just going to focus only on how we are going to use one and complete this circuit.


There is more than one way to implement this counter in digital electronics. If you're completely insane and have pretty much got nothing to do in your life build six 7-Segment counter completely from scratch just by using transistors. Since you don't even have time to check out my Youtube-channel and subscribe, we'll just stick on to the moderately complicated circuit where we'll use the pre-built IC.

IC 4026. A 7 segment display counter. It counts the number of clock pulse or the number of turn ON and turn OFF cycle on pin 1 and display's the decimal value from 0-9 on the 7-segment display.


The circuit for this counter is very simple, just connect the A, B, C, D, E, F, G pins of the 7-segment display to pin 10, 12, 13, 9, 11, 6, 7, 8 of the IC 4026 and to test this circuit you can use a switch between the pin 1 and +5v just like the circuit diagram. With this switch, we can manually increment the counter from 0-9.

If you can build one counter successfully which can count from 0-9, then the rest of the circuit is just replicating the exact same 4026 circuits 5 more times. But doing this there will be few changes to the clock, reset, and the carry out (CO) pin of the IC.


To make things simpler first, focus on building the connection between the seven-segment display and the seven segment counter, try to use fewer wires as possible to avoid messier connections and difficult to debug later on. So, use single strand copper wire to make tracks/connections between the IC and display. Finally, connect the VCC and ground to the power rail which is running between the resistors and below the IC (You can see the circuit diagram doesn't match much with the clock which I have done because the resistors which are in series is totally unnecessary and it is just for aesthetic, just replace one 470ohm resistor on the cathode side of the 7-segment display).

When it comes to digital circuits there are only 2 states HIGH or LOW (Binary: 0 or 1). This we can relate with a switch, when the switch is ON we can say it's a logic HIGH and when the switch is turned OFF we can say it's logic LOW. If you can turn ON and turn OFF the switch with a consistent timing between ON and OFF you can generate a square wave signal.


Now the time taken to create both and high and low signals together is called Time Period. If you can turn ON the switch for 0.5sec and turn OFF the switch for 0.5sec, then the time period of this signal will be 1second. Likewise, the number of times the switch turns ON and turns OFF in a second is called Frequency.

This might seem not much use at first, but this timing of signal is very necessary to keep everything in sync in digital circuits, that's the reason some digital circuits with clock signals are also called synchronous circuits.


The concept here is still pretty vague because we need the time taken for a cesium atom to vibrate 9 billion times (as we saw in step-1) because that's what will give us one second. This kind of precision using our circuit will be close to impossible but we can do better if we can use an oscilloscope (Where the time is pre-calibrated) to give an approximation of one second.

There are numerous ways to build a clock pulse generator. But here are a few reasons why I used the 555 timer IC and a few reasons why you shouldn't.


Advantage


The circuit is very simple (Beginner friendly)

Requires a very small footprint

Easy to adjust the clock frequency

Can have a wide range of voltage (Not necessary for our digital clock circuit)



At this point, it was completely useless to take pictures after each circuit, as the circuits get very complicated with lots of wires going around in different directions. So, just build the clock circuit separately without worrying about the rest of the circuit, and once that's done, just connect the output(pin 3) of 555 timer IC to the clock pin of IC 4026.

With the previous step we are 3/4th done with the circuit, now's it's just about figuring out how to reset the counter when it reaches 60 and 24.


The solution is simple to figure out if the clock reaches 60, consider the 2nd seven segment display of the and observe the segment E, F, G. This 3 segment will light up only when it reaches 6 or greater than 6. So, with this, we can figure out when our seconds will reach 60. Likewise, we can take the hours part of the circuit, Here segment D, E of the one 7-segment display and segment F of the other display light up only when it's 24 or greater than 24 (with this similar logic you can figure out for 12hr).


To use this as a condition we'll use a 3 input AND gate. So whenever we detect the 3 segments of the display light up, the AND gate will output a HIGH signal further we can use this high signal to reset one counter and increase the next counter. Coincidently with just one single IC[7411], we can add this logic for hours, minutes, and seconds.

It might be really hard figuring out which wire is connecting where, but it's a simpler way if you know the logic and just follow the circuit diagram. The diode in the circuit is used to separate the 40xx(CMOS) series IC and 74xx(TTL) series IC and the 10k resistor act as a pull-down resistor for the reset(PIN 15) and the clock(PIN 1).


Place the IC between exactly in between the board where it is as clock circuit on one side and the other is left for the buttons to adjust the time.

ng of multiple signals is the most common problem faced when we use push buttons. When you press the button once, multiple pulses will be generated because of the mechanical spring action inside the push button. This will cause a lot of problems when you try to adjust the time! When you try to set for 5, because of multiple triggers the counter may overshoot to 6-7.


This is pretty easy to solve and the circuit used to remove this bouncing effect is called a de-bouncing circuit, but in my circuit, I have definitely overcomplicated things by using a Schmitt trigger IC[7414] and a bunch of other components. So I have updated the circuit which can easily solve this bouncing effect just by using an RC network.


There is more than one way to remove the debouncing effect, you can select the one which is easy for you.

The pushbuttons are connected to the clock pin of hours and minutes and the diode is added between the reset pin of the previous IC and the current IC's clock pin to avoid reset of minutes or seconds when the pushbutton is pressed.


To remove the bouncing effort, it is a lot easier to use an RC network which is made of 10k resistor and 1uf capacitor as shown in the circuit. This will filter out the multiple triggers caused by the pushbutton, which we talked about in the previous step.


Then to finish the complete circuit, just add a female DC jack to the positive and ground rail on the perf board, which will take 5v 1amp from a DC adapter. Getting an electronics project into production would be nightmare. To ease you into the production world we have developed a platform (PCB CUPID) for PCB enthusiasts and hobbyists to ask and answer questions related to PCB design, fabrication, and assembly.


In addition to the Q&A feature, this website also has a wealth of blog posts and useful resources to help you learn about developing and manufacturing printed circuit boards. Whether you're a beginner looking for a crash course on PCB basics, or an experienced designer looking for tips and tricks, you'll find something of value on the site


So head on over and check it out, and don't forget to participate in the Q&A community to get help and share your own knowledge. Less of final thoughts and more of an apology, even though on the front of the clock might be good looking to a few it's a total blunder on the other side. In my defense I will tell a few things, this project was done almost 3 years ago and this was the most complicated project that I worked back then so I was learning many things on the go. Secondly, I was very poor at soldering and mechanical work back then. If I redo this right now, I can improve a lot.


But, I really wanna know from you, what changes/improvements can be added to this and how you can make this a better one so leave a comment about your ideas.


For starters, it's really not necessary to cramp in all the IC in a single board. You can use 2 boards, one for just driving the display and the other one just for the logic and clock generator. Use a better and precise clock pulse generator and also can make a great looking case, which makes the whole project aesthetically attractive.

No comments:

Post a Comment

Post Top Ad

Pages