AVR boost converter
July 7, 2009 By
Zach Banks 
Over at SpriteMods, [sprite_tm] realized that a microcontroller could be used as a boost converter to power itself. A boost converter steps up voltage from a battery by switching the output of a coil. First, it is tied to ground so a magnetic field can build up in the coil. It is then released as a higher voltage than the input. Normally dedicated chips do this at an incredibly high frequency, but the PWM signal from an AVR works well enough. This can be used in low-power situations where space is an issue.
[via EMSL]
Introduction
Hardware gets smaller and smaller, and industrial devices keep up quite nicely: every generation of mobile phones, mp3-players etc seem to have shrunk in respect to its predecessors. As a hobbyist, it's difficult to match that rate: first of all, most of us like to use the old and, in comparison to the tiny SMD-devices inside most modern portable devices, bulky DIP-packages. That's not a weird choice: anything smaller gets a lot more difficult to solder by hand.
The second problem is that when we have to choose a PSU, it's easy to go the path many of us have gone before: just plug in a trusty 78(L)05, use at least 7V of batteries and ready we are. Some people recognize that their microcontrollers have a larger input range than the old TTL-chips, and feed the 4.5V from three AA's immediately to it. But that's about as small as it gets: when using 2 penlites which happen to be rechargables, one only gets 2.4V, which usually is to little to be usable.
How do the industrial devices like MP3-players get their juice, then? When not running off the comfy 3.7V provided by a LiIon-cell, they use specialized DC-DC-converters to convert the 1.2V provided to them into any voltage they may require. These chips aren't as easy to get as yer olde 7805's, though, and sometimes come in a tiny SSOP-package to boot.
There, however, is another way to get the necessary voltage in a microcontroller circuit. In this article, I'll explain how. I'll immediately admit it: the solution isn't completely elegant, but as long as you know what you're doing, it should work allright.
How?
There are multiple ways to design a DC-DC-converter: Smartly using capacitors to 'stack' the voltage, generating AC to put into a transformer, using coils, ... The design I settled on uses the third effect and basically is a standard boost-converter. For you people who don't know yet how a boost-converter works, here's a short explanation:

As soon as the switch closes, current goes and runs through the coil, which in turn builds up a magnetic field. As soon as the switch turns off, the magnetic field collapses, which has the effect of the coil seemingly wanting to keep the current it had running at all time. There's no way for that current through the switch anymore, so it only can go through the diode and the capacitor. A capacitor increases the voltage over its connections when a current runs through it, and this one is no different: the power at the output increases. Now, if a load happens to be attached to the capacitor, it will slowly discharge, and the voltage will lower again. To compensate that, the control unit will close and open the switch many times a second, so the total of current going into the capacitor will stay the same as the current going out of it, thereby keeping the same voltage.
Usually, a dedicated chip is used as the PWM-controller which turns the switch on and off. A dedicated chip isn't a must, though, a microcontroller can handle the same task: all you need is an A/D-converter, a PWM-controller and some firmware to tie it all together. In such a configuration, the circuit can e.g. get 1.5V from a penlite and convert it to 5V to power another circuit. So I thought: Why then can't it power itself? The only problem you have is that the microcontroller doesn't work on 1.5V (duh, that was the problem in the first place) so we'll need a little something to kickstart it.
http://spritesmods.com/?art=ucboost&page=2
Circuits
Here's the first circuit I built:

As you can see, this solution doesn't take many components to work. The circuit is the same as the generic boost-circuit on the previous page, with two differences: First of all, the controller is an actual uC (I used an ATTiny13) powered from the power the DC/DC-converter generates, and secondly there's a pushbutton in parallel with the transistor. Why the pushbutton? As I said on the previous page: one of the problems with this set-up is that you need a certain voltage to get the controller running, which'll then generate power on its own so it will actualy keep running. I've thought of many ways to generate this power: external PSU (defeats the purpose of the project), using caps (works only from a certain voltage, if at all), external oscillator (too much components) etc. Eventually, I arrived at this crude but functioning solution: by pressing the button, you manually take over the function of the transistor and build up a magnetic field in the coil. By releasing it, the current the inductor generates should be enough to charge the capacitor to a voltage which'll get the uC booting.
I decided to try the theory in practice. I programmed an ATTiny with code to emit a fixed PWM-signal at one of its pins, built the schematics on a breadboard and inserted a blue LED to show the circuit really works (blue LEDs, like all LEDs, won't work with 1.5V; they need something higher.)

As you can see, the blue LED lights up nicely. I measured the power the circuit emits and the power it drains from the AA-battery, and I calculated that the circuit has an efficiency of about 69%. While it isn't the 90% you get with a store-built dedicated boost-IC, it's not bad for some random code and parts salvaged from old PCBs. I decided I could do better, though, so I modified the switching part a bit:

The circuit now uses a MOSFET, which not only saves a part, but also increments efficiency to 73 percent. While these figures aren't that impressive, the MOSFET does mean we can now power more current-hungry applications. It does have two downsides too: First of all, the mosfet I used has a gate voltage threshold of 2V, which means the power generated from the bootstrapping procedure should be at least that. Secondly: you need to specially pick your mosfet to have such a low gate threshold voltage; for example, I couldn't get the circuit to bootstrap using the widely used BUZ11, probably because it has a gate threshold of 4V
http://spritesmods.com/?art=ucboost&page=3
Conclusion
The method to power a microcontroller from one AA-battery outlined in this article seems to work just fine, and as long the uC keeps doing it's thing in respect to generating PWM-pulses and eventually adjusting the duty cycle in respect to the current voltage. It does have a couple of disadvantages, though: first of all, bootstrapping isn't always too easy, depending on the coil and switch used. Secondly, the microcontroller controls its own power supply, which in theory could mean it can blow itself up due to a software bug. Use a zener across the power supply lines if you think you're going to run that risk. Thirdly: Pressing the on-button in the circuit I designed means pulling a large current from the battery, so in theory keeping the button pressed for some time could drain the battery.
There are a few advantages to using this method, too: low part count, no hard-to-find parts, soft power-off, to name a few. The decision to use this circuit is dependant on the advantages outweighing the disadvantages. That, as always, is a choice specific to the particular project, though.
http://spritesmods.com/?art=ucboost&page=4
[PDF] AVR188: Design Guidelines for ATtiny43U - Atmelwww.atmel.com/Images/doc8206.pdf
2010. 6. 1. - The integrated boost converter of ATtiny43U provides the ... voltage. The boost converter is a switching type, step-up regulator that requires.