I have a friends Pi 3 Model B+ that I hooked up to become the "brain" on a Carrom Bubble Hockey table. The table is very simple, it has two goals and a button, so in total 3 switches.

My program runs on the Pi and listens for events from the GPIO pins and updates a scoreboard on a TV connected through HDMI, among some other goofy features.

It works, except for some weird issues.

Short version of the question: The software seems to randomly detect the switches closing and triggers a goal in the software. Sometimes it makes it through a 10 minute game just fine, sometimes it's every few minutes, sometimes it's non-stop.

What can I do about this?

Longer version of the question: There are actually two Pis in play here, as I have two friends with this same Hockey table and both wanted this setup.

Through trial and error, I originally got the first working fine on my test bench and set it up at his house. Using https://www.etechnophiles.com/raspberry-pi-3-b-pinout-with-gpio-functions-schematic-and-specs-in-detail/ for a pin diagram, it worked like this: (I had and still have little idea what I'm doing, I just found something that works)

  • GPIO 5 was the button
  • GPIO 26 + 27 were the goals
  • All three were connected to GND next to GPIO 5.

The only issue was that the goals would some time randomly fire. It wasn't enough of an issue though so we plowed forward and set up at the second friends house.

After setting this up (same table, same Pi model, same software), we noticed that the goals would fire immediately and constantly. I also found after disconnecting them that touching the wires myself would trigger a goal. Even touching the insulated sides of wires together would trigger a goal.

I took the Pi home, did some research, and set it up like this before sending it back:

  • 3.3v pin in top left is connected to a 1K ohm resistor.
  • This splits and goes to each of the three switches, which then come back to
  • GPIO 26 + 12 (goals) and GPIO 13 (button)


  • The same original issue: random goals would fire off. But it gets worse:
  • After more people came over that afternoon to try it out, it went back to immediately and always firing goals. This made it unusable for the evening.

Why could this be happening? Is there anything I can do? At this point it seems like phantom signals or static or radio interference or something weird.

Other notes:

  • I cannot for the life of me repro the issue at my house when just touching wires together. It's only happening when hooked up to the tables.
  • A continuity test on the switches show they seem to work just fine.
  • The software in question is an Electron app using onoff to communicate w/ GPIO. The OS is Arch Linux ARM.

Update after following Milliways helpful suggestions:

The comment about having built an antenna here rings true. If I place a walkie talkie near the wires and push a button, it fires off a signal in my code :).

I've tried the way explained (I think), see diagram. There are two problems still:

  1. The walkie talkie still causes interference. Not sure what to do here.
  2. Closing any switch sort of works, but will also just as likely trigger a signal for a different switch. I believe this could be fixed by having separate 3.3v sources, but there are only two on the Pi.

You DEFINITELY "need three pulls, one for each". The whole point of a pullup is to put a defined voltage on the GPIO when NO BUTTON is pressed.

I guess I don't know how to do this without a third 3.3v source.

If I strip the setup in the diagram down to one switch, problem #2 goes away but I still experience problem #1.

  • research pullup resistors
    – jsotola
    Jan 5, 2023 at 16:17
  • 1
    We need clear photos showing the connection between the Pi GPIO and the buttons and switches. Include shots of any pull-ups and/or pull-downs.
    – joan
    Jan 5, 2023 at 16:28
  • @jsotola is very likely correct (although it is probably pull downs that you need): Your problem is that the inputs float too much (they are in the high-Z state) when the switches are open. A pull down is resistor connecting the input side of the switch to ground, so that when open it is "pulled low", but will still trigger high when closed.
    – goldilocks
    Jan 5, 2023 at 16:57
  • Thanks, do you think software-configured pulldowns might work (github.com/fivdi/…) or will I need to wire up something like grantwinney.com/…?
    – neilsimp1
    Jan 5, 2023 at 18:20
  • I'd try the one and if that doesn't work then the other. Probably still a good idea to post a pic of your wiring though...
    – goldilocks
    Jan 5, 2023 at 21:06

1 Answer 1


"3.3v pin … is connected to a 1K ohm resistor. This splits and goes to each of the three switches."
I don't know what is split - you can't "split" a resistor.

As far as I can tell from your text description you DO NOT have ANY pullup/down.

EACH pin NEEDS a pull directly connected (purists recommend a small series resistor between GPIO and connected device) from the pin to 3.3V or GND (it is preferable to have pullup to 3.3V and connect switch between GPIO & Gnd.

See https://elinux.org/RPi_GPIO_Interface_Circuits#Buttons_and_switches

It is recommended to use a low value pullup (~1kΩ). The internal pullup resistors are only suitable for very short wiring.

To address the questions in Comment:-

  1. You DEFINITELY "need three pulls, one for each". The whole point of a pullup is to put a defined voltage on the GPIO when NO BUTTON is pressed.
  2. Your comment "can each pull connect to the same GND pin" implies the you are using buttons between 3.3V & GPIO. I strongly suggest you use pullup to 3.3V and button to Gnd.
    Electrically this makes no difference but no engineer would run 3.3V power to a switch. Accidental contact with Gnd is almost invariably fatal to the Pi. If you REALLY need to do this use a small (~33Ω) resistor in series - located as near to the 3.3V pin as possible.
    You can use a single Gnd or 3.3V pin; there are only multiples for convenience.

You could use the internal ~50kΩ pullups, but these are inadequate for longer wires. It doesn't hurt to enable them, even if using external resistors.

  • > I don't know what is split - you can't "split" a resistor. What I mean is after the resistor, the wire splits to three wires to go to each switch.
    – neilsimp1
    Jan 7, 2023 at 16:51
  • Thank you for this info, I will give it a try soon. Question - can each pull connect to the same GND pin or must each go to it's own GND pin? And I need three pulls, one for each? I cannot combine it to one?
    – neilsimp1
    Jan 7, 2023 at 16:53
  • Thank you for your further answers. This really is a huge help. I've updated my question above with more.
    – neilsimp1
    Jan 9, 2023 at 17:43
  • One final update: I tried what you said about You DEFINITELY "need three pulls, one for each", before I thought this meant also a separate power source. My setup now looks like this and appears to be working. I'm not sure why it works this way and not the other, but as far as I can tell, this works now!
    – neilsimp1
    Jan 10, 2023 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.