10
\$\begingroup\$

I was re-reading the perennial Electronics.SE post Decoupling caps, PCB layout

And in the very highly-voted answer it says:

Now remember that a microcontroller is a broad band current source with high frequency components

I don't see how this is the case. I have never seen a circuit where a microcontroller is a source of current. I am only aware of microcontrollers being a current sink. They receive their current from a power supply which is capable of supplying equal or greater current to what the microcontroller is drawing.

An output pin of a microcontroller might be possible to think of as if it was a source (if you ignore where the microcontroller gets power from - like how we sometimes omit drawing the power pins on op amps), but in actuality it is more like a highly complex switch which does or does not connect the output to the supply rails.

My assumption in these cases is that I have a big misunderstanding but I'm not sure what it is. How is an ordinary microcontroller a source of current?

To me if something is a current source, then you can, in isolation, connect it to a load which will receive that current, establish a voltage, and thereby drive power. A microcontroller does not do this - it is itself a load.

\$\endgroup\$
3
  • 9
    \$\begingroup\$ They are talking about (high frequency) AC behavior, source or sink doesn't really matter, the fact that it varies a lot does (as far as I understand it). \$\endgroup\$ Commented 2 days ago
  • 1
    \$\begingroup\$ While you can make an AC waveform that only sources or only sinks if you add enough DC offset, a purely alternating current signal spends half its time sourcing and half its time sinking. From the point of high frequency analysis where the DC is irrelevant and ignored, you will have both source and sink each cycle of the waveform. \$\endgroup\$ Commented 2 days ago
  • \$\begingroup\$ To complicate matters further, there are MCUs with built-in voltage regulators that may be used to supply external components (handy for low cost battery applications etc). \$\endgroup\$ Commented yesterday

6 Answers 6

5
\$\begingroup\$

I think the term "source" is tripping you up. From a certain perspective, a microcontroller is a current source, in the sense that it is passing current between its two supply terminals - from the perspective of the negative supply, the IC is indeed a source of current from a higher potential. From the perspective of the positive supply terminal, the IC is sinking current from that positive supply, down towards a lower potential (ground).

Engineers can throw the term "current source" around rather recklessly, knowing that other engineers are aware that everything passing current is either a source or a sink of current, from one perspective or another.

The context here, though, is that the IC represents a path for current to flow from one supply node to the other. This context also implies that the microcontroller IC itself is responsible for determining the amount of current that it passes. Every time a push-pull transistor pair (a digital gate) inside the IC switches state there's a significant but short-lived spike of current. There are thousands of them inside a microcontroller, all potentially changing state thousands, or millions of times per second. Each transition is a sudden burst of current, thousands or millions of them each second.

Even the loads on an IO (output) pin produce current transitions, every time that output changes state - an LED connected to one of the microcontroller outputs might be PWM controlled, switching between full current (say 5mA) and no current at all, thousands of times each second.

Each current transition is fast, with many harmonics at many megahertz, and the loop around which those changing currents must travel is an antenna. The trick is to make that loop as small as possible, to minimise emissions, and to alleviate the responsibility of conduction of those currents from the ground and power planes at large - hence local energy sources (capacitors) to take on that responsibility, and small current loops through the capacitors, rather than around the entire main supply loop.

Every single element (such as an LED, or microcontroller) in those loops can be considered a "current source", or sink; the LEDs are either 5mA sources/sinks or 0mA sources/sinks, but it's easier to call them just "sources", and let the reader decide which, according to whatever model and perspective he has in mind at the time. It is a bit lazy, but we know what it means.

One usually associates a current or voltage source as a source of energy (hence the name), but this is not always the case - you can charge a battery (voltage source) by pushing current the "wrong way" through it, changing the sign of the power product \$P=I\times V\$. Similarly you can deliver energy to a current source by changing the polarity of voltage across it. Again, the name "source" doesn't really tell the whole story, but if an engineer had to explain the distinction, in terms of power, or current direction every time, he'd quit - it's much easier to say "source", in every instance, and let the reader infer the meaning from context.

In the context of this discussion, which is strictly current, the author seems to be implying that these elements are passing current from +5V (or +3.3V) to 0V (ground), and are to a large degree responsible for the magnitude of that current, which if you think about it, is exactly what a current source does. It's clearly not a current source in the strict academic sense, though, so I understand your confusion.

Personally I would not have called it a current source. I would have said that it is modulating current at very high frequency. It's still true though that the positive supply node sees that current-modulating element as an "AC current sink", and the ground node would see it as a "AC current source".

\$\endgroup\$
9
\$\begingroup\$

How is an ordinary microcontroller a source of current?

This is jargon that experienced engineers use. This particular examples wraps several non-obvious assumptions and models, so I can understand it is not comprehensible to the less experienced.

