Push button detection through a very long wire

ian field

Joined Oct 27, 2012
6,536
I thought you were referring to my circuit -- which is what the post you were replying to was referring to.
That's the first time I've ever seen that exact configuration - there's probably a reason why.

It would probably be less temperamental if you used one of the common TO92 or small SMD MOSFETs.
 

joeyd999

Joined Jun 6, 2011
5,287
That's the first time I've ever seen that exact configuration - there's probably a reason why.

It would probably be less temperamental if you used one of the common TO92 or small SMD MOSFETs.
Is this like free association or something? I still have no idea as to which post/configuration you are referring.
 

ian field

Joined Oct 27, 2012
6,536
Ian, I believe Joey explained the purpose of his design in post #28
The transistor base has a 10k pull up which is shorted by the push button.

With a *VERY* long twisted pair, the voltage at the base could be ambiguous - that is, the switch and all that wire may not shunt the base voltage quite well enough to cut the transistor fully off.

With a MOSFET; you could have literally miles of twisted pair and the switch would still pull the resistor lower than VGSthr.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
The transistor base has a 10k pull up which is shorted by the push button.

With a *VERY* long twisted pair, the voltage at the base could be ambiguous - that is, the switch and all that wire may not shunt the base voltage quite well enough to cut the transistor fully off.

With a MOSFET; you could have literally miles of twisted pair and the switch would still pull the resistor lower than VGSthr.
interesting... but I'm guessing some extra protection would be needed for the mosfet, to protect it from ESD's. Probably a TVS connected between ground and its gate.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
@joeyd999, thanks for all your help. I'll definitely be using your circuit for its intended button application.
I still have to make up my mind about how to properly debounce the thing... either through the cap you seem to dislike so much, or through the painfully nuanced but effective use of code.
 

ian field

Joined Oct 27, 2012
6,536
interesting... but I'm guessing some extra protection would be needed for the mosfet, to protect it from ESD's. Probably a TVS connected between ground and its gate.
Usually 2 diodes in series, reverse biased across the supply rails with the tap between the two going to the gate.

I'd probably go the minimalist route with a 0.1uF disc ceramic shunting the gate, that would damp any transient voltage and the resistor that's there anyway stops the capacitor drifting very far. That gives some degree of debounce into the bargain.
 

AnalogKid

Joined Aug 1, 2013
11,056
1. The transistor base has a 10k pull up which is shorted by the push button.
2. With a *VERY* long twisted pair, the voltage at the base could be ambiguous - that is, the switch and all that wire may not shunt the base voltage quite well enough to cut the transistor fully off.
3. With a MOSFET; you could have literally miles of twisted pair and the switch would still pull the resistor lower than VGSthr.
1. I don't think so. The 10 K is not shorted. The lower end of the 10 K goes from approx 0.6 V (switch open) to 0.0 V (switch closed). Note that this means that the input impedance to this circuit always is very low, approx. 1.3K (the equivalent resistance of 440 uA and 0.6 V), and clamped by the diode's Vf.

2. That is true only if the loop resistance (wire out + switch contacts + wire back) is greater than approx. 870 ohms ( for a Vb of 0.4 V, the edge of cutoff).

3. True, but... For the 2N7002, Vgsthr min is 0.8 V, only twice the equivalent edge-of-cutoff voltage for a 2N4401. But the circuit input impedance would be over seven times higher, significantly increasing the circuit's susceptibility to the long wires acting as antennae for radiated noise in the area.

ak
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
For the 2N7002, Vgsthr min is 0.8 V, only twice the equivalent edge-of-cutoff voltage for a 2N4401. But the circuit input impedance would be over seven times higher, significantly increasing the circuit's susceptibility to the long wires acting as antennae for radiated noise in the area.
And that, I think, has been the source of most of my headaches all along...
 

ian field

Joined Oct 27, 2012
6,536
And that, I think, has been the source of most of my headaches all along...
The thing that makes a MOSFET different is; the gate is virtually an open circuit with just a little capacitance - when the switch is open, the 10k resistor will pull it up to Vdd.

With a *VERY* long wire, its resistance could become significant, then it would be necessary to increase the 10k resistor, and maybe in an extreme case starve Ib in the bipolar version.

The criticism made elsewhere of the twisted pair acting as an antenna is just splitting hairs - its going to be an antenna to some extent whether a MOSFT or bipolar is used - and the bipolar presents a rectifying junction that can detect signals - a problem that doesn't exist with a MOSFET.

In some applications, a twisted pair is less likely to act as an antenna than screened - alternate turns of the twist cancel whatever noise is picked up because they alternate. With screened/CO-AX, its possible for noise to be induced in the shield, but not the cancelling effect in the core.

If noise did present a problem, the MOSFET gate could be damped by a little capacitance - B/E junction rectification could again be a problem with bipolar.
 

ronv

Joined Nov 12, 2008
3,770
@cmartinez
This is kind of the classic debounce circuit. I added the clamp diodes to make everybody happy. :D Any schottky is ok. I just have the CD logic in my library. A more modern Schmitt trigger would be better.

Sorry about the switch - to lazy to make one, but it runs with the default.
 

Attachments

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
@cmartinez
This is kind of the classic debounce circuit. I added the clamp diodes to make everybody happy. :D Any schottky is ok. I just have the CD logic in my library. A more modern Schmitt trigger would be better.

Sorry about the switch - to lazy to make one, but it runs with the default.
Thanks! But I'm getting the following error when I try to run it:

Capture.JPG

Would you be so kind to post the missing file?
 
Top