September 11, 2018

Boost Converters and Falstad's Simulator

Preface: I wrote this over the course of a couple of evenings. I started out wanting to show off Falstad's super handy simulator. During the course of writing the text I realized I'd almost completely missed the point of what was happening. If you listen closely, you can hear the faint echoes of my forehead slap when it became clear.

I've often struggled to understand boost converters. Recently, Julian Ilett has been building one on a breadboard and it has helped me get my head around them.

As much as I like breadboarding things, building them on Falstad's excellent circuit simulator allows for such quick experimentation that I prefer using it to get started. I don't have a huge collection of components, and in the time it would take me to swap out a 1-millihenry inductor for a 2-millihenry inductor, I may forget the questions I had that prompted the swap in the first place. I'm a big believer in "closing the loop" and satisfying curiosity as quickly as possible.



Start Simple


I whipped up a similar circuit as Julian's here: http://tinyurl.com/y75593kq



I made some modifications to Julian's circuit, but the spirit is the same. The simulator's power supply seems to have zero internal resistance, so I added a 1-ohm resistor to simulate some. That allowed me to add a small 100nF capacitor to make a more realistic circuit. The 470nF capacitor on the output is a little undersized so that the ripple would be visible.

My circuit boosts the 5V source up to 6V across the 560 ohm resistor with a 25% duty cycle. It's a modest boost, but according to the power readings (the rightmost two graphs), it's about 89% efficient. Not bad!

The simulation shows the MOSFET charging up the inductor for 20 microseconds (see the second graph; green is voltage across the inductor, yellow is the current through the inductor). When the MOSFET turns off and the inductor's field collapses, it induces a current through the load and diode and also the source. That last bit was what I needed to confirm.



Simple is Often Bad


One interesting "feature" of my simple boost converter is its behavior when starting up:


Yikes! Check out the voltage across the resistor (leftmost graph). Only 123 microseconds after applying power, the output rises to almost 10V! After settling down, its normal output is 6V. This kind of overvoltage could be disastrous to circuits downstream.

This can be seen easily simply by clicking the "Reset" button. That's one huge benefit of using a simulator. Click the "Run/STOP" button to pause the simulation if it's going too fast (or if you want to take a screenshot for a blog post).

Since I didn't expect that overvoltage spike, there's obviously more that I don't know.



That's Weird (I'm About to Learn Something)


Where is that overvoltage coming from? I'm sad to say I had no idea. Boost converters use energy stored in the coil to generate a voltage in addition to the source voltage. The source here is set to 5V, so the coil must somehow be generating almost 5V in series with (and in addition to) the source.

My first theory is that the MOSFET is somehow really efficient at switching at first. A quick way to test that theory is to disconnect the signal generator from the MOSFET gate, taking the device out of the equation:


Check out the lower-left graph again. The voltage ramps up to more than 7V in the first few microseconds -- and keeps going -- even though the MOSFET isn't doing its switching thing. That's weird.

Then I remembered my electronic fundamentals (sort of). I put my mouse pointer at about the 4.2V of the resistor's voltage graph (the green line of the leftmost graph). This is the point in time where 4.2V is generated across the resistor by the source (5V minus about 0.8V dropped by the diode). Any voltage higher than this is caused by the inductor. This is the most important point in time in all of these graphs, and I'm going to call this point midnight. Here is a better shot with the graphs on top of each other and the mouse at midnight:



The inductor graph (the bottom one) has the answer. At midnight current is still flowing through the inductor (the yellow line). Also the voltage across the inductor (the green line) is zero, since the 5V source has done all it can to push current through the circuit.

In electronics fundamentals it is taught that inductors resist changes in current flow. This works in two ways:
  1. increasing the current in an inductor by increasing the voltage across it creates a stronger magnetic field in the inductor, which resists the change in current.
  2. reducing the current through an inductor by decreasing the voltage across it causes the field to collapse, inducing a current in the circuit.
Sometimes analogies help, and I like to think of inductors like an air balloon. You blow air into the balloon and it expands. But it's stretchy, and resists adding air. But if you stop adding air to the balloon, it collapses and blows the air out again.

At midnight the current through the inductor stops increasing. Now the field begins to collapse, and the collapsing field is creating a voltage to keep pushing current through the circuit. This goes in the same direction the original current flow, and the resulting voltage adds to the 5V source. D'oh! This is the whole reason we use the inductor in a boost converter in the first place! Of course there's an overshoot. That's the whole point!



Knowing vs. Understanding


This is a good example of the difference between knowing a thing (i.e. "inductors resist changes in current") and truly understanding it. It isn't really surprising at all that the voltage across the resistor overshoots. In my limited grasp of boost converters, I had thought that the MOSFET was the most important thing, and didn't understand why the boost was happening even without the MOSFET.

After doing this experiment, I understand that the MOSFET is only there to temporarily increase the inductor's magnetic field. When that field collapses, it induces a little voltage in series with the source, thus boosting the output voltage.



Not Finished Yet


Boost converters are used everywhere, but they seem to have a fatal flaw: they create an overvoltage when powering up. It's in their nature. Yet we don't have stuff burning out all over the place, so the professional designers must have some way to keep it from happening.


Learning produces endless questions...