# Two Digit, 7-Segment, Up/Down Counter

#### elec_mech

Joined Nov 12, 2008
1,500
Hi All,

I've been working on responding to a reader request in Nuts & Volts for a 2-digit, 7-Segment counter. Attached is my, to date, complete, working schematic. Thanks to help from many members on this forum, I have a working model. I can submit this as is, but the engineer in me wonders if I can make some things simpler, reduce the parts count, etc. - all in all, make it more efficient. It works, so I really shouldn't beat a dead horse, but I'd like to ask a few questions and see if anyone has any additional constructive criticism.

1. There is a second attachment labeled Figures 1-4. Figure one is a circuit for making a momentary switch a power toggle switch. My implementation is in figure two. I'm using a 3V signal from a remote circuit, so I've used a MOSFET in place of the momentary switch. I've tried using a simple PNP and NPN transistor in place of the MOSFET to no avail. I originally wanted to use a T flip flop which sounds like it would do the same thing with less parts, but I had no joy making a dual D flip flop work as a T. Could a T flip flop work in place of this circuit?

2. Figures 3 and 4 show a CD4093 used to convert a 3V signal into a 5V signal and add debounce. Works really well, it just seems to be parts intensive. Is there a better way to do this?

3. Lastly, I'm planning to attempt to power the whole circuit with 12V since everything is CMOS and rated up to 15VDC, sans the remote circuit. This would allow me to get rid of the 5V regulator. Will update schematic if this works.

Any other suggestions or advice is greatly appreciated. Hoping others will be able to use this circuit for future projects.

#### Attachments

• 104 KB Views: 473
• 112.6 KB Views: 278

#### SgtWookie

Joined Jul 17, 2007
22,210
Well, if you really wanted to make it simple (reduced parts count), you could replace just about everything except the 5v regulator, the LEDs and LED drivers and current limiting resistors with a microcontroller.

You have the 5v to 3v LM317 circuit drawn rather oddly; apparently the ADJ pin is on the left side of your symbol, OUT on the bottom and IN on the right. The standard way to draw these regulators is with IN on the left, ADJ on the bottom and OUT on the right. You've drawn the 7805 regulator correctly, although it's typical to draw capacitors vertically where possible.

The UDN2982 8-channel source drivers have built-in resistors for the inputs; this makes the fourteen 100 Ohm resistors unnecessary.

You're running GND everywhere, with a single ground symbol at the bottom of the schematic. The extra wires running everywhere make it more difficult to read the schematic. It's typical to use a ground symbol right where a connection to ground is needed to eliminate long runs of ground wires.

Are your 555 timers CMOS? Operating at that low of a voltage, they really should be. The transistorized 555 timers don't work really well at low voltages; you lose about 1.3v from pin 3 no matter what your Vcc is, but at 5v, you're down to around 3.7v at pin 3 max.

I don't know why you have the 100k pull-down resistor on pin 4 of the upper 555 (Flashing Circuit) - as pin 4 should normally be connected to Vcc. If anything it should be a pull-up resistor. You also have 10k pull-down resistors in the up and down count 555 pulse generators; they should be pull-up resistors instead.

In your Figures 4-1 pdf, it looks like you exported a Cadsoft Eagle schematic in .jpg format. Did you know that you can export in .png format, and your schematic won't suffer from becoming "lossy" like what happens with .jpg images?

Even easier, rather than exporting images from Eagle, I frequently simply do screen prints (Ctrl or Alt+PrintScreen) and then paste the buffer into MS Paint, crop to suit, and save as a .png file.

#### elec_mech

Joined Nov 12, 2008
1,500
Hi SgtWookie,

Well, if you really wanted to make it simple (reduced parts count), you could replace just about everything except the 5v regulator, the LEDs and LED drivers and current limiting resistors with a microcontroller.
Very true and I have more experience with microcontroller projects, but I made an assumption the person requesting this didn't want to get into microcontrollers and coding, so I went with a purely hardware solution.

You have the 5v to 3v LM317 circuit drawn rather oddly; apparently the ADJ pin is on the left side of your symbol, OUT on the bottom and IN on the right. The standard way to draw these regulators is with IN on the left, ADJ on the bottom and OUT on the right. You've drawn the 7805 regulator correctly, although it's typical to draw capacitors vertically where possible.
Ah, excellent! I'm always looking to better my schematic layout skills. See revised schematic.

