IC 4017 output modification

Thread Starter

mongkon

Joined Apr 8, 2024
1
Normally working with 3 output LED,
when press button in first time LED1 on LED2 and LED3 off
,then released button in first time LED1 still on LED2 and LED3 still off.
When press button in secend time LED1 off LED2 on LED3 off
,then released button in secend time LED1 still off LED2 still on LED3 still off.
When press button in third time LED1 off LED2 off LED3 on
,then released button in third time LED1 still off LED2 still offLED3 still on.

This function i make it working ok.

But i want to modification output to this function.
when press button in first time LED1 on LED2 and LED3 off
,then released button in first time all LED off
When press button in secend time LED1 off LED2 on LED3 off
,then released button in secend time all LED off
When press button in third time LED1 off LED2 off LED3 on
,then released button in third time all LED off

How can i do with ic4017 or i have to use another ic. thank you
 

k1ng 1337

Joined Sep 11, 2020
986
Hi, adding an AND gate to each of the CD4017 outputs will do what you want.

The other input for the gate comes from the push button switch you are using to pulse the clock.

Do you know how to implement this?
 

ThePanMan

Joined Mar 13, 2020
800
Welcome to AAC.
adding an AND gate to each of the CD4017 outputs will do what you want.
Yes. But using a single Buffer Inverter can do the same thing.
If I'm reading you correctly.
I'm reading it that way too.

Using a Buffer Inverter gate can provide ground for all LED's.
4017 output 0 goes high when first turned on or reset. LED 1 will be on.
UNLESS:
You don't use output 0. If you use output 1 then LED 1 will remain off until you clock the 4017. Output 4 is connected to the reset pin

Press the button:
Out 1 high, Inverter out Low (when the button is pressed) LED 1 lit, 2 & 3 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 2 high, inverter out Low (when the button is pressed) LED 2 lit, 1 & 3 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 3 high, Inverter out Low (when the button is pressed) LED 3 lit, 1 & 2 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 4 goes high, 4017 resets and output 0 goes high but nothing connected, LED's 1, 2 & 3 not lit.

Instead of using an inverter you can use a single NPN transistor as a load follower. Each time the button is pressed the NPN turns on and provides pathway to ground for all LED's.
 
Last edited:

k1ng 1337

Joined Sep 11, 2020
986
Welcome to AAC.
Yes. But using a single Buffer Inverter can do the same thing.
I'm reading it that way too.

Using a Buffer Inverter gate can provide ground for all LED's.
4017 output 0 goes high when first turned on or reset. LED 1 will be on.
UNLESS:
You don't use output 0. If you use output 1 then LED 1 will remain off until you clock the 4017. Output 4 is connected to the reset pin

Press the button:
Out 1 high, Inverter out Low (when the button is pressed) LED 1 lit, 2 & 3 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 2 high, inverter out Low (when the button is pressed) LED 2 lit, 1 & 3 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 3 high, Inverter out Low (when the button is pressed) LED 3 lit, 1 & 2 not
Release the button, Inverter out High, all LED's off

Press the button:
Out 4 goes high, 4017 resets and output 0 goes high but nothing connected, LED's 1, 2 & 3 not lit.

Instead of using an inverter you can use a single NPN transistor as a load follower. Each time the button is pressed the NPN turns on and provides pathway to ground for all LED's.
I think we are suggesting a similar solution but with a different topology.

The AND gates I'm talking about can be made by feeding the 4017 output into the collector of a BJT and the base from the button switch. He has 3 LEDs so he only needs 3 BJTs to realize 3 AND circuits.

I am a bit confused by your description, how about we each present a schematic and go from there?
 
Last edited:

ThePanMan

Joined Mar 13, 2020
800
Using an AND gate and a BJT is superfluous. You won't need the AND gate. A NAND or an Inverter Buffer can do the same job as an AND gate and BJT. Better still, just a BJT to provide ground pathway (see below) will do even better. Just bias the transistor properly and you are good to go.
Instead of using an inverter you can use a single NPN transistor as a load follower.
Screenshot 2024-04-08 at 9.18.56 AM.png
Could have drawn this better. And outputs 0, and 5 through 9 can be left open.
 

eetech00

Joined Jun 8, 2013
4,004
Normally working with 3 output LED,
when press button in first time LED1 on LED2 and LED3 off
,then released button in first time LED1 still on LED2 and LED3 still off.
When press button in secend time LED1 off LED2 on LED3 off
,then released button in secend time LED1 still off LED2 still on LED3 still off.
When press button in third time LED1 off LED2 off LED3 on
,then released button in third time LED1 still off LED2 still offLED3 still on.

This function i make it working ok.

But i want to modification output to this function.
when press button in first time LED1 on LED2 and LED3 off
,then released button in first time all LED off
When press button in secend time LED1 off LED2 on LED3 off
,then released button in secend time all LED off
When press button in third time LED1 off LED2 off LED3 on
,then released button in third time all LED off

How can i do with ic4017 or i have to use another ic. thank you
What is the supply voltage?
 

k1ng 1337

Joined Sep 11, 2020
986
Using an AND gate and a BJT is superfluous. You won't need the AND gate. A NAND or an Inverter Buffer can do the same job as an AND gate and BJT. Better still, just a BJT to provide ground pathway (see below) will do even better. Just bias the transistor properly and you are good to go.

