2
\$\begingroup\$

I am trying to figure out a good way to word this question, but I don't think my electronics vocabulary has yet matured enough to use the correct terms. I'm working with building simple circuits on a Raspberry Pi for the first time.

To start, I understand that the input and output pins on the Pi read out a value of either 0 or 1 depending on if the voltage applied to them is either high or low, relative to ground.

I also know that if you build a circuit in parallel, then each branch of that circuit will have the same voltage as the potential source, but with a lower current.

Thus, I got to wondering: if you had a single pin output, for example, 3.3V, and had it split in a parallel circuit of very many branches, so that the current in each branch became extremely small, would the equal amount of input pins connected to each of the branches still recognize a high or low signal?

Basically, does it matter whether the current in a high/low signal is 3mA or 0.0003mA? Is the voltage the only thing that matters?

\$\endgroup\$
  • \$\begingroup\$ you need enough current to produce the trigger voltage by converting the amps to volts via the internal resistance. \$\endgroup\$ – dandavis May 23 '17 at 17:44
  • \$\begingroup\$ Adding "many branches" to a constant-voltage output does not cause the current in each branch to go down: It causes the total current to go up. If your output pin maintains 3.3V across a 100Ω resistor, that's 33mA. If you add a second 100Ω resistor in parallel to the first, then each resistor gets 33mA, for a total of 66mA. Add enough parallel resistors, and eventually the output pin will no longer be able to maintain 3.3V (A condition that may be permanent!) \$\endgroup\$ – Solomon Slow May 23 '17 at 21:36
  • \$\begingroup\$ @jameslarge Ah, you are absolutely right! That one I really should have known - luckily that blunder didn't impede an understanding of the main blunder I was having :) \$\endgroup\$ – bream May 23 '17 at 23:33
5
\$\begingroup\$

I am assuming your question is: "Does current affect the reading on microcontroller input pins?"

Typical input pins, be them digital or analog, read only voltage and are high impedance. That is to say that the input pins have a large resistance (1MΩ+), and in turn will not allow much current to flow. But there is some leakage current (often less than 1μA).

If you have a DC 5V signal and connect it to multiple input pins, you would multiply that leakage current (though the voltage would not be affected).

However, with enough current draw, a voltage source may lower its output. Depending on the what is supplying the 5V, it is highly unlikely that the tiny amount of current would be enough to drop the voltage unless there were hundreds of input pins reading the voltage of a small capacitor that is not being charged.

\$\endgroup\$
  • 2
    \$\begingroup\$ More reading: en.wikipedia.org/wiki/Fan-out \$\endgroup\$ – Dampmaskin May 23 '17 at 17:40
  • 2
    \$\begingroup\$ I think this was the crucial information that I was looking for. So if I'm understanding correctly, the main takeaway is that current doesn't actually (appreciably) flow through the input pin in a circuit loop at all? And if I connected an ammeter in series directly between an output pin and input pin on an MCU, it should read effectively zero, neglecting the leakage current? \$\endgroup\$ – bream May 23 '17 at 19:23
  • 2
    \$\begingroup\$ @bream - Correct. As with voltmeters, micro input pins sink very small amounts of current because they only need enough to read the voltage. (Plus the more current they sink, the more they affect the circuit.) \$\endgroup\$ – Bort May 23 '17 at 19:27
3
\$\begingroup\$

Since you are discussing an output pin (one that is configured as an output and not as an input), there are several related ideas that may help answer your question: output impedance/resistance and/or current compliance. I'm sure there are others, but those two immediately come to mind.

I'll spend a moment on the latter term first: current compliance. This term is often applied to power supplies providing a regulated output voltage. The current compliance is the amount of current that the power supply can provide without exceeding it's other specifications (such as its ability to hold the voltage sufficiently near to the specified output voltage, or its ability to dissipate heat while providing that level of current.) While this term is fairly common for power supply specifications, it can be used almost as well for output pins to signal limitations in their ability to sink or source current (when LOW, they are "sinking" and, when HIGH, they are "sourcing" [if the MCU uses a positive valued voltage supply, anyway.])