The UDN2982 8-channel source drivers have built-in resistors for the inputs; this makes the fourteen 100 Ohm resistors unnecessary.
That eliminates a lot, thank you!

You're running GND everywhere, with a single ground symbol at the bottom of the schematic. The extra wires running everywhere make it more difficult to read the schematic. It's typical to use a ground symbol right where a connection to ground is needed to eliminate long runs of ground wires.
That makes sense. See revised schematic. I hope this helps.

Are your 555 timers CMOS? Operating at that low of a voltage, they really should be. The transistorized 555 timers don't work really well at low voltages; you lose about 1.3v from pin 3 no matter what your Vcc is, but at 5v, you're down to around 3.7v at pin 3 max.
These are NE555, standard 555 timers. Datasheets say these can accept 4.5 to 16V. I found 7555 timers which called out as CMOS and accept 3 to 16V and consume less current. I haven't had a problem with the output of these triggering the CD40110 or the 2N2907, but raising the voltage sounds like it would only help.

I don't know why you have the 100k pull-down resistor on pin 4 of the upper 555 (Flashing Circuit) - as pin 4 should normally be connected to Vcc. If anything it should be a pull-up resistor. You also have 10k pull-down resistors in the up and down count 555 pulse generators; they should be pull-up resistors instead.
Ah, allow me to explain. I need the 555's off most of the time, otherwise they'll trigger the CD40110 and flash the LEDs continiously. I originally tied pin 4 high, kept the grounds grounded and supplied 5V to each 555 circuit via the CD4093. This seemed to work, but the CD4093 cannot supply a lot of power and while I know the 555's aren't consuming too much, Audioguru suggested I keep the reset pins pulled low, effectively turning the 555's off until I need them. Now, if I replace these with 7555, they cosume a lot less power and I should then be able to safely power them directly with the CD4093. I'm open to ideas if there is a better way to control when the 555's kick on. Also, I should make the resistor values all the same. I've changed them so they are all 100kΩ.

The Cadsoft Eagle image is copied from the internet. I haven't tried getting into making PCBs yet, so I'm sticking with Visio for making schematics and breadboards for prototyping.

Thanks again!

#### Attachments

• 103.7 KB Views: 138

#### SgtWookie

Joined Jul 17, 2007
22,210
Well, I guess you still didn't quite understand what I was saying about the LM317.

Here's what I mean - your circuit on the right, corrected on the left:

[eta]
The way you had shown the wiring, the regulator would have acted as a constant current regulator - not at all what you wanted.

These are NE555, standard 555 timers. Datasheets say these can accept 4.5 to 16V. I found 7555 timers which called out as CMOS and accept 3 to 16V and consume less current. I haven't had a problem with the output of these triggering the CD40110 or the 2N2907, but raising the voltage sounds like it would only help.
When you're running 4000-series CMOS IC's, you can get into problems with the "indeterminate region"; that is the area somewhere between GND and Vdd that is not clearly a logic 1 or 0. If you are using bjt (transistorized) 555 timers, the 1.3v dropout on pin 3 doesn't matter much if you are operating from 12v, but becomes far more significant on 5v. However, the CMOS 555 timers have rather poor current sourcing ability (10mA vs the bjt's 200mA).

You do not show the mandatory 0.1uF and 1+uF bypass caps across each 555's power supply pins.

#### Attachments

• 14.1 KB Views: 476
Last edited:

#### elec_mech

Joined Nov 12, 2008
1,500
SgtWookie,

My apologizes, I just flipped it around and made the capacitor vertical but didn't look at the rest. Thank you!

#### Attachments

• 103.8 KB Views: 137
Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,210
OK, that's better.

#### elec_mech

Joined Nov 12, 2008
1,500
Hi SgtWookie,

I've added the capacitors to all 555 timers. Please forgive the newbie question, and I understand capacitors are used at the input and output of voltage regulators to take out spikes and noise, but are they used for the same for the 555 IC's?

When do you know capacitors are mandatory for some ICs and not for others?

Does the small capacitor take out short, quick spikes and the bigger one handle larger spikes or big surges of current due to the load or does each serve a different purpose?

#### Attachments

• 104.9 KB Views: 150