View attachment 319444
Could have drawn this better. And outputs 0, and 5 through 9 can be left open.
Haha nice. Here I was thinking the LEDs were not diodes! I see now you are ORing Q1-3 then ANDing the result.
 

k1ng 1337

Joined Sep 11, 2020
986
If I recall correctly, CD4017 latches the outputs on the rising edge on the clock. Pan's circuit beats mine for component count but the LEDs in my circuit can be replaced with another load.


Untitled.png

Note: CLK should be debounced.
 
Last edited:

eetech00

Joined Jun 8, 2013
4,004
This is not bench tested, but the way I understand the TS spec, I think will work.
All LEDs are low current type (less than 5mA). The supply is 9V. PB is momentary N.O.
If more output current is needed, an NMOS transistor can be added to each output to drive each LED.

1712594670444.png

1712594762122.png
 

ThePanMan

Joined Mar 13, 2020
800
Q0, LED 1 will be lit when Q0 is energized and SW1 is depressed. That is to say when Q4 goes high the system will reset and LED 1 will come on for the duration of the time S1 is held closed. So you'll always have one LED lit when SW 1 is depressed.

@eetech00's solution has an off period between each clock. I don't think that's what the TS wants.

My circuit has with each clock pulse:
LED's off
LED 1
LED 2
LED 3
Counter Reset

Upon energizing LED's are off until the first clock. You always know where you're starting.
 

eetech00

Joined Jun 8, 2013
4,004
[QUOTE="ThePanMan, post: 1901853, member: 687097"
@eetech00's solution has an off period between each clock. I don't think that's what the TS wants.
[/QUOTE]

Well, if you read this carefully:

But i want to modification output to this function.
when press button in first time LED1 on LED2 and LED3 off
,then released button in first time all LED off
When press button in secend time LED1 off LED2 on LED3 off
,then released button in secend time all LED off
When press button in third time LED1 off LED2 off LED3 on
,then released button in third time all LED off

How can i do with ic4017 or i have to use another ic. thank you
there should be an "all off" time between "on" times.

The circuit in post #11 does what the TS is asking.
We'll need to wait till the TS replies to see if it should be different.
 

AnalogKid

Joined Aug 1, 2013
11,130
You guys are working waaaaay too hard. Since the initial function is "working ok", there is no need to change the 4017-to-LED circuitry, whatever it is, to answer the question.

Change the clock input to the 4017 EN- input. Now the 4017 increments on the negative clock edge.
The LEDs were all grounded, with the 4017 supplying positive voltage. Run the LED cathodes through a SPST switch to GND, and run the clock through the same switch.

I posted of this in 2019. Here is the updated schematic.

Update: Change C1 to 47 uF.

LED-Stepper-8-c.gif

ak
 
Last edited:

eetech00

Joined Jun 8, 2013
4,004
You guys are working waaaaay too hard. Since the initial function is "working ok", there is no need to change the 4017-to-LED circuitry, whatever it is, to answer the question.

Change the clock input to the 4017 EN- input. Now the 4017 increments on the negative clock edge.
The LEDs were all grounded, with the 4017 supplying positive voltage. Run the LED cathodes through a SPST switch to GND, and run the clock through the same switch.

I posted of this in 2019. Here is the updated schematic.

Update: I might have to add one transistor . . .

View attachment 319521

ak
I think the TS already has a circuit that can do what this circuit attempts to do.
 

k1ng 1337

Joined Sep 11, 2020
986
I think the TS already has a circuit that can do what this circuit attempts to do.
I don't think so. TS' description implies EN was grounded the whole time.

AK's circuit turns on the LEDs while the switch is closed then increments the clock when the switch opens.

Clever circuit but a bit complex. Now TS has many ways to realize his dreams!
 

eetech00

Joined Jun 8, 2013
4,004
I don't think so. TS' description implies EN was grounded the whole time.
I guess I'm missing how is that implied in the TS description(?)
Oh..nevermind.

AK's circuit turns on the LEDs while the switch is closed then increments the clock when the switch opens.
Clever circuit but a bit complex. Now TS has many ways to realize his dreams!
Maybe. On power up, all is good, no LEDs on, because no ground connection. But it looks like the first time the button is pressed, LED1 immediately lights, U1 is clocked, then LED2 lights, and the operators finger is still on the button...
 

ElectricSpidey

Joined Dec 2, 2017
2,830
AK's circuit turns on the LEDs while the switch is closed then increments the clock when the switch opens.
No, AK's circuit advances on the push of the button.
eetech00's circuit advances on the lift of the button.

AK's circuit pulls the ground from the LEDs when the switch is open.
eetech's circuit works by advancing to an open output.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,130
AK's circuit turns on the LEDs while the switch is closed then increments the clock when the switch opens.
Nope. If the 4017 CLK input is tied high, the EN- input becomes a negative-edge clock input. Pressing the button does two things, complete the power circuit for the LEDs and increment the counter.

But it looks like the first time the button is pressed, LED1 immediately lights, U1 is clocked, then LED2 lights, and the operators finger is still on the button...
Correct. LED1 illuminates for less than 1 microsecond.

ak
 

k1ng 1337

Joined Sep 11, 2020
986
Nope. If the 4017 CLK input is tied high, the EN- input becomes a negative-edge clock input. Pressing the button does two things, complete the power circuit for the LEDs and increment the counter.



Correct. LED1 illuminates for less than 1 microsecond.

ak
You are correct but it took a while to figure out why. Can you explain the operation? Also, a value of 1uF seems more appropriate for C1.
 
Top