Buffer as switch debounce

Buffer as switch debounce, originally posted on S.E.B:

Do it with an SPST pushbutton switch, get debounce AND toggling...

...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson
Loading thread data ...

Dave Jones crafted a schematic that is much simpler than that. Of course you need to sit through a 45 minute video on youtube to get it, but you can fast-forward until you see the schematic.

Reply to
Rob

Link? ...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

Power-on state?

RL

Reply to
legg

Found it. I wouldn't call that "simpler". ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

Why waste the other half of that flop?

formatting link

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

Picky! Picky! Go back to the SPDT approach... or add a POR to the D-FLOP. ...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

I did this one (sorry not been following thread)

It has indeterminate startup I think (did not matter for this).

--

John Devereux
Reply to
John Devereux

It takes a SPDT switch, which the OP opined he's like to be rid of. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

I have something right now that if I mess with it enough I can get a bad contact although most of time it's fine. I'm using an optoisolator with an npn output. The output has a pullup resistor on it and a .1uf cap to ground and that is connected to a pin on a raspberry pi.

99% of the time it's fine but if I let it idle a long time and then give the switch a sloppy hit I can have a problem.

My question is -- maybe I can find an opto that has a smoother output? Don't they make some that have more sophisticated logic outputs? You guys may know. That would be great because I could just plug in a better part.

Reply to
mkr5000

Why not software debounce?

There are opto schmitts. Do you actually need the isolation? I see people use optos grounded on both sides, as if they have some magical filtering properties, which they don't.

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

Does anyone have a PWL or similar that you can plug into LTSpice to model the switch bouncing? I guess one could capture a trace on a digital scope or lab jack.

--
Chisolm 
Republic of Texas
Reply to
Joe Chisolm

So add a POR...

...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

Weird EMP protection? In the worst case the opto dies, not the MCU. A pair of depletion mode FETs would be better.

Best regards, Piotr

Reply to
Piotr Wyderski

No, just bad design.

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

What kind of switch is it? Non-snap membranes are the worst; they can bounce (and ooze) for 100 milliseconds.

--

John Larkin         Highland Technology, Inc 

lunatic fringe electronics
Reply to
John Larkin

Here's the netlist from NoiseBlank.pdf on the S.E.D/Schematics Page of my website. The digital pulses may be difficult to decipher so the PDF has been updated to show the pulse combinations to make a noisy signal.

  • Schematics Netlist *

R_R1 V2 0 1K R_R2 V3 0 1K U_DSTM3 STIM(1,1) $G_DPWR $G_DGND V1 IO_STM IO_LEVEL=0

  • 0 0
  • +10u 1
+REPEAT FOREVER
  • +10u 0
  • +10u 1 + ENDREPEAT R_R3 V1 0 1K U_DSTM1 STIM(1,1) $G_DPWR $G_DGND V2 IO_STM IO_LEVEL=0
  • 0 1
  • +0.5u 0
+REPEAT FOREVER
  • +4u 1
  • +1u 0 + ENDREPEAT R_R4 N_1 N_2 39K R_R5 N_2 N_3 39K R_R6 N_4 N_5 5.1K R_R7 N_4 N_6 5.1K V_V1 N_4 0 +5V X_U1A INPUT N_2 $G_DPWR $G_DGND 74HC04 PARAMS:
  • IO_LEVEL=0 MNTYMXDLY=0 R_R13 N_7 0 1K R_R9 N_8 0 5.1K R_R8 N_9 0 5.1K R_R11 N_4 N_10 1K R_R12 N_10 N_7 3K X_U5A OUTPUT N_11 N_12 $G_DPWR $G_DGND 74HC00 PARAMS:
  • IO_LEVEL=0 MNTYMXDLY=0 X_U4A N_13 N_12 OUTPUT $G_DPWR $G_DGND 74HC00 PARAMS:
  • IO_LEVEL=0 MNTYMXDLY=0
** Comparator Behavioral ** R1U3 int1U3 0 1G R2U3 int1U3 int2U3 {SQRT(10n/0.693147)} C1U3 int2U3 0 {SQRT(10n/0.693147)} E2U3 N_11 0 VALUE {V(int2U3,0)*(5-0)+0} E1U3 int1U3 0 VALUE {(tanh(2.197774/5m*V(PROCESS,N_7))+1)/2} ** End Behavioral Comparator ** ** Comparator Behavioral ** R1U2 int1U2 0 1G R2U2 int1U2 int2U2 {SQRT(10n/0.693147)} C1U2 int2U2 0 {SQRT(10n/0.693147)} E2U2 N_13 0 VALUE {V(int2U2,0)*(5-0)+0} E1U2 int1U2 0 VALUE {(tanh(2.197774/5m*V(N_10,PROCESS))+1)/2} ** End Behavioral Comparator ** R_R14 OUTPUT 0 1G E_E1 INPUT 0 VALUE { V(V1)*(1-V(V2)*V(V3)/25) } R_R10 INPUT 0 1G U_DSTM2 STIM(1,1) $G_DPWR $G_DGND V3 IO_STM IO_LEVEL=0
  • 0 0
  • +0 1
+REPEAT FOREVER
  • +150n 0
  • +50n 1 + ENDREPEAT Q_Q3 N_3 N_3 N_9 Q2N3904 Q_Q4 PROCESS N_3 N_8 Q2N3904 Q_Q2 PROCESS N_1 N_6 Q2N3906 Q_Q1 N_1 N_1 N_5 Q2N3906 C_C2 PROCESS 0 3.3pF ...Jim Thompson
--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

Well, 3 transistors, 4 resistors and 1 cap versus your 2 ICs, 2 resistors and 1 cap. And it can source some current at the output. (it is intended to be a power on/off switch)

Reply to
Rob

opto schmitt is nice -- that would help a lot. using optos because this could have long cable lengths and maybe in industrial environment. hate to expose the I/O pins of a Raspberry PI to that. thanks.

Reply to
mkr5000

Put the NPN of your opto in place of the switch in this drawing...

Depending on your application... if you don't need on/off toggling, just eliminate the D-Flop. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142     Skype: skypeanalog  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.