Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Can't read gpio input via gpio or pigs

Sat May 23, 2020 4:19 am

I'm trying to set up an input on a gpio pin in php, but I can't get either the gpio or pigs commands to output "1" when it should. Commands I'm using:

gpio -g read 27
or
pigs r 27
(outputs 0 no matter what, mode is set to in)

I'm using a 4B.

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:33 am

What have you connected to GPIO 27?

https://pinout.xyz/pinout/pin13_gpio27

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:39 am

rpiMike wrote:
Sat May 23, 2020 5:33 am
What have you connected to GPIO 27?

https://pinout.xyz/pinout/pin13_gpio27
I currently have a button for testing

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:41 am

Muchieman7 wrote:
Sat May 23, 2020 5:39 am
rpiMike wrote:
Sat May 23, 2020 5:33 am
What have you connected to GPIO 27?

https://pinout.xyz/pinout/pin13_gpio27
I currently have a button for testing
Is the button connected between 3.3V and GPIO 27?

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:41 am

rpiMike wrote:
Sat May 23, 2020 5:41 am
Muchieman7 wrote:
Sat May 23, 2020 5:39 am
rpiMike wrote:
Sat May 23, 2020 5:33 am
What have you connected to GPIO 27?

https://pinout.xyz/pinout/pin13_gpio27
I currently have a button for testing
Is the button connected between 3.3V and GPIO 27?
Yessir

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:48 am

Post a photo of your wiring.

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 5:55 am

rpiMike wrote:
Sat May 23, 2020 5:48 am
Post a photo of your wiring.
https://imgur.com/a/1xn3X4A

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 6:00 am

Try temporarily bypassing the switch with a wire between breadboard lines 4 and 6.

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 6:01 am

rpiMike wrote:
Sat May 23, 2020 6:00 am
Try temporarily bypassing the switch with a wire between breadboard lines 4 and 6.
I've done that, still nothing.

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 6:05 am


Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 6:12 am

Code: Select all

[email protected]:~/Downloads $ ./gpiotest 
This program checks the Pi's (user) gpios.

The program reads and writes all the gpios.  Make sure NOTHING
is connected to the gpios during this test.

The program uses the pigpio daemon which must be running.

To start the daemon use the command sudo pigpiod.

Press the ENTER key to continue or ctrl-C to abort...

Testing...
Skipped non-user gpios: 0 1 28 29 30 31 
Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
Failed user gpios: None

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 6:31 am

Have you got a multimeter? If so test you have 3.3V between ground and line 6 of the breadboard.

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 7:03 am

pin 27 is outputting 3.3v

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

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 7:08 am

Do you mean 3.3v is being fed into pin 27?

Did you test with a multimeter? Are you running ‘pigs r 27’ from command line?

Muchieman7
Posts: 9
Joined: Mon Oct 28, 2019 5:44 am

Re: Can't read gpio input via gpio or pigs

Sat May 23, 2020 7:12 am

I was using the gpio one, for some reason the pigs one works now. I don't know what changed, other than a second reboot. Thanks for your help

Return to “Troubleshooting”