Hello,
This is a very nooby question:
I've been using push buttons for a while, with two pins.
Now I have a lot of "three pins" button modules (one of those packs sold in AlienExpress) with (gnd,vcc,out) that I don't know how to connect to the PI.
I guess that if I connect only gnd to "pi gnd" and out to any gpio, it would behave like the two-pin push buttons is it correct ?
But then, why does it have a third vcc pin that has to be connected to a 3.3 v output in the pi ? The button doesn't seem to have any internal led...
Thanks in advance,
Roger
Re: Difference between "push button with two pins", and "button module with three pins"
I dont have extreme long range x-ray vision capability... and my "crystal ball" indicates a blurry image of what could be a resistor thingy...
my ESP powers are running low to confirm....
an image of the tear-down of the switch will reveal the truth to the mystery you are facing....
my ESP powers are running low to confirm....
an image of the tear-down of the switch will reveal the truth to the mystery you are facing....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
- Burngate
- Posts: 6408
- Joined: Thu Sep 29, 2011 4:34 pm
- Location: Berkshire UK Tralfamadore
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
It's possible that they're single pole change-over switches - Google SPDT switch.
The labelling seems confusing, but my guess is that when not pushed, "out" is connected to "gnd", while pushed, "out" is connected to "vcc". Or vice versa.
The labelling seems confusing, but my guess is that when not pushed, "out" is connected to "gnd", while pushed, "out" is connected to "vcc". Or vice versa.
- thagrol
- Posts: 4052
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
Don't guess. You could damage your Pi doing that.
If there's a part number, google it for a data sheet.
If there isn't, try asking the seller on "AlienExpress".
If you have one, use a multimeter to test which pins are connected to which both with the button pressed and released.
As a last resort, photograph it and try a reverse image search.
If there's a part number, google it for a data sheet.
If there isn't, try asking the seller on "AlienExpress".
If you have one, use a multimeter to test which pins are connected to which both with the button pressed and released.
As a last resort, photograph it and try a reverse image search.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- Burngate
- Posts: 6408
- Joined: Thu Sep 29, 2011 4:34 pm
- Location: Berkshire UK Tralfamadore
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
True
-ish. It's not my Pi, and not my switch, so I've got nothing to lose by guessing.
But the OP shouldn't trust me or my guesswork - he's the one with most to lose.
If, however, he could take it as a starting point for more reseach, then prove me wrong. Which will give him a nice feeling of superiority as well learning something.
- thagrol
- Posts: 4052
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
That was aimed at rogerty (the OP) but yes.Burngate wrote: ↑Sat Nov 14, 2020 6:38 pmTrue
-ish. It's not my Pi, and not my switch, so I've got nothing to lose by guessing.
But the OP shouldn't trust me or my guesswork - he's the one with most to lose.
If, however, he could take it as a starting point for more reseach, then prove me wrong. Which will give him a nice feeling of superiority as well learning something.
And you do have something to lose: your credibility and reputation. I'd say that's worth a lot more than $35.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Difference between "push button with two pins", and "button module with three pins"
Hello,
First of all, thank you all for the answers
... I know I'd to put all the details in the first place, but let me excuse myself saying that in my ignorance, I'd thought that a "module button with three pins" could be such a standard that it didn't need detailed explanations. I was wrong.
Here are the pics:
The first image consists of a pack of five buttons (three of them with its cover)
https://photos.app.goo.gl/H2tgobWH6coVdF9c7
This is the back side
https://photos.app.goo.gl/DyArUhEKz3sVCa9UA
The description for the product is "5pcs 12X12MM Big key module Big button module Light touch switch module with hat High level output for arduino or raspberry pi 3"
Name: Key module
Size: 11 * 22mm
Color: red keycap
Voltage: 3.5,5V
Output: digital level (press high, release low)
Interface: 3P interface S V G
Platform: MCU, ARM, raspberry pie
Shipping list:
5x key module
Brand Name: MINGYUANDINGYE
Origin: CN(Origin)
Condition: New
Type: Voltage Regulator
Application: Computer
Supply Voltage: 1
Dissipation Power: 1
is_customized: Yes
The link for the product: https://www.aliexpress.com/item/3290905 ... 4c4dq8Y3wh
As far as I can guess, there is no led embedded in the buttons, but that does not mean I am right
Thanks everybody again,
Roger
First of all, thank you all for the answers

