I'm currently building a project using adafruits arcade buttons, and seem to be having a bit of an electrical problem.

Using a Raspberry Pi 2 , and after confirming that wires aren't touching in places they're not supposed to be, I attached the wires from a single button to my 5v pin and GPIO pin 23 (no breadboard or anything at the moment). I plug my RPi's power in to my laptop without a charger plugged in and run the following javascript code (Nodejs 0.12.7).

var Gpio = require('onoff').Gpio;
var moment = require('moment');

var firstButton = new Gpio(23, 'in', 'both', {debounceTimeout: 250});
firstButton.watch(function (err, value) {
  console.log(moment() + ' Button Pressed | ' + value)

Everything works exactly as predicted! When I push the button, it's console logged once with value 1 then 0. However now the problem, if I plug it in to my USB power adapter on my power bar, the button starts firing every 1 to 3 milliseconds without touching it, logging value 0. It also rarely accepts when I push the button at all, guessing because the event is being spammed.

To add to the issue, if I plug the Raspberry Pi in to my laptop again, but then an HDMI TV, the same issue happens.

What is it I'm doing wrong here? I'm new to messing with electrical. Do I need a breadboard with a couple other of little things to prevent this from happening when plugged in to the wall? Any help is appreciated. Thanks!

  • 1
    What is the rating (output volts and amps) on the USB adapter? Note your laptop port will only promise 500 mA, which is borderline. This may explain why the added stress of the HDMI connection causes a problem.
    – goldilocks
    Jul 17, 2015 at 14:56
  • 5V, 3.1A. Also have a 500ma, same issue. And note, this also happens without the HDMI but plugged in to the wall.
    – Dustin
    Jul 17, 2015 at 15:00
  • 1
    NEVER connect 5V to a Pi gpio. You will damage the gpio and the Pi. Please post a photo of your connections.
    – joan
    Jul 17, 2015 at 18:18

1 Answer 1


I attached the wires from a single button to my 5v pin and GPIO pin 23

The GPIOs on the Pi are on a regulated 3.3V circuit. This is true whether they are set as outputs or inputs. If you attach them directly to a 5V source, including the pi itself, you may damage them permanently.

This doesn't explain why the pin fluctuates with the button up unless it's because you already damaged it. Try using a different pin and 3.3V but you need to use a resistor in a button circuit. There are many examples and explanations of this online if you search for "raspberry pi gpio button".

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.