4
\$\begingroup\$

Purely a theoretical question.

Consider a microcontroller whose only job is to turn 1 pin high and in the process the microcontroller supplies I1 current throught the pin. But suppose we have to turn 2 pins high then the net current supplied by microcontroller will be 2*I1. In such a scenario where can I find the additional current(if any) drawn into the microcontroller with respect to the first case.

I used a microcontroller as an example any IC would also suffice.

\$\endgroup\$
1
  • \$\begingroup\$ There is also the case where you can have leakage into the IC via GPIO. (See some cases of people powering ICs via GPIO[not recommended, but interesting], or pull ups turning ICs on). \$\endgroup\$
    – Wesley Lee
    Commented Sep 26, 2021 at 18:24

4 Answers 4

12
\$\begingroup\$

Here's a diagram of a microcontroller IC, with four outputs. The top two outputs OUT1 and OUT2 are sinking current from Vcc (via R1 and R2), and the bottom two outputs OUT3 and OUT4 are sourcing current to ground (via R3 and R4):

schematic

simulate this circuit – Schematic created using CircuitLab

"Is" represents the current drawn by the microcontroller to perform its operations, and does not include any current sunk or sourced by any of its inputs or outputs. On a datasheet this might be labelled "supply current".

OUT1 is being held low by the microcontroller, causing a voltage drop across R1, and resulting in current flowing down through R1, into the IC. Kirchhoff's Current Law tells you that this current must emerge at the GND power supply pin of the microcontroller.

OUT2 is high, at Vcc, causing no potential difference across R2, and no current.

OUT3 is low, at 0V, so there's no voltage across R3, and no current.

OUT4 is high, causing a voltage drop of Vcc volts across R4, and current flows out from the IC and down to ground through R4. This current is being sourced by the IC from its own positive power supply pin.

Using Kirchhoff's Current Law, we can make the following statements:

  • Current exiting (being sourced) at the IC's inputs and outputs must originate (enter) the IC via its positive supply pin, so current there will be the sum of all such currents and its own operating current.

  • Similarly, current measured at the IC's "ground" power supply pin will be the sum of all currents entering the IC (that the IC is sinking) via its inputs and outputs, plus its own operating current.

Edit: Supercat made a good observation in this answer's comments, that current leaving or entering this IC could be via another IC's input or output. Where I have put resistors in this example, you could equally imagine inputs or outputs of another IC. The resistors are there to illustrate possible current paths, but you could just as easily follow a current path into the Vcc pin of one IC, out of one of its outputs, into the input of another IC, and out of this second IC's ground pin. Here's a picture I've borrowed from this answer, showing how you might visualise the currents in a more complex scenario involving 2 ICs, and a transistor:

enter image description here

It might help to get an idea of how typical push/pull outputs work, and see how they sink and source current from/to their supplies. See this answer. It refers to the outputs of op-amps, but the principle remains the same.

Note that the power supply itself must be supplying all these various currents, and they must all return to the same voltage source. I've labelled these currents at the power supply nodes Vcc and GND, to illustrate this.

Your question is:

Will the net current drawn by a microcontroller equal the current supplied by it?

The answer is: Yes, if you include the device's own supply current, both in (from Vcc) and out (to GND).

A more complete answer is: Kirchhoff's current law tells us that the total sum of all currents entering the IC (via its positive power supply pin and any input or output pins sinking current) must equal the total sum of all currents leaving it (via its ground supply pin and any input or output pins sourcing current).

\$\endgroup\$
7
  • \$\begingroup\$ this is a very nice answer! \$\endgroup\$ Commented Sep 27, 2021 at 14:44
  • \$\begingroup\$ Some chips may, accidentally or deliberately, transfer current from some I/O pins to other I/O pins. Such a part might e.g. sink 1uA at 3.3 volts from VDD and 1mA at 3.3 volts from one I/O pin, and source 1mA to another I/O pin at 3.0 volts, and source 1uA to ground. \$\endgroup\$
    – supercat
    Commented Sep 27, 2021 at 16:29
  • \$\begingroup\$ @supercat R1 and R4 in my picture represents any scenario where an output's current leaves or enters this IC. Instead of a resistor, you could imagine any current path, including another IC's input. Perhaps I should mention this in my answer. \$\endgroup\$ Commented Sep 27, 2021 at 16:57
  • \$\begingroup\$ @SimonFitch: Your diagram doesn't allow for any possibility that current might flow directly from R1 to R4 without flowing through the VDD and VSS nodes. \$\endgroup\$
    – supercat
    Commented Sep 27, 2021 at 17:00
  • \$\begingroup\$ @supercat how might current entering via R1 leave via R4? I mean most outputs are independent push/pull transistor pairs, directly across the supply rails, and with no means for current to cross between them. \$\endgroup\$ Commented Sep 27, 2021 at 17:06
18
\$\begingroup\$

Will the net current drawn by a microcontroller equal the current supplied by it

No, because the microcontroller itself (its clocks, IO control drivers, its CPU) need current, too.

where can I find the additional current(if any) drawn into the microcontroller with respect to the first case.

Datasheet. It will be in the datasheet under "current consumption".

\$\endgroup\$
7
\$\begingroup\$

Almost.

You also need to add the current drawn by the IC itself. For a microcontroller, that current depends on which of its various functions are enabled. For any IC, that current increases as the clock frequency / switching frequency increases.

But, generally, you are correct: if the loads draw significant current (compared to the IC's own current), then you can assume that the current that the IC takes from the power supply is slightly higher than the current that the loads take from the IC.

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

"Will the net current drawn by a microcontroller equal the current supplied by it?"

Yes! This is Kirchhoff's current law. Of course, you must include the currents on all the pins, including "ground" pins, which "supply" current.

\$\endgroup\$

Your Answer

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

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