Author Topic: Raspberry Pi 3 Crosstalk Button Issue  (Read 6678 times)

0 Members and 1 Guest are viewing this topic.

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Raspberry Pi 3 Crosstalk Button Issue
« on: July 24, 2017, 09:41:54 am »
Hello everyone! I have a issue that is confusing me beyond words, but I thought perhaps someone here may know what is happening.
I am building a system which uses a remote attached to the RPi with a ribbon cable from about 3ft away.

The remote has buttons on it which connect the Raspberry Pi's GPIOs to GND. The system works beautifully when I use an Adafruit breakout board, plugging the ribbon cable into that. However, when I tried to connect the ribbon straight to the RPi, pressing 1 button often triggers 2 others. The breakout board has no resistors on any electronics on it, it is just a circuit board with labeled pins.

The mystery deepens, because my circuit stops triggering multiple inputs if I hold the back of the board (i.e. Short the switch contacts with my finger). I tested it extensively, and it works every single time. So the question is, is it the resistance or capacitance of my hand that is doing the trick. Thoughts?
 

Offline cowana

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #1 on: July 24, 2017, 09:56:55 am »
Does the remote have its own pullup resistors, or are you relying on the ones internal to the Pi?
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #2 on: July 24, 2017, 10:01:50 am »
Raspberry pi apparently have built it pull-ups. But they must be enabled, I would guess they are not in this case. However they are too weak to attach buttons end expect this to reliably work, yet with a 3ft cable. Therefore pull up resistors should be attached between 3.3V and each input pin. I would suggest around 4.7k resistance.
 

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #3 on: July 24, 2017, 02:48:00 pm »
Okay. I don't understand what is happening with my hand, but I'll try the Pullup resistors. Should I disable them in the code if I do this?. Also, will each pin need a separate circuit or is there some way to chain all the pullups together?
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #4 on: July 24, 2017, 02:57:38 pm »
Okay. I don't understand what is happening with my hand, but I'll try the Pullup resistors. Should I disable them in the code if I do this?. Also, will each pin need a separate circuit or is there some way to chain all the pullups together?

Your hand is likely adding a bit of capacitance to the GPIOs and possibly resistance to GND or a voltage rail if you're actively touching any of the pins or traces.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #5 on: July 24, 2017, 10:22:57 pm »
Unconnected pins should be left with enabled pull-ups of configured as outputs. If pin is left unconnected and without any pull-up, it may cause voltage on it jumping around and/or being somewhere in between 0 and 1 state. This may cause increased current consumption, in some very rare cases even a failure of the chip because it. If you have external pull up on the pin, leaving internal pull-up enabled won't hurt at all. You can use either separate resistor for each pin or get a resistor network (if you have a lot of pins to be pulled up).
 

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #6 on: July 25, 2017, 12:06:19 am »
I have attached a screenshot to show what I plan to make for the pullup circuits. I've got 1k protection resistors (it seems like that is usually good form) and 5k1 current resistors. The green wires would go to separate GPIO pins and the red and black connect to 3v3 and gnd respectively. Does this seem sound?
« Last Edit: July 25, 2017, 12:10:10 am by atech »
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Raspberry Pi 3 Crosstalk Button Issue
« Reply #7 on: July 25, 2017, 12:44:37 am »
Yeah, that looks fine. Took me a minute to trace out the breadboard connections. In the future you might want to post a normal schematic like this:


Edit: Keep in mind your circuit doesn't haven't any sort of debouncing, so you're likely to get multiple hits every time you press a button. You'll need to do the debouncing in software. Alternatively you can do it in hardware:

(Note: The resistors, diode and capacitor make up the debouncing circuit. The flip-flop and LED are just there to simulate a GPIO input and status register.)
« Last Edit: July 25, 2017, 12:52:28 am by timb »
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 
The following users thanked this post: atech

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #8 on: July 25, 2017, 01:10:17 am »
Wow! Thank you for the VERY comprehensive answer!
As for debounceing, lucky for me the RPi has debouncing built in to it's GPIO library. Thank you so much for all of your help!
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 6987
  • Country: ca
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #9 on: July 25, 2017, 01:12:39 am »
Wait a sec, RPi I/O is 3.3V not 5V.
So pull-up resistors to 3.3V.  I use 10k's
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #10 on: July 25, 2017, 01:56:22 am »
Wait a sec, RPi I/O is 3.3V not 5V.
So pull-up resistors to 3.3V.  I use 10k's

