# Simplest way to limit current from MCU pin

I'm trying to build a very simple flyback power supply capable of only about 1mA. The basis is to supply a PWM wave to a 1-1 sepic inductor (shielded coupled inductor).

The problem is that it would be easy for the inductor to saturate and essentially short to ground.

It feels like there should be a simple and inexpensive way to limit current going to the coil (magical cccs1 below). For example, a FET + a gate resistor that will limit current through the inductor?

simulate this circuit – Schematic created using CircuitLab

Note. the circuit above is obviously incomplete for simplicity sake

• Usually a series resistor is used to limit current. What's wrong with that here? Jan 12 at 16:12
• The circuit may be incomplete but, if you want it to be a flyback converter, the dot notation on your transformer is wrong. Jan 12 at 16:27
• Limiting is not the same thing as regulation. Limiting = "never let it exceed this level", Regulating = "force it to this level and keep it there no matter what" Jan 12 at 17:23
• @Andyaka Thanks! only saw the polite "two faces talking" notation on circuitLab. Any chance you can opine on a solution? Jan 12 at 17:55

I'll assume that you don't want to just use a resistor, which would be the easiest and most straightforward solution.

A constant-current diode is probably the easiest solution for limiting current, at least when a resistor alone won't do. You can just buy one, but you can also make your own as the actual circuit is quite simple:

simulate this circuit – Schematic created using CircuitLab

Of course, what resistor you need to use depends on the threshold voltage and gain of the JFET, so it's not the most temperature-stable nor is it particularly stable with respect to device variations, but it's hard to get simpler if all you need is to limit current.

You can do a little better for stability by using a TLV431, and perhaps a lower voltage drop as well:

simulate this circuit

Here, the current will be limited to whatever current is necessary to generate a 1.24 V voltage drop across R1, plus whatever current R2 allows through the TLV431. The value of R2 isn't critical, but should be low enough to allow at least 0.1 mA (or whatever $$\I_{K,MIN}\$$ is for your specific TL(V)431) into the TLV431 cathode and enough left over to drive Q1. Note that if you use a TL431 instead of a TLV431, the voltage across R1 will need to be 2.5 V, not 1.24 V.

Any of these solutions will produce a voltage drop even when the current is below the limiting value, so be aware of that. There is an easy solution that won't produce much of a voltage drop: the current mirror, shown below.

simulate this circuit

Here, the current through Q1 is equal to the current through Q2. This has a few downsides, however: it relies on the transistors being exactly matched, and the current through Q2, set by resistor R1, is just wasting power in that resistor. There are ways to mitigate the matching requirement, though not eliminate it entirely, but there will always be wasted power in the resistor. This is why I tend to prefer the other options when possible; they have less of a constant power draw.

• I actually really like this since the output current is so small, so you could probably get away with this for pretty cheap. Jan 12 at 17:13
• @KevinSullivan to which "this" are you referring? three [good] solutions here. Jan 12 at 18:01
• @Hearth on the last suggestion: could you then "drive" the transistors by applying the PWM to the R1-Q2 joint? They do have matched pair BJTs. Off the shelf current limiting diode below 10mA gets really expensive, though I think there is a solution there. Thanks for the suggestions! Jan 12 at 18:17
• @MandoMando the constant current diode specificaly Jan 12 at 19:10
• @KevinSullivan Regarding the constant-current diode, do be aware that it has some pretty severe flaws! It's not even close to temperature-stable, you can't accurately predict what current will flow, and it functions like a pn diode in reverse which is likely to fry the jfet if you use it in reverse (though the use of a second jfet can limit current in the other direction too). And it needs to use a jfet, which can't handle that high a voltage unless you use one of those SiC ones. I suppose it'd work with a depletion-mode MOSFET as well... or a vacuum triode, come to think of it. Jan 13 at 2:26

Most integrated IC’s for flyback circuits have some form of current-mode control, where they use a shunt to read the current in the switch, and keep it from going over a certain threshold. This effectively acts like a series resistor, but it doesn’t dissipate power as if a real resistor was placed in series with it.

Depending on how robust / efficient you want to make this, that might be a path worth exploring, but if you are looking for a quick-and-dirty solution, a resistor would be the easiest way to do this.

Side-note: a gate resistor will not limit the current going into the inductor, because a switching power supply either operates with the signal going to the inductor on or off (not partially on as you are hoping to add an effective impedance).

Personally I think this is bad practice to power anything off an MCU pin, except maybe a small diode. Even 1mA, and especially a transformer. I'd just a transistor and then add a series resistor for current limiting.

By the way, I don't think you actually want current REGULATION through the transformer primary. Current limiting yes, but current REGULATING is something different. Current regulating means a constant current and also implies forcing the current in the coil to be some value. This can involve wild voltages (think about the voltage required to force a step change in current through an inductance).

• yes, current limit. and yes, you likely want to sink and not source from MCU pins. That's besides the question here. Jan 12 at 18:07

The whole point of a switching supply is that the transistors act like switches, to minimize power dissipation.

Either they're on, conducting current but dropping very little voltage, or they're off, dropping lots of voltage but conducting no current. In either of the above case, the power is something times zero.

If you regulate the current, then you'll have to drop a non-zero voltage to do that, at which point you'll suddenly start dissipating lots of power.

I suggest that you find the smallest chip that you can that'll support the converter topology you want, and go with that. It'll have all the features you need for it to just work, and you won't have to burden the processor with that task*.

* And note -- I'm usually irritating people by telling them to move analog functions onto the microprocessor. Some things you just don't want to mess with.

• @TimeWescott, "dissipating lots of power" the goal is 1mA 5V of power. unfortunately the smallest chip that supports this is > 40% cost of total BOM. there has to be an easier way including something like a series cap. Jan 13 at 15:32