First of all, we have a power supply, and a microcontroller drawing a DC operating current from that supply. The supply is the source of energy that the microcontroller uses. We don't usually mention the power supply explcitly, as it's always necessary.

The MCU draws a variable current from its power supply through the VCC pin, for instance when an output pin is driven high into a capacitive load.

We can see the effect of this variable current by putting a test resistor in series with the supply. Let's say we put a 1 Ω resistor between the MCU and its power supply. When it suddenly draws an extra 20 mA to charge the capacitor on an output pin, the voltage on the VCC pin will fall by 20 mV, due to the extra current.

It is because of precisely this effect that we put decoupling capacitors on VCC pins, to 'stiffen' (reduce the impedance of) the supply to stop this voltage variation when the current varies.

This variation in voltage can upset other ICs, upset this IC, and be emitted as EMI, so it's worth controlling. In order to control it, we need to analyse and model what is happening.

When we model this effect, we simplify and abstract. Rather than model the power supply, the IC, the test resistor, and the rest of the system, we call the MCU's VCC pin the source of the 20 mA step. The load or sink for this current source is all the other components connected to the VCC pin, taken in parallel, so the test resistor and any decoupling capacitors.

As the MCU operates, the current will fluctuate up and down, and it will emit many step changes of current, some positive, some negative, as an AC noise current. The power of this signal, the joules per second, is ultimately sourced by the power supply. However it's the operation of the MCU that is controlling the current in this signal.

On a strongly related notion - if you look at any transistor model, you will see the transistor is modeled as a current source, the power supply and all its bias components have been simplified out. The transistor does exactly the same thing as the MCU, draws a varying bias current from the supply.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ I wouldn't call this jargon. It's basic circuit theory. If the author wanted a bit more clarity at the expense of a few more words they could have said the microprocessor acts like a current source -- I'm not sure which I'd prefer if I'd written that, and would probably swing different ways on different days. \$\endgroup\$ Commented yesterday
  • 1
    \$\begingroup\$ @TimWescott Jargon, or technical language, is the specialized terminology associated with a particular field or area of activity. Jargon is normally employed in a particular communicative context and may not be well understood outside that context. Wikipedia. I tell it like it is. Jargon is one of things that separates noobs and tiros from 'masters'. I am a master of very few topics, painfully few, so I call it out when words are used in a different context to how normal learners would use them. The OP seems to be quite intelligent, but lacking the vocabulary and context. \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ Still not quite following. When you say "we don't worry whether the IC is sinking or sourcing a DC current, we still say it is sourcing an AC current." - the socket in my wall provides a source of AC current. If I hook up a device to it, AC current is available to me. I can use that AC current to power a device designed to be powered by it. I can't do that with a microcontroller. A microcontroller can never be a source of power. It draws power, and it can redirect it, but it is never the source of AC, DC, or anything else. \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ @TJM It's the 'redirecting it' bit that you're missing. Just a tiny bit of the DC it's receiving is turned into AC by the fact that it's changing the amount of DC current that it pulls from the power supply. If it pulls 10.5 mA now, and then 9.5 mA later, that's a step of -1 mA. We say that this step is 'sourced' by the MCU VSS pin. It has to flow somewhere. It flows in the impedance of the power supply rail. Hopefully it's a low impedance decoupling cap, which absorbs that current step with minimal change in rail voltage. If not, it generates a large voltage on the power rail's inductance. \$\endgroup\$ Commented yesterday
  • 1
    \$\begingroup\$ @TJM I've completely overhauled my answer following these discussions. Hamburgers could be made to work, but it's difficult to define the voltage of a hamburger, perhaps it's price. The current/flow is much easier. A customer in the restaurant eats 100 burgers a week. If one week he suddenly wants only 90, we could simplify that as he is then the 'source' of a current of 10 hamburgers. If we wants 110 in one week, he is a source of -10 hamburgers. This hamburger current will or will not alter the price, depending on whether the resturant has a local stock in their decoupling capacitor. \$\endgroup\$ Commented yesterday
3
\$\begingroup\$

[...] but in actuality it is more like a highly complex switch which does or does not connect the output to the supply rails.

where "it" refers to a microcontroller's GPIO output driver...this statement is true for the static case. In this case, a GPIO is a low-resistance switch of a few tens-of-ohms connected either to GND or to +supply.

The highly-rated answer also refers to microcontroller outputs, describing them as a current source. This answer expands the paths right back to the DC supply for the microcontroller. The bulk of this answer involves transient current as a GPIO switches from high-to-low or from low-to-high. It is useful to imagine how these fast transient currents flow: what inductance and capacitance and resistance they see as they propagate from supply to the switch inside the chip.
In this view, Olin talks about current flow, because the inductance and capacitance encountered are at least as importance as the switch internal resistance as the transient is changing.

