40Alpha
Posts: 1
Joined: Thu Sep 05, 2019 3:13 am

GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Thu Sep 05, 2019 3:14 am

I have no problem turning on and off pins on my rpi4 (using both gpio on the terminal and Gpiozero with python3) however when I connect a wire (which is connected to a switch) to the pin... it turns the pin output to 0. When I disconnect, it goes back to 1.

What is the deal here? When I take the connection and attach it to an always on 5V pin - the turns on!

Any thoughts?

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

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Thu Sep 05, 2019 5:24 am

You didn't connect a GPIO pin with the 5v pin did you? Because that's certain death for a Pi.
55:55:44:44:4C
52:4C:52:42:41

User avatar
Burngate
Posts: 6067
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Thu Sep 05, 2019 10:25 am

I'm not sure I understand your description.
I have no problem turning on and off pins on my rpi4
... so you've set the GPIOs to ouput, and you can set them to 0 (gnd) or 1 (3v3) at will.
How are you checking they do what you want? A meter? a LED and resistor?
however when I connect a wire (which is connected to a switch) to the pin... it turns the pin output to 0.
... that is only useful if you set the GPIO to input
Are you using a different pin from the first ones?

Also, what's on the other end of the switch?

pcmanbob
Posts: 7153
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Thu Sep 05, 2019 3:13 pm

Hi.

Might I suggest you have a look at the physical computing guide for python https://projects.raspberrypi.org/en/pro ... -computing

this will guide you through connecting switches to gpio inputs and things like LED's to gpio outputs.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”