4093/4011

Thread Starter

ricker24

Joined Mar 5, 2011
53
Hello,
I am building a 2 digit 7 segment counter and the circuit calls for using a 4093 but I tried using a 4011 instead since that is what I had. I am having some trouble getting it to work correctly and was wondering if someone could tell me if the trouble is the 4011. I am going to try to add the link to the circuit so if you want to see it you can. Thanks...By the way I really do not need this to count down if that helps...

http://roznerd.blogspot.com/2009/12/2-digit-7-segment-updown-counter.html
 

elec_mech

Joined Nov 12, 2008
1,500
Hmm, the schematic isn't terribly efficient.

I'm not sure if it is easier to attempt to fix the schematic or just post a new one.

Both the 4011 and 4093 and NAND gates. The difference is the 4093 has a Schmitt trigger which is ideal for debouncing switches.

First, let's start with what you want to accomplish. You said you don't need it to count down, so does that mean you only need it to count up?

Next, do you need to preset it, i.e., start counting from some value other than zero?

If the answer is no, then you could save some wiring by using a CD40110 which combines the function of the 4029 and 4511 into a single chip. If you already have these two and want to stick with them, no problem.

Refering to the original schematic, you can connect pins 3 and 4 directly to +5VDC and leave off resistors R16, R17, R22, and R23 on IC4 and IC5.

You can leave off R31-R38 and connect S4 and S5 directly to +5VDC.

If you do not need to preset the values, you can leave off the DIP switches S4 & S5, all four resistors bundled by R19, and R27-R32. Then connect pins 3, 4, 12, & 13 directly to GND on IC2 and IC3.

If you only need to count up, connect pin 10 directly to +5VDC on both IC2 and IC3.

If you want to count both up and down, connect pin 10 on both IC2 and IC3 together, then add a 10kΩ resistor between pin 10 from either IC and GND. Add a SPST toggle switch between pin 10 from either IC and +5VDC. When the switch is on, the circuit will count up. When off, it will count down. No need to debounce this switch.

The 4029's in the schematic are wired as ripple counting. I suggest parallel counting as it is a little easier to wire and follow and works well:

Connect pin 15 from IC2 and IC3 together. Connect pin 7 from IC3 to pin 5 of IC2. Connect pin 5 of IC3 to GND. Leave pin 7 of IC2 unconnected. IC3 will output to IC5 and this will be your ones place. IC2 will output to IC4 and will be your tens place.

Look at the last diagram on this site on how to debounce a switch with a 4093, a capacitor, and a resistor: http://www.all-electric.com/schematic/debounce.htm. Do this and connect the output of the 4093 to pin 15 on both IC2 and IC3 (or just one if you've already connected them together). Use a momentary N.O. push button switch for the input. This is the clock switch.

If you plan to use the preset feature, connect pin 1 from IC2 and IC3 together. Make another debounce circuit using the 4093 and connect the output to pin 1 of either IC2 or IC3. Again, use a momentary N.O. push button switch for the input. This is the preset switch.

If you don't plan to use the preset, connect pin 1 from both IC2 and IC3 to GND.

