0
\$\begingroup\$

I have been trying to figure out some details of the GPIO handling. I dont really know anything about electro engineering and am pretty much working with common sense all the time. While researching some GPIO limits I realized that the raspberry pi GPIO generally says that you can sink "16ma in OUT mode" and sink "0.5ma in IN mode". I am having a really hard time wrapping my head around what exactly the difference between configuring an output pin in output mode and setting it to Low is compared to an input PIN in whatever state.

Initially my first thought was that a LOW output pin is the same as an input pin. But the simple fact that all the recommendations say that you cannot sink the same current into an input pin and a low output pin makes me think that my thoughts are wrong.

What exactly is the difference between an input and an output pin (set to LOW) on electronics level (not software).

\$\endgroup\$
5
  • \$\begingroup\$ There is no LOW mode. LOW is the state of the pin, that is a logical 0. \$\endgroup\$
    – Eugene Sh.
    Nov 26 '20 at 21:59
  • \$\begingroup\$ Thanks, I got rid of that "state" and "mode" that could be misleading \$\endgroup\$ Nov 26 '20 at 22:01
  • \$\begingroup\$ Anyway, I afraid your question is not very clear. When a pin is in input mode, it is in general in high-Z state, that is kind of "disconnected" and not having any defined output voltage, so that an external signal can impose input voltage on it. When it is an output pin, it can be set to either high or low voltage state. \$\endgroup\$
    – Eugene Sh.
    Nov 26 '20 at 22:05
  • \$\begingroup\$ I think you might actually be going into the direction of the answer of my question. I dont really have any idea about anything related go GPIO and your mentioning of external devices imposing a voltage on the GPIO PIN is probably going into the right direction. I guess the simples way to formulate my question is: "Why does the raspberry pi have a different maximum current for input and output" \$\endgroup\$ Nov 26 '20 at 22:07
  • \$\begingroup\$ I removed any mention of the relay as it adds nothing to the question. \$\endgroup\$ Nov 26 '20 at 22:14
3
\$\begingroup\$

Raspberry Pi GPIOs are a bit complex.

As an output they drive to either supply voltage with a few selectable drive strengths. The voltage drop at a given current depends on a few factors, but you shouldn't try to source (when high, load to ground) or sink (when low, load to Vcc) too much current. 16mA may be okay under most conditions. It can sink current better than it can source it (less than half the voltage drop)

As an input they can be high impedance, or have a pullup or a pulldown enabled. The pullup is a resistor to Vcc and the pulldown is a resistor to ground. The value of resistance is in the 50-65K range, so the current will be more like 50 or 60uA than 500uA.

An input with a pulldown resistor looks like a 50-65k resistor to ground.

An output set to low with maximum drive current capability looks like about 120 ohms (max) to ground provided you don't ask it to sink too much current.

\$\endgroup\$
2
\$\begingroup\$

An output pin that is set high can push out (source) current, or when set low it can pull in (sink) current. An input does neither, it ideally needs no current to flow to sense if the input is high or low. Sometimes there can be internal or external weak resistance to keep the default voltage at some level, and some small amount of current then flows via the resistance.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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