#### Wendy

Joined Mar 24, 2008
21,929
The idea of bypass capacitors is to kill the noise where it is generated. When digital circuits switch there is internal noise generated, which is fed out the power pins. Caps at the power pins try to suppress this.

Just curious, have you ever looked at the 40192? It is an up/down BCD counter with presettable inputs. To make it count up or down you have a high or low on the Up/Down input, you do not need two signal sources.

#### elec_mech

Joined Nov 12, 2008
1,500
Hi Bill,

Thank you for the information. I never fail to learn something new. I didn't know digital chips generated noise, makes sense though.

Yes, I've investigated the CD40192 and several others and I see what you mean - I could eliminate one of the 555 counters. Unfortunately, that would force me to use two CD4511s to convert BCD to 7-segment. However, I may still be able to use just one counter and control which pin receives the signal with a transistor or two. Excellent suggestion, I'll look into this and get back.

Thank you for the suggestion!

I have found a nice, simple T-type flip flop circuit with few parts, so I'll give that a shot and post my results as well.

#### SgtWookie

Joined Jul 17, 2007
22,210
Digital IC's generate broadband noise. An ideal square wave is composed of the fundamental frequency, plus ALL of the odd harmonics of the fundamental frequency. That implies unlimited bandwidth, which is not yet possible.

Any length of wiring has inductance; the longer the wiring, the greater the inductance. Inductance will wreak havoc with digital signals. It also mucks with supply and ground lines.
Large electrolytic capacitors take care of low-frequency transients, but due to the internal parasitics, aren't especially great at removing high-frequency transients. Small 0.1uF capacitors are used as close as possible to the supply pins to remove most of the high-frequency transients.

#### elec_mech

Joined Nov 12, 2008
1,500
I gave the T flip flop another shot last night (now that I learned one must connect the S and R inputs to ground) and it worked! Less parts!

I found a mention for adding a resistor-capacitor to keep the Set (S) pin to CD4013 tied such that the flasher is kept off at start-up. I did test it and it does work, but I feel dumb because I don't know how or why this works. I'm not sure what function the diode serves either.

According to the datasheet, if R is low and S is high, with no clock signal (I assume this is true at start-up), Q, the output should go high which would enable the flashing circuit, but it keeps it off. If I connect the resistor-capacitor to pin 4, reset, and ground S the flasher always comes on - if R is high and S is low, the datasheet says Q should be 0, so the flasher should be off. If I leave off the resistor-capacitor and connect both S and R to ground, sometimes the flasher comes on at start-up and sometimes it doesn't. Any enlightenment is appreciated.

I came up with a circuit to eliminate one of the pulse counters, but the parts count is more than just using the second 555 pulsing circuit. I haven't tested this, but I posted it with the schematic in case it helps someone or someone sees a better way of doing this.

Oh, should I add a 0.1uF ceramic capacitor across the power pins of EVERY IC or just the 555s? Same question about 1uF electrolytic.

Does it make much difference using a cermaric, mylar, or electrolytic capacitor, for filtering purposes, interchangeably for the same value? For instance, I'm using 1uF mylar capacitors in my circuit, but SgtWookie mentioned using electrolytic.

You really don't know how precious little you know until you start applying what you think you knew. I am humbled by my lack of knowledge, but encouraged and thankful for yours as well as your time and assistance. Thank you everyone!

#### Attachments

• 106.7 KB Views: 118

#### SgtWookie

Joined Jul 17, 2007
22,210
I gave the T flip flop another shot last night (now that I learned one must connect the S and R inputs to ground) and it worked! Less parts!
This type of thing is usually explained in the datasheets that are available for the IC. Some manufacturers' datasheets are better than others. Philips/NXP's are pretty good. Many of Texas Instruments' datasheets for the digital versions are scans of very old datasheets, and can be difficult to read. OnSemi/Motorola datasheets are pretty good.

I found a mention for adding a resistor-capacitor to keep the Set (S) pin to CD4013 tied such that the flasher is kept off at start-up. I did test it and it does work, but I feel dumb because I don't know how or why this works. I'm not sure what function the diode serves either.
The capacitor pulls the Set pin high momentarily on power up, and the resistor charges the capacitor (or else the flip flop would be "stuck"). The diode keeps the voltage on the cap from going beneath the ground rail when the power is turned off.

