De-bounce circuit not working as expected

Discussion in 'Digital Circuit Design' started by recklessrog, Jun 13, 2018.

  1. ebp

    Well-Known Member

    Feb 8, 2018
    2,018
    708
    Try putting the capacitor right at the clock input to the ff rather than on the other board.

    Try adding a ceramic decoupling cap right across the top of the the ff that doesn't work.

    By far the best solution that does not rely an a specific manufacturer's part to work correctly is to buy some CD4093 schmitt trigger NAND gates (or other STs) and use them to assure a clean clock. Because the 93 and most other STs are inverting, the switch would need to be arranged to discharge a cap that is pulled up through a resistor to Vdd. If I were to keep only one 4000 series part on hand it would be the 4093.

    [EDIT]: Schmitt trigger inverters or gates are also very useful if you need a clock and can accept rather sloppy tolerance. The only parts you need other than the ST are one resistor and one capacitor.
     
    Last edited: Jun 14, 2018
  2. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,045
    1,994
    In your original schematic, that is what R1 is for. Unfortunately, the diode is installed backwards so it bypasses the resistor during the current spike, exactly when it shouldn't. If you are concerned about switch contact life, increase R1 to 2.2K and delete the diode. It is a tradeoff, because the larger R1 is, the more switch bounce ripple it lets through to the IC.

    ak
     
    recklessrog likes this.
  3. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    That's revealing, yes the p/b's are N/O. Measured directly on the the clock pin with the 1k resistor or the 10k, the voltage is 0.00v
    on operating the push button, the voltage goes to 10 v. release P/B with the 1k resistor, the voltage drops very quickly to 0V and the flip flop changes state ok. With the 10k the clock pin is hung up for much longer and the flip flop reverts to original state. I lowered the capacitor to 470pf with 10k and it changes state correctly.
    When I get a moment, I will fire up the scope and give you the actual times. (got my granddaughter here at the moment)
     
  4. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    Ok. C1 100nf, R1 10k fall time is 4.8 ms. with R1 1k, fall time is 0.8 ms. I will try the other suggestions.
     
    Last edited: Jun 14, 2018
  5. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    Sorry folks, been leading you up the garden path, From the original circuit I should have been saying R2, so in all posts where I said R1, should be R2.
    I have two downloads of the same circuit from different sources and the one I have in front of me Shows the 10k resistor as R1 hence confusing the situation. The 470 ohm is not changed.
     
  6. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    I tried both suggestions with no change. Yes I will order the CD4093's
     
  7. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    I have now tried the original circuit, and the one Eric Gibbs posted. Using HEF4027's, both circuits work fine when the supply is 5 volts but when working at 10 volts, the resistor in both circuits marked R2 has to be lowered to 1k to prevent the flip flop reverting state as the button is released.
    When I tried using other 4027's, like the RCA 4027AE and CD4027be, there is no problem with either circuit as drawn.
    I have tried putting the capacitor right on the clock pin, tried different values, reversing the diode, removing the diode, used different switches, put a resistor in series with the switch, all with no success.
    The only thing that works is to change R2 to 1k.
    Looking at other sources, I have seen that several guitar effects pedals use this ic at 9 volts with R2 10k, so I think there is something internally different with the HEF4027 causing the problem.
    Here is the original circuit again. and the one from Eric.


    upload_2018-6-14_21-47-15.png
    [​IMG]
     
  8. eetech00

    Senior Member

    Jun 8, 2013
    1,168
    240
    HI

    Here is another option, but requires two non-supply wires to the button. The output will toggle with each press of a momentary, NO, push button
    I've shown it with VDD =12v but should work with VDD from 5 to 12v.
    The sim shows three simulation runs, one with a good switch (20mS bounce) and the remaining with increasingly bad switches showing more contact bounce. The graph on Sim run three shows the output begin to bounce. I've used CD40106B Schmitt inverters but they could easily be CD4093B Schmitt NAND gates

    Anyway...just another option.

    AltActionPB.png
     
    recklessrog likes this.
  9. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    Thanks, yes it looks like that proper de-bouncing is the only sure way, but I am still really interested as to why the circuit works perfectly with all the CD4027's and RCA 4027ae's, only the HEF type have the problem. I tried 15 of them!
     
  10. eetech00

    Senior Member

    Jun 8, 2013
    1,168
    240
    Hmm...if you can believe the data sheet, the HEF is the only one with a Schmitt at the clock input pin.
    Try changing R1 to 100 ohm, R2 to 47k and reverse D1. See if that works. C1 should be bigger.

    I think the design is too marginal to account for the manufacturing variances of 4027's.

    eT
     
    Last edited: Jun 14, 2018
    recklessrog likes this.
  11. HW-nut

    Member

    May 12, 2016
    93
    21
    I agree that the circuit looks marginal. There is no way that the cicuit meets the rise/ fall time specification of the cd4027b. A TI part is specifies clock rise/ fall time for 45 us @ 5V and 5 us @ 10V. That probably explains the supply voltage sensitivity.
     
    Last edited: Jun 14, 2018
    recklessrog likes this.
  12. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    I looked through the ic's on hand and found a 4093 Schmitt trigger which I have wired as per the diagram below.
    It seems very tolerant of the resistor value, anything from 10k to 330k works fine so I chose 220k
    to reduce the current into the tactile switch where all it really has to do is discharge the capacitor.
    img135.jpg
    Can anyone see a problem in doing it like this or suggest an improvement?
    As it has completely eliminated the problems I was having, I will forget the other de-bounce circuit and stick to this one.

    EDIT:- Both gate inputs are linked. No floating inputs.
     
    Last edited: Jun 15, 2018
  13. ebp

    Well-Known Member

    Feb 8, 2018
    2,018
    708
    You might add a resistor between the capacitor and the switch to limit peak current to the switch. While the peak current can be very high when the switch is first closed, it has never been clear to me if such a small capacitor stores sufficient total energy to damage plating on the switch contacts. It has been my custom to include a limiting resistor, but I can't say for certain it is really required. If you move the pullup to the switch side of that resistor, then no matter its value it won't compromise the voltage at the input to the gate when the switch is closed. If the limiting resistor is only a few percent of the pullup, it doesn't matter which side it is on.
     
    Bernard and recklessrog like this.
  14. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    I tried all of that but it was just the same so I'm now using the 4093 Schmitt trigger circuit.
    I think the guitar pedals use a tolerant 4027, and do it that way for cheapness
    to save the cost of additional Ic's.
     
  15. ericgibbs

    Moderator

    Jan 29, 2010
    5,922
    1,117
    hi Roger,
    I would also suggest adding a low value in series with the switch contacts, say 47R or 100R.
    Link the two inputs of the 4093 together, no floating inputs
    You should find some CD4093 amongst those IC's you picked up from me.
    E
     
  16. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,045
    1,994
    For the 4093 circuit, are you connecting both gate inputs to the R-C node?

    ak
     
  17. Kjeldgaard

    Member

    Apr 7, 2016
    288
    109
    My universal values are 10KΩ 100KΩ and 100nF:
    PushBot_Togle_1.jpg

    With the almost symmetrical 10 mSeconds, I have not yet seen problems with pushbuttons.
     
  18. eetech00

    Senior Member

    Jun 8, 2013
    1,168
    240
    Hello

    I agree with post #53 and #55. But I suggest increasing the cap value to 470n (0.47u) and resistor to 470k
    The sim with 100n cap shows bouncing at 100m, 200m bounce duration.
    The sim with 470n cap shows no bouncing, even with crummy switches.
    See below.

    SwDebounce-100nCap.png SwDebounce-470nCap.png
     
    Last edited: Jun 15, 2018
    recklessrog likes this.
  19. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    Yes both gate inputs are connected.
     
  20. recklessrog

    Thread Starter Well-Known Member

    May 23, 2013
    858
    306
    Ok I will change R and C as you advise. I found that my original push button tactile's were cheap rubbish, I removed some from the control panel of an old Toshiba video recorder and they are a lot better with a more positive snap action. So far, so good
     
Loading...