However, it's the first term that is probably more swiftly understood and applied in cases like this. The output resistance of the output will likely be different when LOW vs when HIGH. Let's find out why and, in the process, also learn some added details that may help you more generally. (I'm drawing from another answer I provided today, which is convenient for me and for you.)

In a typical CMOS MCU output, when they drive LOW, they turn on an N-channel MOSFET; and when they drive HIGH they turn on a P-channel MOSFET. (They never turn both of them on at the same time!) Because of the differences in mobility that apply for N-channel vs P-channel (about a factor of 2 to 3 difference), it takes extra effort to make the P-channel device exhibit similar "quality" as a switch.

Let's look at an example from the Microchip PIC12F519 (one of the cheapest parts from Microchip that still includes some internal, writable non-volatile storage for data.) It's datasheet includes this chart showing the LOW output voltage (vertical axis) vs the LOW sinking current (horizontal axis), when the CPU is using \$V_{CC}=3\:\textrm{V}\$:

enter image description here

To read this chart, look at the horizontal axis showing the sinking current. They don't show the chart going back to zero because it's not necessary. It's enough to see that there is only a tiny voltage (about \$230\:\textrm{mV}\$) when sinking \$5\:\textrm{mA}\$. What this means is that if you hooked up a circuit to this pin, where LOW means ON (such as an LED?), then there will only be less than a quarter volt loss at the I/O pin. So if you had a \$3\:\textrm{V}\$ power supply providing voltage to the other side of the circuit, then if the circuit only needed \$5\:\textrm{mA}\$, then the circuit would see about \$3\:\textrm{V}-230\:\textrm{mV}=2.77\:\textrm{V}\$. That's usually "good enough" to work.

How does this apply to output resistance? Well, given the drop of about \$230\:\textrm{mV}\$ at a sinking current of \$5\:\textrm{mA}\$, this works out to an output resistance of about \$R_{LOW}=\frac{230\:\textrm{mV}}{5\:\textrm{mA}}\approx 46\:\Omega\$. You can compute this at the higher current of \$10\:\textrm{mA}\$: \$R_{LOW}=\frac{420\:\textrm{mV}}{10\:\textrm{mA}}\approx 42\:\Omega\$. So from these two bits of data, I'd say that the output impedance is approximately a consistent \$50\:\Omega\$ when LOW and running on \$3\:\textrm{V}\$.

This is very useful to know because now you can work out the details of how much voltage you will have left over, given any particular expected load current using basic electrical laws: Ohm's, Kirchhof's voltage and current laws, and Thevenin/Norton equivalents.

Separately, this next chart shows the HIGH output voltage (vertical axis) vs the HIGH sourcing current (horizontal axis), also when the CPU is using \$V_{CC}=3\:\textrm{V}\$:

enter image description here

(You can easily see that they don't even bother trying to show the same sinking vs sourcing current capabilities between these two charts.)

You can now see in this second chart that the PICF519 will typically drop about \$600\:\textrm{mV}\$ at a sourcing current of \$4\:\textrm{mA}\$, suggesting an internal resistance of about \$R_{LOW}=\frac{600\:\textrm{mV}}{4\:\textrm{mA}}\approx 150\:\Omega\$.

(NOTE: In both charts above, I've extracted data from the curves for \$25^\circ\textrm{C}\$.)

Note that the above calculations at nearby sinking vs sourcing currents also show two resistance values that are approximately a factor of three from each other (about \$50\:\Omega\$ vs \$150\:\Omega\$.) This suggests that the size of the two mosfets used to drive the output are about the same size, but that the difference in output resistance is due instead to differences in mobility that I mentioned at the outset, that between P-channel and N-channel mosfets.


From the above, you find a couple of useful ideas. One is that an I/O pin configured for output will have greater current compliance when using LOW as the active (ON) state than when using HIGH as the active (ON) state. Two is that you can use the idea of output resistance to help you work out the price you pay (in the voltage drop you lose at the output pin and which is therefore not available to the circuit), given any specific proposed external circuit. You can even work out from this whether or not you will need extra, external transistors to "boost" the current compliance.

So these two ideas are complementary and quite useful. And I've shown you how you might extract useful information from a datasheet, as well.

Note that this output resistance sets useful limits to what you can directly drive from any output pin. So to directly answer your question, "Does it matter whether the current in a high/low signal is 3mA or 0.0003mA," the answer is, of course, "Yes, it matters!"

\$\endgroup\$
  • 1
    \$\begingroup\$ So.. does that mean yes or no? (just kidding, nice answer! +1) \$\endgroup\$ – Wesley Lee May 23 '17 at 18:16
1
\$\begingroup\$

I think what you're asking concerns fan-out.

A logic gate output running off a Vdd/GND supply consists typically of two transistors: one connecting Vdd to the I/O pin and one connecting the I/O pin to GND. This used to be called a totem-pole output, though it probably isn't nowadays.

In early logic gates of the 60s and 70s (such as 74xx/74LSxx), transistor and IC technology meant that these output drivers could only provide a few mA and the input circuits loading them would take near-on-mA from their driver.

This lead to the term 'fan-out'. This is the maximum number of inputs that one output could drive, within a particular logic family. Fan-out figures like 10 or 20 were common, so it was a restriction to be aware of when designing.

The introduction of 74HC(T) logic saw gates with outputs in the order of 10 mA and inputs drawing 10 uA. This showed the improved capabilities of logic chips when introduced in 1986. The importance of fan-out started to fade.

Today's MCU logic-level I/O pins are excellent in both the relatively high output current they can drive out and the relatively tiny input current they draw from what's driving them. Output with many 2..20 mA are now loaded with 1..3 uA or suchlike.

\$\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.