According to the datasheet, if R is low and S is high, with no clock signal (I assume this is true at start-up), Q, the output should go high which would enable the flashing circuit, but it keeps it off. If I connect the resistor-capacitor to pin 4, reset, and ground S the flasher always comes on - if R is high and S is low, the datasheet says Q should be 0, so the flasher should be off. If I leave off the resistor-capacitor and connect both S and R to ground, sometimes the flasher comes on at start-up and sometimes it doesn't. Any enlightenment is appreciated.
Try looking at another manufacturers' datasheet. Philips/NXP 4000 series use an HEF prefix (HEF4013b, etc) Motorola/OnSemi uses a MC1 prefix.

Oh, should I add a 0.1uF ceramic capacitor across the power pins of EVERY IC or just the 555s? Same question about 1uF electrolytic.
The 555's each require a 0.1uF ceramic or metal poly film cap along with a 1uF or larger electrolytic. The rest just need the 0.1uF cap.

Does it make much difference using a cermaric, mylar, or electrolytic capacitor, for filtering purposes, interchangeably for the same value? For instance, I'm using 1uF mylar capacitors in my circuit, but SgtWookie mentioned using electrolytic.
I usually use ceramic or metal poly film 0.1uF caps. Mylars work well, too.
Use electrolytic caps for larger values of capacitance.

You really don't know how precious little you know until you start applying what you think you knew. I am humbled by my lack of knowledge, but encouraged and thankful for yours as well as your time and assistance. Thank you everyone![/QUOTE]

Keep at it.

#### elec_mech

Joined Nov 12, 2008
1,500
Thank you SgtWookie! I'll probably add a few capacitors, test, and update my schematic. I think it's finally coming to a close. Thank you so much! I've learned a lot from this project.

#### elec_mech

Joined Nov 12, 2008
1,500
Alright, I've successfully powered the whole circuit, sans the 3V remote circuit, from 12VDC, eliminating the need for the 5V regulator and related components.

Attached is the final schematic, successfully tested and working on a breadboard. I kindly ask for any constructive criticism in the next day or two before I submit this to Nuts & Volts. If anyone notices any faux pas (such as not having an additional filter capacitor at the supply voltage terminals - should there be and what value(s) would you recommend?), please let me know.

#### Attachments

• 111.1 KB Views: 404

Joined Jul 4, 2013
28
Hello elec_mech, been surfing around the web and got your project right here in this forum. I've seen the circuit that you made and I just want to ask where is the circuit for the RC Module? is it a simple RC circuit?

#### elec_mech

Joined Nov 12, 2008
1,500
Welcome to AAC.

I simply took it from a cheap RC toy. There is a link in the PDF but here is it as well. If you're in the U.S. Walmart and Target sell these for $9-$10USD.

I'm currently helping another member with a similar circuit here. The auto repeat and flashing isn't being used, but I've changed the digits to common anode so the more commonly available ULN2004 can be used in place of the now obsolete UDN2982. Additionally, the OP on this post is using an inexpensive RF module from eBay which gets a much farther range than the toy.

Joined Jul 4, 2013
28
Elec_mech

Can i ask for your email? Honestly, I was impressed in your design but that is why I am using it now as my project. But now I am having some trouble around the circuit, so I have a lot of questions to this circuitry, I have downloaded your design and gain all electronics but don't know where and how I did my mistake

#### elec_mech

Joined Nov 12, 2008
1,500
Christian,

Please start a new thread and let us know what you've done so far, what problems you've encountered, and post a couple of clear pictures of your circuit. You'll get a lot more help a lot sooner and this allows others to learn as well.

Joined Jul 4, 2013
28
Elec_mech

Thank you, i just did what's on your circuitry. I am saying it is now 90% assembled because i am missing the controller, starting from the "Count down/up from RC circuit" what should i connect with those two? Also, is their any replacement for the RC module, like if you don't want it to be wireless (i don't have any RC module for now, but i have an RC toy car and i think i can disassemble the RC module there for this circuit)

Last edited:

#### elec_mech

Joined Nov 12, 2008
1,500
Ah, how about using momentary normally open (N.O.) push buttons in place of the RC module? See circuit below.

#### Attachments

• 32.7 KB Views: 44