Physical button help

Support for Air Player on the Raspberry Pi.

Moderators: Ralph, russ

Post Reply
Message
Author
richdmoore
Posts: 59
Joined: Mon Jun 29, 2020 12:22 am

Physical button help

#1 Post by richdmoore » Wed Sep 09, 2020 4:44 pm

Hello. I am trying to figure something out, and thought I would verify something before hopefully not letting the magic smoke out of my raspberry pi 3b.

As I discussed in my previous post, I was trying to make a hardware button attached to my pi that would start a safe shutdown. Obviously, I will need to add a physical button to do this.

Looking at the diagram here: https://siminnovations.com/wiki/index.p ... n_tutorial

It appears that I simply use two wires, one gpio into the switch, and the other side goes directly to ground. No resistors or other connections,

When I look at other generic web sites about both raspberry pi or arduino, it mentions that for a switch to work you need to use 10k resistor and a 1k resistor, and have connections to both the 3.3v, ground, and the gpio. I don’t understand it completely, but it mentions something called a floating gpio, which will randomly switch from low to high unless there is all the resistors/connections. It also mentions pull down vs pull up.

https://www.cl.cam.ac.uk/projects/raspb ... _switches/

Does someone mind explaining to me if I really need the resistors (or if it is a good idea but not necessary? I assume if I later move the circuit to an arduino, the connections will be the same? Is there any reason to use the 3.3v vs 5v connections? Does the resistors I need change then?

I really don’t want to destroy my pi because I don’t understand how to connect a button and create a short circuit. Is there a way to test for shorts before I hook up the circuit to the pi (I have a multimeter, but realty haven’t used it.)

Thanks for any help!

User avatar
Keith Baxter
Posts: 2715
Joined: Wed Dec 20, 2017 11:00 am
Location: South Africa

Re: Physical button help

#2 Post by Keith Baxter » Wed Sep 09, 2020 5:00 pm

Hi,

Did you look at the Air manager API. Find this section and it still does not help?

http://siminnovations.com/wiki/index.ph ... n_examples

Keith
AMD RAZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

richdmoore
Posts: 59
Joined: Mon Jun 29, 2020 12:22 am

Re: Physical button help

#3 Post by richdmoore » Wed Sep 09, 2020 7:30 pm

I linked to the same web page in my opening posts.

After searching, I found my answer in the diagram here (where it talks about the pull up):
http://siminnovations.com/wiki/index.ph ... button_add

Basically, from what I can tell, in air manager either the arduino or raspberry pi is programmed to make buttons automatically with a pull up, and must be wired up so when pushed it goes to ground.

From what I can tell from other raspberry pi programming sites, In the native language (not air manager) software, it looks like the program can either be set with a pull up, a pull down, or neither. In some cases connections to both ground and 3.3v are required to prevent “floating” phantom responses (the microprocessor can’t determine if the button is pushed or not).

It’s nice we don’t have to worry about resistors (with air manager using buttons) at least, it makes it more simple for me as a complete novice.

I was able to get a shutdown button working (with wires to a breadboard) with both an arduino and raspberry pi, now I need to figure out how to solders wires and mount a button.

User avatar
Keith Baxter
Posts: 2715
Joined: Wed Dec 20, 2017 11:00 am
Location: South Africa

Re: Physical button help

#4 Post by Keith Baxter » Wed Sep 09, 2020 7:39 pm

Hi,

My bad I missed that link you posted. Sorry

Yes indeed no resistors are necessary. Good luck with your soldering.

Keith
AMD RAZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

richdmoore
Posts: 59
Joined: Mon Jun 29, 2020 12:22 am

Re: Physical button help

#5 Post by richdmoore » Wed Sep 09, 2020 8:02 pm

Thanks, I have only soldered a couple of times in my life, so I will need it...

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests