Saturday, 21 May 2011

Inductor selection for Switch Mode Supplies

Recently at work I have had to design a few switch mode power supply circuits. I haven't had too much experience at designing these before and have so far got away with following recommended circuit topologies in the switcher datasheet. This has generally worked out O.K. but you can end up with an over-specified inductor which has many implications for the performance of the final circuit. Another problem with this approach is that blindly trusting the manufacturers datasheet examples is bound to lead to problems eventually. The design criteria for such circuits are rarely specified beyond output voltage/output current, there is no mention of ripple current/voltage, overshoot, power dissipation...

I set out to get a better understanding of how switch mode power supplies work, and understand the equations which underline their performance. This post is a collection of the resources I found during the learning process.

My starting point was SMPS Technology which has a short tutorial on the basics of switching regulators. This outlines the basic inductor equations and how to apply these to a buck regulator. It offers suggestions on choosing suitable inductor and capacitor values based on simple 'rules of thumb'. Helpfully, it explains the different approaches to controlling switch mode supplies and the effects of each method on stability and overshoot.

Having read this tutorial through a few times, I was keen to understand where these rules of thumb had come from and what the implications of following them were. After a trawl of switching regulator manufacturer's websites, I came across a National Semiconductors Application Note 1197. This is an expertly written document which explains how to select an appropriate inductor for your application. As well as showing how to choose a starting value for your inductor, it explains how to calculate the RMS current, Peak current, energy handling capability and saturation current required for you application. Furthermore, it shows how you can take the parameters from an Inductor datasheet and calculate the power losses due to core losses and copper losses and therefore work out the temperature rise.

Another good resource for selecting an Inductor is the Coilcraft website. Their Inductor Selector for DC-DC converter circuits is a pretty good starting point. Once you have chosen an inductor, they also provide an inductor loss calculator.

If you want to be even more lazy you can try the National Semiconductor WEBENCH tool, which will not just select an inductor but will design the whole switch mode circuit for you, including sourcing all the components! I tried using this for the last switch mode circuit I designed to see how good it was. I was sceptical that it would do a good job. The circuit topology it suggested was pretty much the one from the datasheet with some important exceptions. It suggested an output capacitor with a large ESR which would have given poor voltage ripple. It violated the maximum resistance for the feedback resistors and it missed of the soft start capacitor. In conclusion, don't trust it to get everything right just yet!

Monday, 16 May 2011

Farnell Box Ticker

Frequent users of the Farnell website may, like me, get annoyed at having to continually tick the 'in stock', 'RoHs' and 'Exclude extended range' check boxes while searching for parts. Unfortunately, these check boxes do not seem to stay checked beyond a single search, even if you log in it will not save your preferences.

Using Greasemonkey to tick Farnell Search Boxes

So I set about writing a greasemonkey script to automatically tick these boxes when the page loads. Just in case I later decided I did want to pay £16 to ship a resistor across the Atlantic, I decided to add a keyboard short cut to invert the selection.

It turns out that greasemonkey is really annoying. User scripts execute in a sandbox, which means you can't access elements on the page or in the DOM as you would in say Firebug or a script running on the page itself. There is quite a lot of documentation out there about all these quirks, but even simple things like changing the value of a checkbox becomes a real headache.

After spending an evening getting to grips with Greasemonkey and refreshing my Javascript foo, I thought I had it cracked. So much so that I uploaded my efforts and boasted about it on Twitter. Then I took a closer look and discovered that all my script actually achieved, was graphically ticking the boxes on the Farnell search page and not actually affecting the search.

A little more time spent inserting breakpoints into the Farnell application script and I found the function that needed to be called to affect the search. For this, Firebug was essential! From the DOM tab, you can right click on an element and select 'Break on attribute change'.

Installing the script

The working script can be downloaded from userscripts, it is called: Farnell Box Ticker or you can directly install it by clicking this link

Unlike many scripts, this does not use the potentially unsafe 'Unsafe Window' work-around. Instead it relies on the fact you can type javascript directly into the URL box in your browser like thus: javascript:alert('beesnotincluded"');

Using the script

Once installed, this script will run on all of the farnell domains (hopefully). On the non-parametric search pages, the Stock,ROHS,Extended items boxes will automatically be ticked. For parametric searches, these boxes cannot be automatically ticked, because they are generated dynamically after the page has loaded. You can however, use the CTRL+E shortcut to toggle the state of these boxes on these pages.

Bug reports welcomed :s