teensy soft presses causes double input

General GBZ-related chat goes here. Share ideas, tips and tricks, or ask questions that don't fit into the hardware/software help forums.
pjmills81
Posts: 11
Joined: Thu Nov 24, 2016 2:04 am
Has thanked: 1 time
Been thanked: 2 times

teensy soft presses causes double input

Post by pjmills81 » Mon Mar 13, 2017 4:20 am

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

pjmills81
Posts: 11
Joined: Thu Nov 24, 2016 2:04 am
Has thanked: 1 time
Been thanked: 2 times

Re: teensy soft presses causes double input

Post by pjmills81 » Mon Mar 13, 2017 4:25 am

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.

User avatar
Lphillimore
Posts: 993
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 796 times
Been thanked: 527 times

Re: teensy soft presses causes double input

Post by Lphillimore » Mon Mar 13, 2017 10:45 pm

@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.

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: teensy soft presses causes double input

Post by moosepr » Tue Mar 14, 2017 1:47 am

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 ;) )
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

User avatar
Lphillimore
Posts: 993
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 796 times
Been thanked: 527 times

Re: teensy soft presses causes double input

Post by Lphillimore » Tue Mar 14, 2017 2:46 am

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?

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: teensy soft presses causes double input

Post by moosepr » Tue Mar 14, 2017 3:37 am

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
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

pjmills81
Posts: 11
Joined: Thu Nov 24, 2016 2:04 am
Has thanked: 1 time
Been thanked: 2 times

Re: teensy soft presses causes double input

Post by pjmills81 » Sat Mar 18, 2017 12:21 am

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

User avatar
moosepr
Posts: 524
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: teensy soft presses causes double input

Post by moosepr » Sat Mar 18, 2017 12:26 am

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?
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

pjmills81
Posts: 11
Joined: Thu Nov 24, 2016 2:04 am
Has thanked: 1 time
Been thanked: 2 times

Re: teensy soft presses causes double input

Post by pjmills81 » Sat Mar 18, 2017 3:29 am

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.

dezent
Posts: 15
Joined: Tue Aug 30, 2016 6:10 pm
Been thanked: 12 times

Re: teensy soft presses causes double input

Post by dezent » Mon Mar 27, 2017 12:51 am

I had the same problem. Set the bounce time to 75 solved it. 100ms might be better.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest