Push Button Long press On/Off dual function

sentinels

Joined Jun 30, 2019
12
There is only one transistor in my circuit so what is Q2?
Q2/ is pin12 of U2 ,Q1 is pin1 of U2
Please see the attached circuit in the above post.

Channel 1 yellow is PWR_BTN
Channel 3 Red is Q1
Channel 4 Green is Q2/ STB_CTRL
...............
Sometimes Q2/ can not change status.
If I zoom in the waveform.
I found some glitch on Q1, so STB_CTRL change unnormally.
I do not know why there is glitch on Q1?
Could you help to solve this problem?
Thanks
Best regards
 

ci139

Joined Jul 11, 2016
634
The upload file is some waveform.
Channel 1 yellow is PWR_BTN
Channel 3 Red is Q1
Channel 4 Green is Q2/ STB_CTRL
Sometimes Q2/ can not change status.
If I zoom in the waveform.
I found some glitch on Q1, so STB_CTRL change unnormally.
I do not know why there is glitch on Q1?
? Clock 2 is tied to PWR Button
? Q1 is forced to reset from +5V (Reset1 generates an unpredictable disruption to outp Q1 = Low )
? ↑ is this the circuit you measure ↑ (chk your circuit wiring + logic + relative controls timing)
? What kind of supply (+filter caps near CD4013) and what is the probe

there is no functionality you describe
= provide a correct circuit you measure with scope !!!
 

Attachments

Last edited:

crutschow

Joined Mar 14, 2008
23,153
Do you have a 100nF decoupling capacitor directly across the power to ground pins on the CD4013?
 

crutschow

Joined Mar 14, 2008
23,153
your schematic is somewhat suspicous
Suspicious how?
The CD4013 data sheet shows that with both the PRE and CLR inputs high, Q-out is high, so I don't see that your change for the CLR input makes a difference. :confused:

Also your change to the CLR input for A2 means the it will power up with the output transistor on.
Why did you change that?
what's your simulator
LTspice, as stated in post #2.
 

ci139

Joined Jul 11, 2016
634
Also your change to the CLR input for A2 means the it will power up with the output transistor on.
Why did you change that?
i forgot to change it back after realizing how your thing works

LTspice, as stated in post #2.
i missed you use CD4000.lib ((← i never used that so -- along other stuff it a bit confused initially how you got it to work . . . with your setup))

I don't see that your change for the CLR input makes a difference.
you might be right
______________
however the OP has a slightly different circuit
the cause of output instability is likely the missing 100nF
but it might also be a non std. use of S R by Crutchow . . . (or a speciffic scope & probe used . . .)

