Maker Pro
Maker Pro

Push button controlled LED decade counter ...

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
Hi. I'm a hobbyist who should be considered a "noob" with limited understanding of small electronics circuitry projects. I'd like to make (or have made for me) a decade counter (4017 based, I think), with the lighting of each LED in the sequence of 10 manually controlled by push button, rather than the internal clock of the 4017 chip.

It would also be nice if a second line of 5 LEDs could be added to move from one LED to the next as each decade in the first sequence is completed and returns to LED No. 1. Can anyone out there offer any help/instructions on how that might be done? Many thanks!
 

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
A CD4017 does not have an internal clock oscillator. A pushbutton, a resistor and a capacitor can cause it to sequence with each push if the pushbutton is debounced. Output #1 on the first CD4017 can be the clock for the second CD4017.
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
A CD4017 does not have an internal clock oscillator. A pushbutton, a resistor and a capacitor can cause it to sequence with each push if the pushbutton is debounced. Output #1 on the first CD4017 can be the clock for the second CD4017.

Thank you very much. So: 1) do I correctly understand that the "clk" pin on the 4017 is merely an input for whatever device/means is used to regulate speed of the LED sequence; 2) I'm afraid I don't know how one goes about "debouncing" inputs; and 3) LED Out No. 1 on the first 4017 would be linked to "clk" on a second 4017 with only 5 LEDs/outs? If you could direct me to some kind of illustration or schematic, that'd be wonderful ...
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
http://www.talkingelectronics.com/te_interactive_index.html

Time for you to do some reading.
Plenty in above link.

You're right. There is "plenty" there ... if I was interested in becoming an electronics engineer. I remember doing a few projects with IC's like the 4017 in HS electronics shop, and I don't think this project is any more difficult than any of those. That was just a very long time ago, and I need a little help on how to put this particular one together. Thanks.
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
A CD4017 does not have an internal clock oscillator. A pushbutton, a resistor and a capacitor can cause it to sequence with each push if the pushbutton is debounced. Output #1 on the first CD4017 can be the clock for the second CD4017.

OK, Audioguru ... I found this breadboard schematic GIF, which appears to do everything I want as a decade counter. Based on your description, then, all I'd have to do to get a second line of 5 LEDs that light in order as each decade is completed and reset to Q0 (1st LED) is connect the Q0/3 output on the first IC to the CLK input on the second, using the Q0, Q1, Q2, Q3 and Q4 on the second IC to power the second line of 5 LEDs ... is that right? I would "debounce" both momentary switches if needed ... based on this schematic and power level, can you suggest a proper capacitor/resistor combination for this purpose?
 

Attachments

  • cmos-4017-sequential_-timer.gif
    cmos-4017-sequential_-timer.gif
    611.8 KB · Views: 239
Last edited:

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
OK, Audioguru ... I found this breadboard schematic GIF, which appears to do everything I want as a decade counter. Based on your description, then, all I'd have to do to get a second line of 5 LEDs that light in order as each decade is completed and reset to Q0 (1st LED) is connect the Q0/3 output on the first IC to the CLK input on the second, using the Q0, Q1, Q2, Q3 and Q4 on the second IC to power the second line of 5 LEDs ... is that right? I would "debounce" both momentary switches if needed ... based on this schematic and power level, can you suggest a proper capacitor/resistor combination for this purpose?

OK, for anyone who's interested, I've now done a breadboard prototype of the GIF schematic above, and confirmed that it works. It also recycles to LED No. 1 after going through the whole sequence, without any need for a reset button/switch. The reset switch is only necessary if you want to be able to return to No. 1 before the decade sequence is completed. You should also note that the momentary switches I used were ordinary, mini-PCB buttons. They're pretty reliable without "debouncing," but I did get a few "skips" in the course of my testing. For more reliable sequencing, the switches should be "debounced," as suggested by Audioguru.

Thank you, Geekdom ... I'm out.
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
A CD4017 does not have an internal clock oscillator. A pushbutton, a resistor and a capacitor can cause it to sequence with each push if the pushbutton is debounced. Output #1 on the first CD4017 can be the clock for the second CD4017.

