Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Input on Raspberry Pi

Solved!
Go to solution

Attempting simple Digital Input on a Raspberry Pi 2 B, but only pin 7 is responsive to changes in grounding.

 

I'm using a simple jumper cable to take pin 39 ground and connect to the requisite digital pin (40, 11, 12, all the same).

all images I've caught online seem to indicate that simply grounding the DIO line will control it.

 

If there needs to be a more elaborate pull up/down circuit to use the other lines, that's fine, I'm just not finding it.

 

~,~

Norm 

0 Kudos
Message 1 of 17
(2,578 Views)

Hey NJKirchner

just tested and it is working fine.

i got gnd for my circuit from pin 39, 3.3 from pin 1

pulled up GPIO (7, 38 and 40 for testing) from 3.3V line of my protoboard

then used the unconnected jumper in photo for grounding the pins.

 

LV professional 2020 with makerhub toolkit installed. RPI 3. 

 

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
Download All
Message 2 of 17
(2,549 Views)
Solution
Accepted by topic author NJKirchner

Jorge,

Thanks for the reply.
I confirmed as well that a pulling circuit is necessary to properly commutate the DIO lines. Looks like pin 7 is a special snowflake that doesn't require it. 

For posterity, this should help anyone else

NJKirchner_0-1647619145527.jpeg

 

Message 3 of 17
(2,513 Views)

All GPIO pins on the Raspberry Pi can have a configurable internal pull-up or pull-down resistor around 60k Ohm. However the current Linx driver does not support controlling this aspect of the GPIO pins. And it is anyhow not recommended to use them, you don't see them, and they can be disabled by any software on the Raspberry Pi at anytime and then cause problems. With an external pull-up or pull-down resistor as needed, you know that there is a resistor and how it is connected.

 

The exception are GPIO 2 und GPIO 3 (pin 3 and 5) which are used for the I2C interface and always have a relatively low impedance pull-up connector of around 1.8k Ohm on board wired to it.

Rolf Kalbermatter
My Blog
Message 4 of 17
(2,503 Views)

Hi there,

 

I was hoping to enable some internal pull up resistors and saw this response and was discouraged - but alas I found a solution using the shell command.  Interestingly  when I left the GPIO (pin 6 in this case) unconnected, it read high already despite me not enabling the pullup.  So I measured from GPIO_6 to GND a weak pull-up current of 66uA equating to an equivalent  internal pull-up resistor of 60Kohm.  It was either defaulted to pull high or seems it was at one time set to pull high and the state is retained after power cycles.  Great for my application..  

 

But I want to (en/dis)able this pull-up from LabVIEW to ensure repeatability between RPis, I think I will send a custom command to the RPi shell (using system exec vi) to configure this.  E.g. from here and here, I just call raspi-gpio utility to enable GPIO_6 (pin 31) pullup I send

 

raspi-gpio set 31 ip pu

 

I had inconsistent results separating the ip and pu arguments into two separate commands.  YMMV.

Peter
0 Kudos
Message 5 of 17
(1,407 Views)

mmm, I wrote too soon and the above raspi-gpio command didn't seem to work for me (on my RPi Zero 2 W).  If I debug it I'll report back here but in the meantime I'm going to depend on the claim that:

 

"GPIO 0-8 have pull-ups to 3V3 applied as a default." 

 

which is why I measured a pull-up on GPIO_6 without doing any low level configuration.

Peter
0 Kudos
Message 6 of 17
(1,395 Views)

If you're going to do sys exec commandline stuff from labview on the Pi you have to do the "SSH Trick" https://labviewwiki.org/wiki/Chroot_SSH_trick 

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
0 Kudos
Message 7 of 17
(1,383 Views)

many thanks for that headsup Gradatim !  I will be sure to apply that SSH trick once I get the shell commands working from the shell itself.

Right now I can't even get the raspi-gpio command to work OK from within a native cmd shell window on the RPi itself.

 

On a related issue re Digital Input on the RPi Zero 2 W, would you happen to know if I could use the raspi-gpio command via shell to access the 9 out of 26 GPIO lines that LINX is not setup to access because it was instead coded to support the RPi 2B instead of the RPi Zero 2 W   (per here ) ?

 

Peter
0 Kudos
Message 8 of 17
(1,361 Views)

Should be able to. Once you're using a command line tool like that you're not subject to the hardcoded decisions in the linx toolkit.

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
Message 9 of 17
(1,347 Views)

Ok thanks Gradatim.  Hopefully I'll get raspi-gpio working via the shell first then I'll try the SSH trick.

Peter
0 Kudos
Message 10 of 17
(1,301 Views)