Pushing the clock switch will advance the count by one (assuming you're counting up).

Pushing the preset switch will force the display to show whatever value you have set S4 and S5 to. Pushing the clock switch will then advance the displayed value by one. If you only ever need to reset the display to zero, connect pins 3, 4, 12, & 13 to GND and add the preset switch with the debounce. When you press the preset switch, the display will go to 00.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Thanks for your reply. I would like to just go ahead and use the IC's that I have since I have an abundance of them. Would be willing to purchase the 4093 if necessary. Will try what you have suggested and see what happens. I guess I should have been a little more specific. I just need it to start at zero and count up as high as 21 and then be able to re-set to zero again. It would be great if you could post a new schematic that would correct any problems that you have seen. Thanks again...
 
Last edited:

elec_mech

Joined Nov 12, 2008
1,500
No problem. In that case, definitely connect pins 3, 4, 12, and 13 to GND on both IC2 and IC2. Add a switch with debounce to pin 1 on IC2 and connect pin 1 on both IC2 and IC3.

I'll see if I have time to make a new schematic. Let us know if you run into any problems.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Ok. I made the mods that you suggested but now when I put power to the circuit both seven seg's come on at 00 but I can not get it to count from there. Push count button and it stays 00. I have checked it and I am pretty sure that I have it wired right but may be missing something. I have not de-bounced the switch yet but it should still count, right? Thanks.
 

elec_mech

Joined Nov 12, 2008
1,500
Yes, it should still count without the debounce, but the displayed value may appear to "jump" to a random number instead of just incrementing by one.

Okay, if it is stuck on 00 there are a few things to look at.

Hopefully you have a multimeter. If so, set it to VDC , put the black probe to GND and the red probe on pin 15 of either IC2 or IC3.

What is the voltage when the no buttons are pressed?

What is the voltage when the CLOCK button is pressed? Hold down while you take the measurement.

If the voltage doesn't change from 0V to 5V, the switch isn't hooked up properly.

Assuming that is good, check pin 1 on both IC2 and IC3. Again, black probe to GND, red probe to pin 1 of either IC.

What is the voltage when no buttons are pressed? Should be 0V. If not, the preset is locked forcing the display to show 0. Connect pin 1 directly to GND.

What is the voltage when the PRESET button is pressed? Should be 5V.

Put the black probe to GND and the red probe to pin 5 on IC4 and then on IC5. Voltage should be 0V for each IC. If not, the 4511 has the latch enabled meaning it will ignore input from the 4029.

I almost forgot. Since these are CMOS ICs, be sure to add a 0.1uF ceramic capacitor across Vcc and GND of each and every IC as close to the power pins as reasonably possible. CMOS ICs are prone to making noise and this will affect other ICs. The capacitor helps negate this.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Hello,
Will try these things and get back to you. I have made a rough draft of what I have now so if you can take a look and see if you see anything wrong. Thanks.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
Your new circuit still does not use a 4093 Schmitt trigger NAND so its debouncing will probably be intermittent. It is also missing an RC.

Why don't you use the proper parts?? Oh, you live on Mars where ordinary electronic parts are hard to find? Then do gardening instead of electronics.

Edit: The missing RC uses the R to make the input of the NAND gate low when the switch is opened. Your circuit has NOTHING to make the input low.

The output of the 5V regulator has two completely useless 10k resistors to ground.

The 5V regulator is missing the very important input and output capacitors that are shown in its datasheet.
 
Last edited:

Thread Starter

ricker24

Joined Mar 5, 2011
53
Pin 15 IC 2 and 3 -4.95 volts no buttons pushed. Pin 15 IC 2 and 3 -count button held 0 volts.
Pin 1 IC 2 and 3 - 0 volts no buttons pushed. Pin 1 IC 2 and 3 - Reset button pushed 4.95 volts.
Pin 5 IC 4 -0.010 volts Pin 5 IC 5 -0.017 volts

All testing done with my Fluke 179 multimeter.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Audioguru,
I am fairly new to electronics. I am sorry to bother anyone but I just thought this was a place where I could come to for help in learning. I know I am not using the 4093 and my very first question was do I need to get one? No one said that the parts that I was using would not work or I would get one. And by the way I actually do also grow a great garden every year...
 

tracecom

Joined Apr 16, 2010
3,944
I just thought this was a place where I could come to for help in learning.
It is, and you are welcome.

I, too, am trying to learn. Don't be discouraged; there are lots of nice people here, and lots of knowledgeable people. There are even many who are nice AND knowledgeable.
 

Audioguru

Joined Dec 20, 2007
11,248
Then why don't you use the required 4093??
Do you water your garden with acid? Why not because it looks like water. A 4011 looks like a 4093 but they are different.
 

Audioguru

Joined Dec 20, 2007
11,248
I am nice, SOMETIMES.
I am knowlegeble most of the time.
But I am fed up with all the millions of little kids who know NOTHING about the basics of electronics who message me and come here. They should have their own website.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Yes but I did not message anyone or ask any specific help from any one person. I am by no means a little kid but you are right that I do not know much about electronics. I just posted for some help. I have the circuit counting up now but it is just not counting without jumping numbers yet. I will figure it out eventually and all help is really appreciated. Also thank you tracecom and elec_mech.
 

elec_mech

Joined Nov 12, 2008
1,500
Some of us are a little more, ah, abrupt in our responses. Don't let that discourage you. We each have our own style, level of knowledge and approach to problem-solving as well as how we communicate to others. Some responses will jive with you, some may not. Just remember we are all here to help one another.

Hmm, the voltage is off on the clock input when the count button is pressed. I think the problem stems from the wiring of the 4011.

I've modified your schematic (good job by the way) with some additions and corrections in red:

  • Since you want to count up, pin 9 on IC2 and IC3 should go to 5VDC, not GND.
  • Filtering caps added to all ICs.
  • Filtering caps added to the voltage regulator per the Fairchild datasheet.
  • CD4011 eliminated; S2 connected directly to pin 15 on IC2 and IC3 along with pull down resistor R3.
  • Debounce circuit shown when you're ready.
Since you are using CMOS ICs, you could leave off the regulator as long as your input voltage is 15VDC or less. If you opt to do this, you will need to change your LED resistor values and I'd add an electrolytic capacitor across the power supply + and GND inputs, something in the range of 10-25uF or so. Let us know if you decide to leave off the regulator and we'll walk you through how to calculate the correct resistor value to use.

The schematic looks good, especially being hand-drawn. Just some pointers for the future:
  • Use dots to show where two or more lines are connected in the circuit. No need for a dot where a single line makes a 90 degree turn.
  • Place ground symbols facing downward.
  • Place power symbols facing upward.
  • Label all parts with designators, e.g., R1, C1, etc. In this way, someone can tell you R25 should be changed or moved, instead of "the resistor in the left corner under the second IC".
  • If using momentary push button switches, drawn them as shown in the debounce circuit I included. The ones shown in yours are drawn as toggle or rocker switches which latch when pushed.
Keep in mind this is advice for the future, I'm not criticizing your schematic - it is detailed and clear to read which is what matters most.
 

Attachments

tracecom

Joined Apr 16, 2010
3,944
Elec-mech is right; your schematic looks good for being hand drawn, but you might want to consider a software aid.

There are several packages available for drawing schematics, some of which have free versions with certain limitations. One of those is DipTrace, which I tried for free and then bought; I use it exclusively. You can download a non-profit version for free at diptrace.com.
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Thanks elec_mech,
Looked at my breadboard and I actually had pin 10 on IC 2 and 3 to +5 but forgot to show it on the schematic. I am powering this with a 9 volt battery. I would like to get rid of the 7805. I cheat on figuring resistor size with an automatic online calculator and if I entered info right it looks like I could use 680 ohm with out the 7805, is this correct? The 7 segs that I am using are TOS 5161AE-B. I will try this the way you show it and let you know. I have 4093's ordered to complete the debounce circuit. Will try to be more detailed and clear if I post another but just done a quick draft to show you what I had. Thanks again and I will let you know...
 

Thread Starter

ricker24

Joined Mar 5, 2011
53
Thanks tracecom,
I will check this out. It sounds great because it took me a while to do the rough draft that I did and it was pretty rough...lol.
 

elec_mech

Joined Nov 12, 2008
1,500
Let's do the math to be safe - this will also help you in the future.

Looking at the datasheet (http://www.es.co.th/schemetic/pdf/TOS-5161AE-B.pdf), the typical forward voltage is 2.1V and the recommended current through each segment is 12mA.

You have a 9V supply, but the LEDs need 2.1V. So we need to select a resistor that will take up the difference. Simply put:

V_resistor = V_supply - V_LED

V_resistor = 9 - 2.1 = 6.9V

So we need the resistor to take up 6.9V. Now we need to size the resistor. Back to Ohm's Law: E = IR

6.9 = 0.012 x R
R = 575Ω

This is not a common resistor value, but 560Ω and 620Ω are and either will be close enough.

A 680Ω resistor will work fine, your LEDs may appear just a touch dimmer.

You also want to make sure you pick the right wattage resistor:

Power = Voltage x Current => P = EI

Thus, P = 6.9 x 0.015 = 0.1035 Watts (using 15mA for a little play).

You typically want to use a resistor with a wattage rating twice or more than what you need so the resistor doesn't get too hot or pushed to its limits.

2 x 0.1035 = 0.207W

A typical resistor often used is 1/4W or 0.25W. Since 0.25W > 0.027W, this will work just fine.
 

Audioguru

Joined Dec 20, 2007
11,248
the ICs are Cmos that work perfectly if the supply is as high as 18V so you do not need a voltage regulator and you do not need to reduce the supply voltage.

The datasheet for the CD4511 LED driver shows that its output high is not to the supply voltage but is about 1V less than the supply voltage so calculate the current-limiting resistors with that in mind.
 
Top