Final P.S. ... I originally responded to this post by asking, among other things, what resistor/capacitor combination would be a good fit with the power level/configuration in the diagrammed device. The PCB buttton switches worked "OK" without "debouncing" the switches (some occasional, single skips). In the end, however, I need to be able to operate these switches from the Boss FS-5U momentary/passive footswitch, fed into the circuit board from a 1/4" mono instrument cable jack. When I tried that, the "skipping" became MUCH worse (big jumps of 2-3 LEDs). Since I got no reply to the resistor/capacitor question, I noted that the (-) side of the momentary switches already has a 100 ohm resistor on it, so I tried adding a 10uF capacitor across the (-) and (+) connections on the opposite sides of each switch, and ... PRESTO ... the Boss switches are now apparently "debounced," and work like a charm ... no skips at all! Couldn't be happier with the result.
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
Final P.P.S. On getting a second line of 5 LEDs that advances one space every time the first sequence returns to No. 1, I could not get Audioguru's suggestion to work right/consistently (i.e., using No. 1 LED out (Q0, pin 3) on first 4017 as "clock" on second 4017). What DID work was connecting the CARRY OUT pin (12) on the first 4017 to the CLOCK pin (14) on the second. I then moved the reset part of the circuit from the first 4017 to the second, so that I can use a second footswitch to reset/return that counter to No. 1 without having to tap through the first sequence an additional 5 times (or, 50 taps on the switch). End result is perfect.

Here's a second GIF which shows the first 4017 circuit without a reset. On the second 4017, just use the reset pin instead of CLK (remember, second 4017 is getting its CLK (14) signal from CARRY OUT (12) on the first 4017), and you're all set. The two IC's/circuits will even share the same power supply with no problems.
 

Attachments

  • 4017-decade-counter-circuit_0.gif
    4017-decade-counter-circuit_0.gif
    367 KB · Views: 99

AnalogKid

Jun 10, 2015
2,925
Joined
Jun 10, 2015
Messages
2,925
1. You can increase the value of the 1K resistor to 10K to save a little battery current.

2. The reason using a 4017 stage output to clock another 4017 did not work is that the LED resistors (220 ohms) are too small, demanding too much output current. Read the 4017 datasheet to see the recommended maximum source current for an output. It is WAY less than 32 mA. While the output is sourcing enough current to make an LED visible, the output voltage is not going high enough to clock reliably the next 4017's input stage. To confirm this and learn something about CMOS devices, change the LED resistors to 1K and see if things work better.

Something to consider - since only one LED is on at any given time, you do not need a current limiting resistor for each LED. Connect the anode of each LED directly to a 4017 output, connect all LED cathodes together, and place one resistor between the cathode group connection and GND.

ak
 

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
If you use only one current-limiting resistor for all the LEDs to use then when the supply is 9V all of the LEDs receive a reverse voltage higher than their max allowed reverse voltage of only 5V.
 

AnalogKid

Jun 10, 2015
2,925
Joined
Jun 10, 2015
Messages
2,925
Given the voltage drop in the 4017 output stage at 5-10 mA, I don't think the diodes are in any danger. As I recall, low cost red LEDs avalanche at around -6 to -8 V, and there will be fewer than 7 V available.

However, it is a good point that would be a real issue at 12 V.

ak
 

The Old Sage

Apr 14, 2018
8
Joined
Apr 14, 2018
Messages
8
1. You can increase the value of the 1K resistor to 10K to save a little battery current.

2. The reason using a 4017 stage output to clock another 4017 did not work is that the LED resistors (220 ohms) are too small, demanding too much output current. Read the 4017 datasheet to see the recommended maximum source current for an output. It is WAY less than 32 mA. While the output is sourcing enough current to make an LED visible, the output voltage is not going high enough to clock reliably the next 4017's input stage. To confirm this and learn something about CMOS devices, change the LED resistors to 1K and see if things work better.

Something to consider - since only one LED is on at any given time, you do not need a current limiting resistor for each LED. Connect the anode of each LED directly to a 4017 output, connect all LED cathodes together, and place one resistor between the cathode group connection and GND.

ak

Thanks, but I wasn't trying to re-engineer the basic "Johnson counter" circuit shown in the GIFs. I was just trying to add a second IC to it, and get it to work as described/needed (i.e., advance one LED upon completion of the decade sequence on the first IC). Audioguru's suggestion of running the Q0 (Pin 3) output of the first IC to CLK (Pin 14) on the second IC didn't work for that purpose. Don't really care WHY it didn't work. Running the "CARRY OUT" (Pin 12) on the first IC to CLK (Pin 14) on the second IC DID work ... perfectly ... with no need for modification of the basic circuit.

I'm using a standard 9V battery, which is well within mfr's spec'd voltage range for the 4017. The LEDs are plenty bright with the 2.2K resistors shown in the GIFs, and I don't mind having dedicated resistors on each LED pin out ... they became an easy, logical fit on my circuit board design, and help to easily ID the orientation of the outputs on the IC's. It's all good now, and as the old saying goes, "if it ain't broke, don't fix it."

Thanks for all the input/suggestions ...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
However, it is a good point that would be a real issue at 12 V.

If I were doing it, I would consider the limit closer to 9V based on an assumption of 2V fwd drop and 7V reverse breakdown. For my own work I don't do it where Vcc > breakdown voltage, but that's very conservative. Sure, the load on the output affects things, but I'd hate to have a design that kills LEDs if someone decides to increase the series resistance!
 
Top