Saturday, July 5, 2014

The fantastic switching regulator

Time and again, we need to power a system from a battery rather than from mains. Now, the issue here is that most microcontrollers should be hooked up on 5V(or 3.3V). A battery would typically provide voltages above 10V. What you have below is a lithium polymer(LIPO) battery rated at 11.1V.

                                                          The LiPo -  a dangerous beauty

So, in that case, we would need to "step down"(to convert a higher voltage to lower voltage) that voltage. Now, there are two main solutions for that - either
1) A linear voltage regulator or
2) A switching regulator
Let's have a look at the first option, namely, the linear voltage regulator. Most of us know about this thing-it will get the job done all the time. So, what you have below is basically a functional 12V to 5V step down circuit using the linear regulator.

The linear regulator at work

Now, this is a nice circuit if you are doing simple things(flashing a few leds, reading a few sensors). However, things literally heat up when you increase the load. So, for instance if you are running a few motors, you may may observe the following symptoms - frequent restart or total shut down(your circuit appears dead). Why is that? You see, the linear regulator is device that dissipates heat and as your circuit demands more current, more heat is generated. Normally, your heat sink(fin like structure in the figure) would take care of that but sometimes even that may not be enough. If you stick with that, you may have to for impractical stuff like fans or whatever.
To understand the flaws that inhabit the linear regulator, we have dismantle the black box abstraction - we have to look at its principle of operation. What we have below is a simple schematic of the linear regulator.

Linear regulator schematic

In very simple terms, the output voltage is compared to a certain reference voltage and based on the result of this comparison, the resistance of the series-pass element(basically a transistor which you can use to regulate the current passing through a line) is varied from the two extreme modes of operation. Let's open a parenthesis here.
What you have below is a greatly abstracted characteristic curve of the transistor(we are not bothered about the details).

Simplified Characteristic curve(pardon this Blasphemy, God of electronics)

So, in this figure, you can actually visualise these two extreme modes of operation. Parenthesis closes here.
Ok, coming back to those two modes, we've said that the transistor is going to operate in the spectrum between those two modes. That is where the problem lies. In saturation mode, voltage drop across the element is low and power dissipation is low as well. In cutoff mode, the current through the element is low and the power dissipation is low. However, in between those two modes, we are dealing with a different animal. That is where the heat and the need for a ridiculously sized heat sink come from. In the figure below, you have a circuit for a heat pad I played with sometimes back. Notice the thin plate - THAT'S the heat sink.

   Five minutes after power on and you have a nice BBQ grill

With those elements in mind, we could argue that a better solution would operate either in cutoff or saturation. Turns out we have one which operates alternatively in both. Enter Switching regulator.
The first time I dealt with the switching regulator, I was really in a bad shape. I just needed something that would regulate my battery voltage down to 5V and give me currents around 1A. And it did just that. What is it all about? 


The MC34063 switching regulator

As you can see, it's just an 8 pin IC. Of course, you need some passive components(resistors, capacitors and  inductors) to get a functional circuit. There is a science behind the values of these components but there is a lot of maths involved(I discuss this in another post). However, if you need to step down 12V to 5V with currents of 1A, I've got that covered.
So, here's the schematic(made with Eagle):


Schematic
In the picture below, you have the circuit mounted on breadboard.
It's important that you use a fast schottky diode(1N5819) instead of the traditional diode. I had some trouble finding the 1N5819 locally but the 1N5822 should do fine.



No comments:

Post a Comment