On Monday, 20 March 2017 14:13:43 GMT [email protected] wrote:
> I've come into this a bit late I know, but get the impression things are
> getting rather involved to read some switches, although I may have got
> the wrong end of the stick.
It didn't start out that way ;-(
> You don't need hysteresis to read input switches. You just need a pullup
> resistor and the switch to ground, or a pulldown and switch to Vcc. I
> prefer the former, as I don't like Vcc wandering around. In the old days
> of TTL it had to be pullups but that was long ago. Typical CMOS
> thresholds will be close to mid-rail, but it doesn't really matter.
Yes. That's what I had originally.
> Simplest way to debounce is scan keys every 100ms or so and on every 1
> to 0 transition log a keypress. Typical bounce will be much less than 100ms.
These are physical switches connected to the GPIO pins, not keys (the Pi will
be running headless). I was getting around 1 - 2 ms of bounce after I put
0.1 uF capacitors across the switches (but my scope is a £10 Arduino to USB
device, so the bandwidth may not be good enough to see what is really
happening).
> You can get more involved than this if you need auto-repeat, and repeat
> times are comparable to bounce times, but assuming that's not needed
> here, we can forget about all that.
The new circuit should provide almost symmetrical roll-off of the edges of the
signals when the switches are depressed and released. any bounces will be
long gone, but more to the point, the cross-talk should be significantly lower
and hopefully insufficient to pass the pin threshold voltage.
--
Terry Coles
--
Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00
Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/
New thread: mailto:[email protected] / CHECK IF YOU'RE REPLYING
Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR