Page 1 of 2

teensy soft presses causes double input

Posted: Mon Mar 13, 2017 4:20 am
by pjmills81
Hello,

I have a teensy lc connected to the standard gameboy pcb. The issue I am having is that I am getting double presses on the a and b buttons.

It only occurs if I press the buttons "normally". If I press the a button harder it will only return 1 instance but softly can return 2 or 3 or even 4 instances.

I read in another post that double presses could be a short in the wiring but to me that doesn't make sense here because when I push the button harder it works perfectly every time.

Can someone please help?

Thanks
Peter

Re: teensy soft presses causes double input

Posted: Mon Mar 13, 2017 4:25 am
by pjmills81
I also just noticed it does multiple presses if I press the button down more to the right than in the center of the button.

Re: teensy soft presses causes double input

Posted: Mon Mar 13, 2017 10:45 pm
by Lphillimore
@pjmills81

I'm using a Teensy for the first time in my second build. Initially had double press issues but re-wired and all ok.

That said, very occasionally a light press seems to initiate a double press on 'A'.

Unsure why. Perhaps my button pads are too closen to the pcb pads? Not sure though as pressing the button feels normal. It happens too infrequently for me to investigate but sounds similar to your issue on a lesser scale.

Not sure if others have this problem?

Essentially touching the button initiates the press / double press so must be something with the buttons / pads / PCB alignment perhaps.

Re: teensy soft presses causes double input

Posted: Tue Mar 14, 2017 1:47 am
by moosepr
This is a common problem with electronics and is known as 'bounce'

As you press the button there is a small amount of ripple in the signal see this image I stole from the internet
Image

If the teensy is fast enough, it will see every single change in the signal and treat them as button presses. Light presses are just causing more bounce as the conductive pad under the button actually conducts less when it is under less pressure.

I have not looked at the teensy code, but most will have some form of debounce system within the code. Normally in the form of a delay or something.

So maybe have a search through the code for 'bounce' and see what options you have (after checking the wires are securely attached of course ;) )

Re: teensy soft presses causes double input

Posted: Tue Mar 14, 2017 2:46 am
by Lphillimore
moosepr wrote:This is a common problem with electronics and is known as 'bounce'

As you press the button there is a small amount of ripple in the signal see this image I stole from the internet
Image

If the teensy is fast enough, it will see every single change in the signal and treat them as button presses. Light presses are just causing more bounce as the conductive pad under the button actually conducts less when it is under less pressure.

I have not looked at the teensy code, but most will have some form of debounce system within the code. Normally in the form of a delay or something.

So maybe have a search through the code for 'bounce' and see what options you have (after checking the wires are securely attached of course ;) )
Looks like it's set to 10ms, is that correct @wermy?

I guess if its notably bad check wiring and if you're not satisfied amend this to perhaps 15 / 20ms?

Re: teensy soft presses causes double input

Posted: Tue Mar 14, 2017 3:37 am
by moosepr
i guess different age/use levels on the buttons may change things?

i would say a bit of trial and error wouldnt hurt, tweak it until it behaves the way you like. The worst it will do is if you set it too high, it will just be all unresponsive

Re: teensy soft presses causes double input

Posted: Sat Mar 18, 2017 12:21 am
by pjmills81
Hello,

Thanks for all your replies. I changed the bounce value from 10 to 100 in wermy's code and it seems to be fine now for every button. Hopefully it stays that way.

Pete

Re: teensy soft presses causes double input

Posted: Sat Mar 18, 2017 12:26 am
by moosepr
pjmills81 wrote:Hello,

Thanks for all your replies. I changed the bounce value from 10 to 100 in wermy's code and it seems to be fine now for every button. Hopefully it stays that way.

Pete
Great news! Does it make your controls seem any less responsive?

Re: teensy soft presses causes double input

Posted: Sat Mar 18, 2017 3:29 am
by pjmills81
Controls still seem as responsive as they should be. I've tried gameboy and gameboy advanced games. Glad it wasn't the wiring. This was the second time I've wired the teensy to the control pcb.. hopefully never again.

Re: teensy soft presses causes double input

Posted: Mon Mar 27, 2017 12:51 am
by dezent
I had the same problem. Set the bounce time to 75 solved it. 100ms might be better.