2

I've not used GPIO on RPi much. On other hardware, the GPIO pins can be configured in software to be in a "High Impedance" state (Hi-Z). I have assumed that it's possible to place most of the RPi GPIO pins in Hi-Z, but after some searching, I find nothing that supports that assumption.

Q: Is it possible to place a RPi GPIO pin in High Impedance state, and if so, how is that done?

8
  • Ah let me see. It depends on what do you mean by "High impedance". Let us start with something we generally agree and then move on later. (1) Rpi GPIO pins can be set to Input Mode or Output Mode. Now let us first look at the output mode, then later input mode. Whenever any "thing" is in output mode, it can source or sink current, and the "thing" has internal impedance (or to make things simple, we can imagine it to be resistance). Usually this resistance is very low, perhaps less than 10 Ohms. So we can say that (2) The GPIO pin set to Output mode is in Low impedance/resistance state.
    – tlfong01
    Sep 14, 2020 at 5:59
  • 1
    @tlfong01: The link in my question for Hi-Z says The basic concept of the third state, high impedance (Hi-Z), is to effectively remove the device's influence from the rest of the circuit. For practical purposes, it means that it conducts very little current - as in this example
    – Seamus
    Sep 14, 2020 at 6:34
  • Ah sorry, I did read your question carefully, and I did not read your link for high impedance. I should read that later and see if I should comment again. Cheers.
    – tlfong01
    Sep 14, 2020 at 7:24
  • I quickly read the wiki link of high impedance and found the following very important: "The basic concept of the third state, high impedance (Hi-Z), is to effectively remove the device's influence from the rest of the circuit.". I have never paid attention to this very important concept, so I should say I never thoroughly understand the concept/idea/reason of the term/definition of the term HiZ. Thanks again for pointing point my ignorance in electronics. Cheers.
    – tlfong01
    Sep 14, 2020 at 7:32
  • 1
    For TTL circuits, just for example, 100M Ohm can be considered "high" impedance, because 100M has almost no influence to the rest of the TTL circuit. But for CMOS circuits, 100M might not be "high" (impedance) enough. (3) Perhaps this topic is too "technical", and should be discussed in EE SE.
    – tlfong01
    Sep 14, 2020 at 9:19

1 Answer 1

4

Tri-state output circuitry as used for most computer busses can be set Low, High or HiZ. In fact many circuits actually have 4 states as they can be set as Inputs. The state of a bus (consisting of a set of grouped pins) is typically controlled by one or more enable pins.

The GPIO has no similar setting; Outputs can be Low or High; they can alternatively be set as Inputs (with optional pull). Each GPIO is independently controlled.

When set as Input the GPIO is effectively in a high impedance state. All that is needed is to set the pin to Input with no pull.

The Pi actually can be configured into a kind of bus - the SDIO is a 4 bit wide bus with a CLK and CMD pin which is used for bi-directional communication e.g. to SD Card.
The I²C interfaces are also a kind of 1 bit bus, normally with open drain circuitry but simulated on the Pi by configuring as Input.

6
  • All that is needed is to set the pin to Input with no pull. OK - that makes sense, but I think my question asked "how" that was done... By that I mean what settings are needed - in any library you choose, or in the sysfs files, or whatever. Or, are you saying that all that's needed is to set the input to zero with no other commands at all? Try to make sure your answer jibes with your comments here :)
    – Seamus
    Sep 14, 2020 at 6:28
  • @Seamus there are many methods, from writing direct to Pi registers, using kernel drivers or any of the common libraries. I don't know what "set the input to zero" means - just set as Input.
    – Milliways
    Sep 14, 2020 at 6:31
  • Any one will do... Also curious to see you answer this question given your comments on the other question a short while ago. I'm still curious about that, but if you don't wish to address it, please just say so.
    – Seamus
    Sep 14, 2020 at 6:40
  • 1
    You could use gpiozero.InputDevice(pin, pull=None)
    – Milliways
    Sep 14, 2020 at 6:48
  • OK - I'd like to verify that before I select your answer. In the meantime, would you please edit your answer to include this code, and wordsmith a bit so that your answer says "Yes" (It is possible to place a GPIO pin in a high impedance sate)?? Thanks
    – Seamus
    Sep 14, 2020 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.