((really tired/unmotivated right now :())
 
Last edited:

sentinels

Joined Jun 30, 2019
12
? Clock 2 is tied to PWR Button
? Q1 is forced to reset from +5V (Reset1 generates an unpredictable disruption to outp Q1 = Low )
? ↑ is this the circuit you measure ↑ (chk your circuit wiring + logic + relative controls timing)
? What kind of supply (+filter caps near CD4013) and what is the probe

there is no functionality you describe
= provide a correct circuit you measure with scope !!!
I use TI 4013BM
Attached is the truth table.
My circuit is the same as circuit crutschow provided.
 

Attachments

ci139

Joined Jul 11, 2016
634
i managed to simulate the case . . . but hadn't time yet to track it down (so hold your horses a bit)
Strobe - TEST - XP - 001.png
. . . what we can tell at this point is that the bug is not present at non-inverting outp
so you may Reset your Latch-2 instead of Set and use the non-inverting Q2 outp for control/strobe
____________
it's occuring at rising Clock slope (the trace Vp3 = Clk , Vp4 = ¯Q2 , Vp6 = Q2)
Strobe - TEST - XP - 001 plot.png
the bug is likely inside the logic of the chip ?? (K -- non-inverting OUTP , M -- inverting)
1 Latch of CD4013.gif
_________
? a fix
Strobe - TEST - XP - 001 - New.png
 
Last edited:

sentinels

Joined Jun 30, 2019
12
Q2/ is pin12 of U2 ,Q1 is pin1 of U2
Please see the attached circuit in the above post.

Channel 1 yellow is PWR_BTN
Channel 3 Red is Q1
Channel 4 Green is Q2/ STB_CTRL
...............
Sometimes Q2/ can not change status.
If I zoom in the waveform.
I found some glitch on Q1, so STB_CTRL change unnormally.
I do not know why there is glitch on Q1?
Could you help to solve this problem?
Thanks
Best regards
The problem is Q1 toggle change,so Q2/ also toggle change.
I do not know why this way.
 

crutschow

Joined Mar 14, 2008
23,153
I used 1/2 of the CD4013 FF as a buffer circuit (in a somewhat unconventional configuration) to give a fast rise-time clock pulse to the second toggle FF, without having to add another IC.

But if that circuit is glitching, then two CD40106 Schmitt trigger inverters can be used in series as a substitute, eliminating the chance of generating a glitch (circuit below).

upload_2019-10-9_18-29-44.png
 

eetech00

Joined Jun 8, 2013
1,627
Hello

Here's an alternate circuit. It uses two chips but is flexible. See below.
This uses a Schmitt trigger inverter to clock the CD4013B, so shouldn't be affected by slow RC rise times.
It also use a mosfet at the output to reduce the output current requirement of the CD4013B.

eT

upload_2019-10-9_20-8-28.png

upload_2019-10-9_20-8-54.png
 

sentinels

Joined Jun 30, 2019
12
The capacitor needs to be connected as close as possible to the CD4013 power and ground pins.
Let us know if that helps.
I just go to office now.
My circuit is as attached file.

C7 is capacitor near CD4013B.
I add another capacitor on VDD of CD4013B.
The result is the same.
The channel 1 Yellow is PWRBTN.
The channel3 Red is Q1 of U2.
The channel4 Green is Q2/ of U2.
I have cutoff the Q2/ to other circuits.
So Q2/ can not be affected by other circuits.
The first 2 picture is normal waveform.
When I push the button, Q1 change to high, and Q2/ toggle.
The last 7 pictures is unnormal waveform.
The Q1 toggle unnormally many times.
So Q2/ toggle because of Q1 toggle.
I do not know why Q1 toggle often?????
 

Attachments

sentinels

Joined Jun 30, 2019
12
I just go to office now.
My circuit is as attached file.

C7 is capacitor near CD4013B.
I add another capacitor on VDD of CD4013B.
The result is the same.
The channel 1 Yellow is PWRBTN.
The channel3 Red is Q1 of U2.
The channel4 Green is Q2/ of U2.
I have cutoff the Q2/ to other circuits.
So Q2/ can not be affected by other circuits.
The first 2 picture is normal waveform.
When I push the button, Q1 change to high, and Q2/ toggle.
The last 7 pictures is unnormal waveform.
The Q1 toggle unnormally many times.
So Q2/ toggle because of Q1 toggle.
I do not know why Q1 toggle often?????
I cutoff the second circuit D flip flop of CB4013B.
Only measure the first D flip flop.
Channel 1 Yellow is Q1.
Channel 3 Red is Negative side of D1
Channel4 Green is SET of U2.
The first waveform looks normally.
If I zoom in the waveform.
The last other waveform sometimes looks unnormal.
The Q1 will fall down to 0V ??????
I do not know why Q1 down to 0V.
I do not use the second D flip flop.
Q1 will not be affected by second D flip flop.
Why ?
 

Attachments

ci139

Joined Jul 11, 2016
634
Gave an upvote for #36 -- not because it's essentially correct -- but because you took a stand to more freely came up with your own solution

/// the problem with our help is that we do and find the first thing that may more or less meet your design requirements -- but without knowing the exact details of it -- only you can verify what it is actually to be
_____________________

perhaps ..

Button circuit2 - mod.gif Strobe - TEST - XP - 001-a.gif Strobe - TEST - XP - 001-a - zm.gif
 
Last edited:

sentinels

Joined Jun 30, 2019
12
Gave an upvote for #36 -- not because it's essentially correct -- but because you took a stand to more freely came up with your own solution

/// the problem with our help is that we do and find the first thing that may more or less meet your design requirements -- but without knowing the exact details of it -- only you can verify what it is actually to be
_____________________

perhaps ..

View attachment 187745 View attachment 187744 View attachment 187743
I add schmitt trigger buffer before the pin6 of U2.
It work normally.
Thanks for everyone help.

best regards
 
Top