After a transient change has settled, your simpler view of a switch having tens of ohms resistance is a better model accompanied by a caveat that it is true only near GND or near the +supply rail...if the GPIO needs a lot of current to pull high or to pull low, and is at some mid-point between GND and +supply, the model breaks down. After all - a GPIO is not a linear driver as a simple Thevenin model suggests.

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

The microprocessor consumes current, so it looks like a current source from VCC to ground. The author could have said "looks like" a current source, but "is a current source" is perfectly accurate, as long as you accept that sinking current is the same as being a source.

For illustration purposes, here is a model of what the author would have been saying: the microprocessor consumes varying DC current, which you can model as a steady DC current plus variation (the real variation won't just be a sine wave, though). The supply to the microprocessor goes through some unknown impedance (which I model as a resistor and inductor, but is going to be more complicated in real life).

You need decoupling capacitors because the varying current works against the effective impedance of the power supply and the board traces (and maybe wires) bringing power to the micro; this varying current through an impedance creates a varying voltage, which can do very bad things to the operation of the microprocessor and surrounding chips.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
6
  • 3
    \$\begingroup\$ "The microprocessor consumes current, so it looks like a current source from VCC to ground." - this sounds to me like a direct contradiction. I consume hamburgers. Does that make me a source of hamburgers? Of course not! I eliminate hamburgers. I am the opposite of a source. A microcontroller might be requesting varying current from a supply, but that current is still coming from the supply. When I say "one hamburger please", I'm causing a hamburger to flow into me, but I am not the hamburger source - the restaurant is the source. \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ To satisfy physics, a DC current source must have current flowing into one terminal while the current flows out of the other. So if you're talking theory (which we are, because it gives you an effective model for a practical problem) a current source that has current flowing from VCC to ground is nothing special -- it's just a current source. The electrons don't get digested inside the source into something else -- they just pass through. \$\endgroup\$ Commented yesterday
  • 2
    \$\begingroup\$ they don't pass through though. They are forced through. If I have a battery and a light bulb, one of those components is pushing the current whole the other is passively letting it through. Therefore one is the source of current and the other is not. \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ @TJM: Your microcontroller is not passively accepting current. It is filled with active components, and it is the cause of variability in the current draw. Cause = "source", variability = "AC". It is an AC current source. As Tim has shown, one also uses a "DC Current Source" symbol for the DC operating current, just being careful about the polarity. The key is whether the microcontroller regulates its own current regardless of the supply is doing. If it does, circuit theory treats it as the "source". "source" means cause, not supply. The microcontroller is NOT a current supply on VDD. \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ @TJM you are swimming upstream against over 100 years of electronics engineering convention. If you're going to pursue electronics engineering you have to know when to accept a theoretical framework on its own terms. In this case, treating an electronic load (i.e., the microprocessor) as a source that just happens to be consuming energy is a very useful theoretical tool, that gives very accurate results for very little effort. So -- that's what we all do. \$\endgroup\$ Commented yesterday
1
\$\begingroup\$

Apparently you are fine with the notion of the microcontroller being a high-frequency broadband AC current sink, correct?

Now when designing the power supply and decoupling, we usually represent the power supply impedance as a complex value, given by magnitude and phase. The essential part, that decides whether our circuit will run fine or act up, is almost always the magnitude of the power supply impedance.

Now, the only difference between an AC current sink and an AC current source would be in the phase. So when discussing power supply decoupling, (where we care only about the magnitude), people tend to simplify irrelevant minor matters such as the destinction between an AC current sink and source, and just refer to that with the more general term "source". In this context, "source" might be picked over "sink" because the microcontroller is the source of the power supply disturbance.

\$\endgroup\$
0
\$\begingroup\$

An aside:

An output pin of a microcontroller might be possible to think of as if it was a source

... or a sink. Because, ultimately, most CMOS digital outputs are current-limited. They act as resistors up to a certain absolute value of current, and above that they act as current sources/sinks. That's because MOSFETs eventually saturate and then they stop acting like resistors and start acting as current sources/sinks.

I am only aware of microcontrollers being a current sink.

Current sources are generally bidirectional, and that's how that term was used in the context you refer to. The sink/source distinction applies in DC analysis of individual pins, and is a matter of convention. A microcontroller as a whole is "just" a current source because we're not referring to any particular pin.

A CPUs VCC pin is a current sink - but no one said that this was the pin being spoken of, you just assumed. The CPUs GND pin is a current source. Except sometimes not, e.g. when a whole lot of gate capacitance inside has to be charged to an opposite level. The current flow may temporarily reverse then. That's especially the case in very low power modes when the MCU consumes a couple μA, and some large output transistors (GPIO pin drivers) have to switch state.

\$\endgroup\$

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.