In my example the 5V rail could just as well be 3v3, it's not critical.

I agree 5.1k is a bit on the low side, however it'll work just fine. If current consumption is an issue (running on battery power for example), then you could up it to 10k or potentially even higher. (The beauty of the debounce circuit I posted earlier is the very low static current, since the pullup is nearly 100k.)


Sent from my iPhone using Tapatalk
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #11 on: July 25, 2017, 08:32:54 am »
Okay, I'll switch it to 10K. I was just going to use 1/4 watt resistors for this. That should be fine, right?
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #12 on: July 25, 2017, 09:00:50 am »
So pull-up resistors to 3.3V.  I use 10k's
Actually 10k is not a good advice for long term reliability. There are 2 issues, switch wetting current to break down oxides on the surface of the contacts, and secondly, often tact switches become slightly conductive after a few years if used in humid environment.
Wait a sec, RPi I/O is 3.3V not 5V.
So pull-up resistors to 3.3V.  I use 10k's
In my example the 5V rail could just as well be 3v3, it's not critical.
It is critical, you show this in the beginner section. Inexperienced people quiet likely will just do exactly as shown without much thinking and connect it to 5V.
 

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #13 on: July 25, 2017, 09:08:30 am »
So pull-up resistors to 3.3V.  I use 10k's
Actually 10k is not a good advice for long term reliability.
What Ohm rating would you suggest?

Wait a sec, RPi I/O is 3.3V not 5V.
So pull-up resistors to 3.3V.  I use 10k's
It is critical, you show this in the beginner section. Inexperienced people quiet likely will just do exactly as shown without much thinking and connect it to 5V.
I appreciate the advice, but I don't think that's fair to say. I may be a beginner, but I am not going to blindly follow something. I make an effort to understand it, and in this case I already did. That's how you get out of the beginner thread.
« Last Edit: July 25, 2017, 09:12:57 am by atech »
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #14 on: July 25, 2017, 09:20:28 am »
I may be a beginner, but I am not going to blindly follow something.
That was said in general, not about particularly you. Someone may understand, someone may follow blindly and burn the thing. After all, someone can google this tread, see the thing without much reading and just do it.
« Last Edit: July 25, 2017, 09:28:44 am by wraper »
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #15 on: July 25, 2017, 09:24:16 am »
So pull-up resistors to 3.3V.  I use 10k's
Actually 10k is not a good advice for long term reliability.
What Ohm rating would you suggest?
I already said that in earlier post, 4.7k. Probably even less depending on circumstances. Also it depends on voltage, for 5V to keep the same current through the switch larger resistance is needed. Decreasing resistor increases current consumption when button is pressed so in portable devices you likely would want to use higher resistance. In noisy environment, with long wires or humid environment - lower.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #16 on: July 25, 2017, 11:19:21 am »
It is critical, you show this in the beginner section. Inexperienced people quiet likely will just do exactly as shown without much thinking and connect it to 5V.

I meant it doesn't affect the value of the pull-up resistor, obviously putting 5V into a 3V3-only GPIO won't end well. That's a pretty basic thing most beginners are aware of. And if they're not aware of it, they will be when they try it! (Failures teach us more than easy success.)
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #17 on: July 25, 2017, 11:43:57 am »
What Ohm rating would you suggest?

The 5.1k you picked is fine. As would 10k be, honestly. You don't really need to worry about all the "contact whetting current" stuff at your level. If you were producing a commercial product used in extreme environments, then maybe worry about it, but for a hobby project there's no need.

(In fact, modern snap dome switches like you use on a breadboard are for the most part "self-cleaning" due to the action. In reality you really only need to worry about minimum currents these days on certain types of relays.)
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #18 on: July 25, 2017, 01:21:04 pm »
In fact, modern snap dome switches like you use on a breadboard are for the most part "self-cleaning" due to the action. In reality you really only need to worry about minimum currents these days on certain types of relays.
I guess you haven't repaired electronics much. Tact switches die like plague on many devices. In many of those cases enough current through the switch would avoid device malfunction. Often you need to replace all of them otherwise others will start acting within a year. "self-cleaning"  :), you should disassemble some used tact switches and look through the microscope to appreciate how "clean" contacts look like.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #19 on: July 25, 2017, 04:33:17 pm »
In fact, modern snap dome switches like you use on a breadboard are for the most part "self-cleaning" due to the action. In reality you really only need to worry about minimum currents these days on certain types of relays.
I guess you haven't repaired electronics much. Tact switches die like plague on many devices. In many of those cases enough current through the switch would avoid device malfunction. Often you need to replace all of them otherwise others will start acting within a year. "self-cleaning"  :), you should disassemble some used tact switches and look through the microscope to appreciate how "clean" contacts look like.

