moryoav
Posts: 13
Joined: Tue Jul 08, 2014 8:44 am

Button for Raspberry pi

Mon Jan 28, 2019 7:00 am

Hi,

I've never connected a button to a raspberry pi, I want to build something for my boy (to add buttons to his toy kitchen)
I want to keep it super simple, buttons with no led, I don't want to use a breadboard or resistors, I want to connect a button like in the schematics here:
https://projects.raspberrypi.org/en/pro ... usic-box/6
Due to my location, I'm limited to ordering stuff from China, but I don't know exactly what the specs for the button should be. Will any button do? Specifically, I found these that look cool:
https://www.aliexpress.com/item/12mm-Me ... 3c00dMm0xJ

Will they work?

Thank you!

User avatar
rpiMike
Posts: 857
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 7:36 am

Any button will do. Yes, those will work.

You might want to get some dupont jumper cables to plug onto the GPIO pins. Use the female end to connect to the Pi and cut of the other end to solder onto button or extra cable.

https://m.aliexpress.com/item/328676914 ... 8661288858

GPIO info:

https://pinout.xyz

moryoav
Posts: 13
Joined: Tue Jul 08, 2014 8:44 am

Re: Button for Raspberry pi

Mon Jan 28, 2019 7:46 am

Thanks! I'll post pictures of the finished project once I'm done...

User avatar
Imperf3kt
Posts: 2655
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Button for Raspberry pi

Mon Jan 28, 2019 8:24 am

rpiMike wrote:
Mon Jan 28, 2019 7:36 am
Any button will do.
Not quite.
There's normally closed push buttons, normally open push buttons, arcade switches, power delivery switches, low amperage switches (for controlling relays etc) plus a host of other kinds of button, suitable for specific tasks.
55:55:44:44:4C
52:4C:52:42:41

User avatar
rpiMike
Posts: 857
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 9:50 am

I think my statement still stands - all of those should work with a Pi.

User avatar
Imperf3kt
Posts: 2655
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Button for Raspberry pi

Mon Jan 28, 2019 1:52 pm

Yes, but it depends on two things.
1: what are you using it for? If you are connecting a 100mA rated slide switch to GPIO pin 2 so you can turn your 5v powered whatever that uses 1000mA on and off, you can expect sparks and melting plastic (been there, done that)

2: what kind of button is needed. Does it need to be momentary contact? Does it need to be push-pull? Does it need to be normally connected and only disconnect when pressed?
There's a huge range of 'buttons' with various specialised purposes. Saying 'any will work' is a bit like saying you can use a Ferrari to cross a desert. Sure, it'll get you from A to B, until you hit the sand dunes and realise you should have brought a Jeep instead.
They're both cars, but one is far more suited to the task at hand, while one is effectively, useless.
55:55:44:44:4C
52:4C:52:42:41

moryoav
Posts: 13
Joined: Tue Jul 08, 2014 8:44 am

Re: Button for Raspberry pi

Mon Jan 28, 2019 1:58 pm

Just to circle back to the original question, I'm looking for a momentary push button, one with 2 pins, to connect one pin to GND and the other to a GPIO, I'll then write the simplest python code ever to play an audio file once the button was pressed. That's the idea. And to have a few buttons like that connected to several GPIOs with different tasks like that. I now have my eyes on these buttons, so just to clarify, will those work for what I've defined?

https://www.aliexpress.com/item/6pcs-lo ... 4c4dbZsUqB

Thank you again...!

PhatFil
Posts: 1344
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 3:06 pm

you could look at one of the projects that uses a $5 amazon dash button. Afaik you need to use a new un-registerd dash button. that way no wires resistors or soldering, just a bit of code ;)
for example
https://www.raspberrypi.org/magpi/hack- ... pberry-pi/

j

hippy
Posts: 5794
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 3:09 pm

moryoav wrote:
Mon Jan 28, 2019 1:58 pm
I now have my eyes on these buttons, so just to clarify, will those work for what I've defined?
Yes. Can't see any reason they wouldn't be.

User avatar
rpiMike
Posts: 857
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 3:29 pm

PhatFil wrote:
Mon Jan 28, 2019 3:06 pm
you could look at one of the projects that uses a $5 amazon dash button. Afaik you need to use a new un-registerd dash button. that way no wires resistors or soldering, just a bit of code ;)
for example
https://www.raspberrypi.org/magpi/hack- ... pberry-pi/

j
Have you done it ? Its quite an involved process for a beginner. The dash button is also not always 100% reliable.

A wired button would be simpler.

User avatar
Imperf3kt
Posts: 2655
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Button for Raspberry pi

Mon Jan 28, 2019 6:20 pm

moryoav wrote:
Mon Jan 28, 2019 1:58 pm
so just to clarify, will those work for what I've defined?

https://www.aliexpress.com/item/6pcs-lo ... 4c4dbZsUqB
They should work, but I won't say yes for sure. You'll notice they're AC switches and you want to use them for DC.
From my own experience from similarly rated buttons, they'll work fine, but they could potentially not be the best choice.
https://www.mouser.com/blog/which-switc ... s-ac-or-dc
55:55:44:44:4C
52:4C:52:42:41

PhatFil
Posts: 1344
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Button for Raspberry pi

Mon Jan 28, 2019 8:52 pm

rpiMike wrote:
Mon Jan 28, 2019 3:29 pm
PhatFil wrote:
Mon Jan 28, 2019 3:06 pm
you could look at one of the projects that uses a $5 amazon dash button. Afaik you need to use a new un-registerd dash button. that way no wires resistors or soldering, just a bit of code ;)
for example
https://www.raspberrypi.org/magpi/hack- ... pberry-pi/

j
Have you done it ? Its quite an involved process for a beginner. The dash button is also not always 100% reliable.

A wired button would be simpler.
No I have just bookmarked the page and added a dash button to my amazon wishlist where it has sat for a while.I currently use a few 433mhz wireless buttons . like this

Image

and

Image

which need a bit more h/w to translate the 433mhz to a mqtt/wifi signal. The dash button will get used here when i run out of 433mhz buttons ( i bought a few ....)

I Do use bluetooth on my pi-0-w to read ble tempertaure and humidity sensors (2x) and plant health sensors (8x). and while the setup does look a little daunting, you only have to cut and paste the commands 1 at a time.
though i would google for a guide more upto date to avoid s/w and system upgrade issues wich can ocour when following older guides..

I am just thinking that with small hands and any thin wires?? perhaps the pi is best kept above 4 feet high and a robust button unit can be left in small hands perhaps stuck solidly to something so it cant get swallowed too.. (ps hope your lad is a toddler and not a teen..)

Return to “Beginners”