Tuesday, December 16, 2008

Switching Regulators, Boost Converters and The IBM Charger

A friend of mine (it would not be right to continue this post without a mention of her) recently gave me her busted IBM Thinkpad charger. Vidya (or nVidiya as I like to call her) said “Do what you want with it, and if you put it to good use, do tell”. The best resting grounds I can think of for damaged things is my desk, where these otherwise never-again-to-be-used-by-mankind objects serve one last noble purpose – be of some use to me! :-)

Let me begin by telling you that IBMs are some of the sturdiest and most durable laptops not just physically, but even in terms of their software; but don’t take my word for it: ask the wall in GH3(B)-108 (my old hostel room) whether it liked being whacked by a laptop; or ask Abhinand (a pal of mine) if his throwing more than two litres of water right on my laptop had any effect on it; you may also like to find out from the numerous girls, who sadly, are computer-not-so-literate (yes, this is chauvinistic, but hey! It’s MY blog), the several times I have rescued their crashed HDDs and run diagnostics of their systems using my trusty IBM R51. I use my IBM for absolutely everything, including my trysts with electronics experimentation, and its motherboard has silently and loyally borne the brunt of 15V to its parallel port, or Vccmax+5 to its USB hub. I love my IBM!

Anyway, after that completely wayward digression let me get back to what I wanted to post about. So this girl, nVidiya, graciously gave me her burnt out charger, which I dutifully took apart after some prying and poking with flat screwdrivers. Here are a couple of images of what the IBM SMPS (Switched Mode Power Supply) looks like from the inside.


In the second image you can see that the inside of the plastic casing is a sheet of copper for improved thermal conduction. You can also see the aluminium heatsinks. The third image shows the circuitry. Visible are the main transformer and some coils, which are all actually very small. The main advantage of switching power supplies is the way they control the average power to a device. The main element in such a power supply is a transistor (BJT or MOSFET or IGBT) that either turns completely ON or completely OFF. In the ON or OFF state the transistor dissipates very little heat, thereby causing very little power loss. Another plus for the SMPS is that it can generate almost any voltage – higher than the input, lower and even negative.

The fourth image shows clearly that the charger is deceseased; may it rest in peace (or, since it's on my desk - rest in pieces!)

So anyway, there's no black magic involved in all this increasing and decreasing of voltages; it is done using a coil. Depending on how the transistor and coil are connected, and where the output is taken from, all sorts of voltages and polarities are possible. Of course, it’s not all that simple. Switching PSUs are some of the most complicated devices, but particularly at high power outputs and in battery powered devices (where high efficiency is the norm) they provide such a huge cost savings as regards lost power that they are ubiquitous in computer peripherals, cameras, UPS systems and almost anywhere else you look.

Here’s the wiki on switching power supplies. Read and be amazed. If you have time do go through TI's very concise reference on switching PSU configurations.

With all these switching power supplies floating around I needed to make one myself. So I made a really simple one, and was thoroughly amazed at the results. It started because I am attempting to make a USB PIC programmer. It is an open source programmer, and details can be found here.

The programmer needs to generate 14V during programming, and with the 5V provided by USB, this would only be possible with a boost converter (which is one kind of switching supply). As its name suggests, the boost converter ‘steps up’ voltage. Do bear in mind that this is DC we are talking about. How do you ‘step up’ DC? Can’t stepping up and down only be done with AC? Aah, now that’s where the switching regulators come in.

Take a look at the circuit below. The transistor is a plain vanilla BC547 NPN. Its base is pulsed through the PIC; so the transistor turns ON and OFF. When the transistor turns ON it pulls current through the coil. The coil creates a magnetic field around itself. When the transistor turns off, the current in the coil rapidly decays; this causes the coil to generate a back EMF ‘kick’. The polarity of the voltage ‘kick’ is such, that it ‘tries’ to keep current flowing in the same direction as it was before the transistor turned OFF. Confused? Just read that line a couple of times. The ‘kick’ is a high voltage and causes current to ‘overflow’ through the diode into the capacitor. This ON/OFF cycle takes place many times a second charging the storage capacitor to many times the original supply voltage.

My circuit looks like this:


Voltage boosting is the very principle used by camera flash units. The Xenon flash triggers only at about 250-400V, and a standard camera has just two 1.5V AA or AAA alkaline batteries (1.2V for NiCd batteries). How do you get 400V when you have just 3V with you? Use a boost converter!

The simple junk-box components boost converter that I made ran off the USB’s 5V and was able to easily generate 60V when loaded with 1kOhm, and well over 130V unloaded (Caution: running an SMPS of any kind unloaded is NOT good practice!).

I have now started winding my own coils. Believe you me, this in NOT a fun task if you have many windings to make with thick wire. In the image below you'll see a few powered-iron toroidal cores.These cores are very good for high value inductances. You'll also see enamelled copper wire, and a few adjustable air/ferrite core coils (used for factory tuning in radio sets). Old radio sets, damaged mobile phone chargers, destroyed UPS systems, and non-functional florescent bulbs (the Philips CFL type) are a good source of coils and coil-making materials.


(If you’re wondering why my images are suddenly better in quality, the reason is that I’m at home, where I have access to my Sony :-) )

Visitors