Here are the pics:
The first image consists of a pack of five buttons (three of them with its cover)
https://photos.app.goo.gl/H2tgobWH6coVdF9c7
This is the back side
https://photos.app.goo.gl/DyArUhEKz3sVCa9UA
The description for the product is "5pcs 12X12MM Big key module Big button module Light touch switch module with hat High level output for arduino or raspberry pi 3"
Name: Key module
Size: 11 * 22mm
Color: red keycap
Voltage: 3.5,5V
Output: digital level (press high, release low)
Interface: 3P interface S V G
Platform: MCU, ARM, raspberry pie
Shipping list:
5x key module
Brand Name: MINGYUANDINGYE
Origin: CN(Origin)
Condition: New
Type: Voltage Regulator
Application: Computer
Supply Voltage: 1
Dissipation Power: 1
is_customized: Yes
The link for the product: https://www.aliexpress.com/item/3290905 ... 4c4dq8Y3wh
As far as I can guess, there is no led embedded in the buttons, but that does not mean I am right
Thanks everybody again,
Roger
Re: Difference between "push button with two pins", and "button module with three pins"
based on the description given... it is a push button "module" with an integrated pull-down resistor...
it needs to be wired with 3.3v, GND, and a GPIO input pin (say GPIO5, [pin29]).....
better add a 1kohm resistor between the button module output pin and the GPIO pin....
it needs to be wired with 3.3v, GND, and a GPIO input pin (say GPIO5, [pin29]).....
better add a 1kohm resistor between the button module output pin and the GPIO pin....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
- thagrol
- Posts: 4052
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
Judging by the photos you posted I'd second that.
it looks like a standard push to make tactile switch (SPST - Single Pole Single Throw) mounted to a PCB with a pull down resistor.
Wire it as @LTolledo suggests but do not put more than 3.3v into the vcc pin as what you put in is what you get out when the button is pressed and more than 3.3v will damage a Pi.
When it comes to writng code, you do not to specify a pull up or pull down when setting up your GPIO as the board has one fitted.
Personally, I'd still check that with a multimeter before connecting it to a Pi.
it looks like a standard push to make tactile switch (SPST - Single Pole Single Throw) mounted to a PCB with a pull down resistor.
Wire it as @LTolledo suggests but do not put more than 3.3v into the vcc pin as what you put in is what you get out when the button is pressed and more than 3.3v will damage a Pi.
When it comes to writng code, you do not to specify a pull up or pull down when setting up your GPIO as the board has one fitted.
Personally, I'd still check that with a multimeter before connecting it to a Pi.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Difference between "push button with two pins", and "button module with three pins"
ok, thanks to everybody. So now I have a clearer view about how to connect it, but... Why does it need three pins , one with vcc in, instead of the more simplified 'push' button with two pins ? what's the advantage, then ?
Thanks again...
Thanks again...
- thagrol
- Posts: 4052
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
In order to prevent the input on the Pi floating when the button contacts are open, you need to pull it either high or low.
There are configurable pull up/down resistors built into the Pi or you can do it with a simple resistor circuit and a two pin button.
That module has three pins because it has the pull resistor built in. It needs a high voltage (Vcc) a low voltage (Ground) and an output pin. The output pin will show either Vcc or ground depending on whether the button is pressed. Without the pull, with the button contacts open (i.e. not pressed) the output will randmonly change between the high and low states (and values inbetween) giving incorrect result in your code.
The advantage? If the device you're connecting to doesn't have configurable pulls using the module means you don't have to find an additional resistor and jump wires.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Difference between "push button with two pins", and "button module with three pins"
adding to that....
assuming you have connected the 3.3v and GND to the respective pins on the switch...
before actually connecting the "output" pin of the switch to RPI's GPIO, test it first with a multimeter (digital, or analog, whichever you have/prefer).
if not pressed... the output should be 0V (because the output is pulled to the GND)
if pressed... the output should be 3.3v (because the the output is connected to 3.3v)
once you've confirmed that then you may connect it to the GPIO pin that you prefer.
most of us do strongly suggest you put a series 1Kohm resistor between the switch output and the GPIO pin.
please do all connections when the setup is power off (and the PSU yanked out of the AC side)
double (and triple) check all connections before powering...
avoid at all cost a scene similar to the one below
SAFETY FIRST
assuming you have connected the 3.3v and GND to the respective pins on the switch...
before actually connecting the "output" pin of the switch to RPI's GPIO, test it first with a multimeter (digital, or analog, whichever you have/prefer).
if not pressed... the output should be 0V (because the output is pulled to the GND)
if pressed... the output should be 3.3v (because the the output is connected to 3.3v)
once you've confirmed that then you may connect it to the GPIO pin that you prefer.
most of us do strongly suggest you put a series 1Kohm resistor between the switch output and the GPIO pin.
please do all connections when the setup is power off (and the PSU yanked out of the AC side)
double (and triple) check all connections before powering...
avoid at all cost a scene similar to the one below
SAFETY FIRST
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
Come to me with 'problems' and I'll help you find solutions"
Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"
- Burngate
- Posts: 6408
- Joined: Thu Sep 29, 2011 4:34 pm
- Location: Berkshire UK Tralfamadore
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
So i was wrong!
And what's more he seems to have proved it!
That nice warm feeling of superiority should now be spreading round the forum, countering the depression caused by (or causing) today's rain.
Who needs credibility or reputation, when you can do such wonderous things?
And what's more he seems to have proved it!
That nice warm feeling of superiority should now be spreading round the forum, countering the depression caused by (or causing) today's rain.
Who needs credibility or reputation, when you can do such wonderous things?
- davidcoton
- Posts: 5691
- Joined: Mon Sep 01, 2014 2:37 pm
- Location: Cambridge, UK
- Contact: Website
Re: Difference between "push button with two pins", and "button module with three pins"
But not sufficiently wrong to cause any damage.

Have you just found the true cause of global warming?
TAKE THE FORUM DOWN! SAVE THE PLANET!!
Location: 345th cell on the right of the 210th row of L2 cache