Self-cleaning of oxides, not dirt and debris. That's why I put it in quotes. ;)

If a tact switch was broken because of dirt or oxidation it would be easily fixable by a shot of contact cleaner spray. However, it's been my experience that most of them break due to a mechanical failure. Some cheap off-brand tact switches are only rated for a few hundred actuations!

I've repaired quite a bit of gear over the years, both old and new.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #20 on: July 25, 2017, 09:02:30 pm »
Self-cleaning of oxides, not dirt and debris. That's why I put it in quotes. ;)
I wasn't talking about dirt coming from outside either. Almost no tact switch uses gold plating so they oxidize like hell. And metal membrane usually is just made of steel.
Quote
If a tact switch was broken because of dirt or oxidation it would be easily fixable by a shot of contact cleaner spray
Wonder how you will get it under metal dome unless make it flowing all over the PCB. And your device is already faulty anyway. Also who keeps the contact cleaner just in case, not to say with very dubious efficiency in such case.
Quote
However, it's been my experience that most of them break due to a mechanical failure.
In my experience they usually are completely fine mechanically but electrically faulty. Here is just a random roughly 10 years old tact switch. It had barely any presses in it's lifetime, and was in a dry room all of that time. Most of the 3-5 years old tact switches look much worse than this. Unfortunately right now I don't have any of them around to take a photo. Often you see something similar to metal film growing in between of the contacts. And it's actually conductive, in 10+ to hundreds of kiloohms range.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #21 on: July 25, 2017, 09:12:15 pm »
"Self cleaning", I would rather call it self oxidizing in places where the metal dome ever touches contacts, likely because of dissimilar metals.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #22 on: July 25, 2017, 11:06:53 pm »
Self-cleaning of oxides, not dirt and debris. That's why I put it in quotes. ;)
I wasn't talking about dirt coming from outside either. Almost no tact switch uses gold plating so they oxidize like hell. And metal membrane usually is just made of steel.
Quote
If a tact switch was broken because of dirt or oxidation it would be easily fixable by a shot of contact cleaner spray
Wonder how you will get it under metal dome unless make it flowing all over the PCB. And your device is already faulty anyway. Also who keeps the contact cleaner just in case, not to say with very dubious efficiency in such case.

Most of us keep Deoxit or similar sprays on-hand for cleaning purposes. A shot of it directly at the top of the tact switch will flood it, then you actuate it a few times and let the spray evaporate. Voila, no more oxidation.

Also, those images you show aren't that bad for a cheap switch, especially over a decade! Also, I doubt even a 1mA current through that switch would prevent that type of oxidation. You laid the reasons out yourself: It's due to the dissimilar metals, contact shape and being exposed to the air.

The reason minimum currents are required to keep certain types of relay contacts clean has to do with the shape of the contacts, the materials used, if they're sealed, contact arrangement, etc.

A snap dome switch tact switch is completely different from a relay.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline atechTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #23 on: July 26, 2017, 02:27:27 am »
I am using these switches from amazon. Do I need to be concerned about component failure? According to the datasheet they are rated between 1-3 million actuations.

https://www.amazon.com/gp/product/B017AUJY2C/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16864
  • Country: lv
Re: Raspberry Pi 3 Crosstalk Button Issue
« Reply #24 on: July 26, 2017, 09:03:11 am »
A shot of it directly at the top of the tact switch will flood it
I would like to see how it will flood the air pouch under the metal dome without applying excessive amount of it. Not to say, contact contamination won't go anywhere but will stay exactly where it is as there is no wiping action in the tact switch.
Quote
I doubt even a 1mA current through that switch would prevent that type of oxidation.
You can check datasheet for omron D2F switches with gold plated contacts. Low current types like used in a lot of computer mouses suggest minimum 1mA @ 5V.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf