I got myself a little button to start playing around with. Attempting to hook it up to a Rpi.

What I wanted to confirm was the purpose and pins for each wire. The button I got is http://www.robotgear.com.au/Product.aspx/Details/782-Button-Module-with-cable

Some confusion was caused for me by G V N S..... I'm guessing G=Ground V=Active N=Neutral S=Dito Close up with GVNS http://www.robotgear.com.au/Cache/Files/ProductImageOriginals/2233_Button%20module%20with%20cable.jpg

After speaking with a friend who has more experience with this stuff. We're assuming this configuration

G = Pin 6 Ground
V = Pin 4 5V
S = Pin 11 or GPIO

Edit: As commented, the Raspberry Pi GPIO pins are NOT 5 V tolerant. Use the switch on the 3.3 V rail only.

From the top view I can see a resistor that ties S to V and to capacitors that are probably for decoupling.

So the pin out would be...

  • V = Voltage In (3.3V from RPi)
  • G = Ground (0 V of RPi)
  • S = Signal / Switch (the signal that changes when you push the button)
  • N = Not Used

How this works...

When connected, the voltage at S will be pulled up through the resistor (aka a pull-up resistor) to 3.3 V from the Pi. You can confirm this by measuring the resistance between V and S (maybe about 10 kOhms). Additionally, The Pi can only drive 50mA from the 3.3 V rail so make sure that the resistance between V and S is greater than 66 Ohms.

When you press the button, the connection at S is shorted to G. You can confirm this by pressing the button and checking continuity from S to G. There will be no continuity when you let go.

You can connect S to a GPIO on the Pi so when the button is not pressed, S will be at the rail voltage (3.3 V) and when pressed, S will measure 0 V relative to ground of the Pi.

  • 1
    \$\begingroup\$ RPI gpio is 3.3v only. Do not use 5v on it. \$\endgroup\$ – Passerby Aug 22 '13 at 0:56
  • \$\begingroup\$ Apologies. I thought I read somewhere that they were 5 V tolerant. Maybe I misread... or maybe that was the device I was using. I'll update. Thanks. :) \$\endgroup\$ – SLaG Aug 22 '13 at 1:01
  • 1
    \$\begingroup\$ And use a decent-sized resistor; you can only source 50mA or so from the 3V3 rail. \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 22 '13 at 1:14
  • \$\begingroup\$ @IgnacioVazquez-Abrams Also a good point. Though I doubt they would put as low a value as 66 Ohms for the pull-up. Added for completeness. :) \$\endgroup\$ – SLaG Aug 22 '13 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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