Category Archives: Uncategorized

Leakage current & current leaks – part 1

Accounting for all of the obvious points of power consumption and their current levels for active and sleep states can be a difficult task. In every design there are also points of power consumption that are often overlooked. Every type of semiconductor device has some amount of “leakage current” that may or may not be called out in its datasheet.  Leakage current can make up the majority of the deep-sleep current draw for a modern micro when it shuts off power to most of its internal circuits. There may also be aspects of your design that can “leak” microamps to milliamps of current that you don’t take into account.

This is the first of a two-part posting on leakage currents and current leaks. The first part will cover leakage current in capacitors. The second part will cover leakage current in other types of devices along with common types of current leaks in designs.

Capacitor leakage current

Capacitors can be a major cause of unexpected current draw due to their leakage current. Some amount of leakage is unavoidable for any type of cap but to some degree leakage current can often be reduced through part selection.  This is what you should know about leakage current for the three most common types of capacitors.

Aluminum electrolytic – While hard to beat for capacitance versus cost, these are the leakiest commonly used caps with the highest number of factors that determine their leakage current. The formula typically used to calculate their leakage current is shown below.

AE leakageAs you can see, capacitance and the rated voltage are the primary factors in the leakage current. A couple of things not shown in this equation:

  1. With aluminum electrolytic caps the leakage current changes significantly as the difference between applied voltage and rated voltage increases. This works both ways, the leakage current decreases as the voltage is decreased below the rated voltage. The leakage current also increases significantly when the applied voltage exceeds the rated voltage – in this situation the cap can be physically damaged, causing a permanent increase in leakage current.
  2. The leakage current of aluminum electrolytic caps is also greatly influenced by temperature. The leakage current can increase 2X-3X with a temperature increase from 20°C to 60°C.
  3. There a number of other factors that influence the leakage current of electrolytic capacitors. These include age, storage conditions, type of electrolyte and the physical construction of the capacitor. Electrolytic caps that have been abused (over voltage, excessive current, etc.) may exhibit significantly higher leakage currents due to internal damage.

Tantalum – Often the primary choice when high capacitance is needed in a small space, tantalum caps also offer potentially much lower leakage currents than aluminum electrolytic caps. The formula typically used to calculate their leakage current is shown below.

tant leakage As you can see, capacitance and both the rated voltage and applied voltage are the primary factors in the leakage current. The applied voltage also comes into play and the usual voltage derating used for safety reasons with tantalum caps can provide a significant reduction in leakage current.

Ceramic – While not capable of the high capacitance density of aluminum electric and tantalum caps, ceramic caps by far suffer the least from leakage currents. The formula typically used to calculate their leakage current is shown below.

 ceramic leakage

 It appears that capacitance is not involved at all and this just the Ohm’s Law formula for current based on voltage and resistance. In ceramic caps, the leakage current is primarily due to insulation resistance between the part terminals. However the insulation resistance is typically based on an “Ohms Farads” value even if it is listed as a resistance in the cap datasheet. While rated voltage is also not included in the formula directly, insulation resistance is typically a function of the rated voltage. Insulation resistance typically increases with rated voltage so leakage current can be decreased by using parts with a higher rated voltage. The insulation resistance of ceramic caps is also dependent on temperature but since their leakage currents are so low the impact of temperature can often be ignored unless you are concerned with sub-microamp current draw or your device will be exposed to extreme heat.

 

The chart below shows examples of the calculated leakage current for these three types of caps and summarizes the discussion above. Two examples are presented for each type of cap. For example “A” the cap is 10uF, rated voltage is 10V and the applied voltage is 3.3V; for example “B” the cap is 47uF, rated voltage is 16 volts and the applied voltage is 5V.

Cap Type

Leakage

Current

Capacitance Impact

Voltage Derating impact

Temperature

Impact

Other considerations

Aluminum electrolytic

“A” = 3uA

“B” = 8.2uA

High

Medium

High

Storage conditions, electrolyte type,

 age, part abuse

Tantalum

“A” = 330nA

“B” = 2.3uA

High

High

Medium

N/A

Ceramic

“A” = 66nA

“B” = 100nA

Low

Medium

Low

N/A

The differences in leakage currents between the types of caps are obviously very significant for ultra low power design. Multiply these numbers by the number of caps in your design and the leakage current can become a significant part of the sleep state current of your device. This is particularly true for a device with a wireless radio where there may be several hundred microfarads of capacitance to prevent a voltage droop when the radio starts to transmit.

Several more thoughts on capacitor leakage currents:

  • Since one of the main factors in leakage current is the amount of capacitance, for a low power design is important to determine how little capacitance is actually required for the circuits to operate reliably. This is particularly important for electrolytic and tantalum caps.
  • For all three types of capacitors, the rated voltage is a determining factor in leakage current. For electrolytic and tantalum caps, selecting caps with rated voltages at least 2X to 3X the applied voltage will greatly reduce leakage current compared to the same value cap with a rated voltage only slightly higher than the applied voltage. For ceramic caps, caps rated at 50V or higher typically reduce leakage current by a factor of 10 compared to the same value cap with a 25V or lower rated voltage.
  • There is also a significant time aspect to leakage current. When voltage is applied to a discharged cap, the leakage current can spike to 50X to 100X the calculated value, remain there for a minute or two then gradually fall to the calculated level over several minutes. This is sometimes called “absorption current”. This spike is so high and lasts so long that leakage current tests on aluminum electrolytic are typically performed at least two to five minutes after voltage is applied to the cap. This really needs to be taken into consideration when selecting caps for circuits that are frequently turned on and off as part of the power management scheme and for caps used in timing circuits.
  • This may seem like a fine point but leakage current on capacitors down-stream from a voltage regulator carries an extra expense in terms of power since the energy stored in those caps was subject to the inefficiency of the voltage regulator. Be careful about throwing extra capacitance on the output of regulators just to be safe. Many low power LDO regulators can get by with just a few microfarads of input and output capacitance. The bulk capacitance on the output of switching regulators can often be reduced if your design can tolerate more ripple on the voltage.

 

The second part of this post will discuss leakage current in other types of semiconductor devices along with sources of current leaks commonly found in many designs.

Company update, Ambiq Micro and more

It’s been a few crazy busy months at work but I should be getting back on track with regular postings next week. This week I just have a few things that might be of interest …

First, my company started a crowdfunding campaign on Indiegogo last week. We have working prototypes of our µPower Analyzer and µCurrent Probe and need help to ramp up production of the µCurrent Probe. We’re offering pre-orders on both products at a 20% discount. We also have a low-cost version of the µCurrent Probe for the Maker community planned for later this year but if we can pre-sell the first production run of 75 units (with a 30% discount!) we’ll move that up for production in the June. The link is below, please help us spread the word about this.

http://www.indiegogo.com/projects/ultra-low-current-measurement-tools/x/6418386

I was introduced to a company a few months ago that has some super low current real time clocks. Ambiq Micro in Austin, TX has a family of RTCs (with and without power management features) with 7X lower current than the industry standard RTCs. They use a technology developed at the University of Michigan called “Subthreshold Power Optimized Technology” that allows their RTCs to operate as low as 14nA. Ambiq has announced they are working on an ARM Cortex M0 micro utilizing this technology to be sampled later this year (ARM is one of their investors).

http://www.ambiqmicro.com/

http://www.eetimes.com/document.asp?doc_id=1319543&

I came across these related articles this past week. They have some good numbers showing just how much of an impact firmware/software can have on power consumption. The first article shows that encrypted storage uses about 6X more power than unencrypted storage and in one test the encryption software accounted for 42% of the CPU utilization. The second article indicated that the Flash memory used for data storage only used 1% of the power required for storage operations – the OS, file system and encryption code accounted for the other 99%.

http://www.zdnet.com/making-mobile-storage-energy-efficient-7000026501/

http://news.idg.no/cw/art.cfm?id=00684248-B98A-C8FB-C6FB4D3C469CE91B

Finally, we’re on social media now so you can get updates on blog posts and our company news:

Facebook – https://www.facebook.com/pages/CMicrotek-LLC/252350514939771

Twitter – https://twitter.com/CMicrotek

Low power firmware concepts, part 2

This week I will continue from last weeks post with some concepts for low power firmware design.

Structured code

Highly structured source code is nice to work with but unfortunately can run considerably slower and consume considerably more power than less structured code. You don’t have to forget everything you learned about structured code but violating some principals of structured code can help save power:

  • Global and fixed address variables – Global variables can save a considerable amount of power by not passing parameters to functions (particularly for older 8-bit micros or when using external RAM).  Fixed address variables can help reduce the power used when calculating addresses for structure members. If you have the good fortune of having extra RAM, using fixed address variables in functions can be much more power efficient than working with temporary variables that are addressed relative to the stack pointer.
  • Put small functions in-line – If you have small functions that are called frequently you will save power by placing the code for those functions in-line. Particularly with older 8-bit micros, the overhead for calling and returning from a function can take dozens of clock cycles. Some compilers support using function calls in your source code to help keep the source code cleaner but will place the code for the function in-line instead of doing actual function calls.
  • Peripheral “drivers” – If you use a micro with multiple instances of a peripheral type, say 4 UARTs for example, you can save power by having a set of code for each UART instead of generic code that is passed a parameter to specify which UART to use. This avoids the parameter passing and allows you to hardwire the peripheral register addresses in the source code instead of calculating addresses at run time. Particularly with 8-bit micros this can yield a considerable savings for frequently used peripherals. These types of functions are typically fairly small so you won’t necessarily use a lot of program space by doing this.

 

Value added and non-value added code

Lean manufacturing has a concept of value added steps and non-value added steps. Value added steps directly contribute to producing the end product. Non-value added steps are essentially overhead steps that may be necessary but don’t directly contribute to producing the end product. An example of a non-value added step would be moving sub-assemblies from one section of the manufacturing floor to an assembly line. It is natural to focus on the value-added code for power optimizations because that is where the primary tasks for your product are. For the ultimate power savings, you should analyze your code to identify the non-value added sections of code that don’t get much consideration. You need to determine if the non-value added sections of code are absolutely necessary, “nice to have” or not really necessary. For the non-value added sections of code that can’t be eliminated, can they be streamlined, executed less frequently or grouped with other non-value added functions in order to save power (particularly if the micro is being taken out of a low-power state to execute the non-value added code)?

 

The power of loops

Firmware loops can be very effective in reducing code size and making the source code cleaner and more readable. They can also be huge wasters of power simply because of the overhead instructions required to implement the loop. Managing the loop counter, checking for the loop termination and the jump back to the start of the loop can all be considered non-value added code. Unless you are severely constrained on code space, unrolling frequently executed loops into a repetitive series of instructions can save a considerable amount of power. This is most easily done for loops with a small, fixed number of iterations. Even loops with a variable number of iterations can be made more power efficient this way. The test for “loop” termination would need to be done between each series of instructions but the jump would only be taken once instead of each time through the actual loop. This can be a considerable power savings particularly for micros performing instruction pre-fetches that are discarded at the end of each pass through the loop.

 

Know your variables

This may seem like a no-brainer but particularly with C compilers what you see in the code isn’t always what you get in execution. Pay special attention to this with variables used in loops since that one line in your source code can be executed hundreds or thousands of times.

  • Variable size – Particularly with 8-bit micros, make sure your variable sizes aren’t larger than they need to be. As shown in the code segment below, simply incrementing a 32-bit value can turn into 3 tests for overflow, 3 add instructions and as many as 8 memory accesses. In most cases this is just a waste of code space but if the variable is a free running counter it will be wasting power every 256th time it is incremented. A 32-bit add or compare is even worse since all four bytes of the variable must be operated on every time. Most compilers will size an “int” to be the word size of the micro but to be sure you should explicitly declare variables as int8, int16, etc. (or whatever syntax your compiler uses).

var_incr_cs

  • Signed vs unsigned variables – Arithmetic operations on signed and unsigned values aren’t handled the same way by compilers. To avoid extra processing (and weird results from the math operations) be careful about the declarations and similar to the size, explicitly declare variables signed or unsigned and don’t assume an “int” is one or the other. Also be very careful about mixing signed and unsigned values in math operations.
  • Variable alignment – Some 32-bit micros require 16-bit values to be on 2-byte boundaries and 32-bit values to be on 4-byte boundaries and will generate exceptions or bus faults for unaligned accesses. More sophisticated micros can handle mis-alignments and will happily turn an unaligned 32-bit access into two, three or four memory accesses without you knowing it. C compilers typically have options to allow misalignments or force certain alignments. Not so much related to power usage, compiler forced alignments can be very wasteful of RAM space by placing every variable on a 4-byte or even 8-byte address boundary. This can be particularly wasteful with large structures with various sized elements and arrays of 8 or 16-bit elements. The “pragma pack” directive can help you in this regard with structures but should be used with care since it puts you in charge of determining alignment.
  •  ASCII vs Unicode – If your product interfaces with text strings to a Windows application you may need to support 16-bit Unicode values, otherwise 8-bit ASCII should be adequate. If you are stuck with Unicode and your product requires a proprietary driver or uses a Windows app, you should be able to save power by using ASCII in the firmware and translating to Unicode in the PC based code.

 

Next week I’ll get into the details on what you can do to make your firmware more power efficient.

Battery selection, part 2

Last we I discussed several aspects of using batteries. This week I’ll discuss battery charging related issues and wrap up with a couple of physical considerations for battery usage.

  • Charging – A thorough discussion of battery charging would take a book several times the size of this one but there are a few basics you should understand about battery charging. The first thing you should be aware of is each battery technology has certain charging algorithms that are optimized for that technology. Using an algorithm designed for a different technology can have results ranging from poor charging to disastrous (back to smoke and flames again). The basic parameters of battery charging are voltage, current and time. In general, the higher the voltage and/or current the shorter the charging time and each battery technology will have limits on the maximum voltage and current. Some types of batteries respond well to charging with high current pulses while others won’t. Some will benefit from a trickle top-off charge while others won’t. Fortunately, a number of semiconductor companies have battery charger chips for specific battery chemistries so you don’t need to get bogged down in this particular detail.
  • Charge duration vs battery life – It is somewhat important to make a distinction between charge duration and battery life. Charge duration refers to the length of time from charging until the output reaches the cut-off voltage. Charge duration can be impacted by improper or incomplete charging, load, temperature and battery age. All batteries have a finite useful life (based on number of charge cycles or age) and battery life literally refers to the useful life of a battery. Battery life can be impacted by aggressive charging and over charging, exceeding the maximum current rates and using the battery below its rated cut-off voltage. Long charge duration and long battery life are not mutually exclusive but to achieve both you must treat a battery gently. Deep discharging to increase charge duration will reduce the life of a battery (as will very aggressive charging algorithms). Particularly in the case of LiPo batteries, the discharge curve is so steep when the cut-off voltage is reached there is minimal benefit and a high penalty in battery life reduction for going below the cut-off voltage. The term “battery life” is often used when referring to charge duration but when discussing ways to save power, what you do to increase charge duration will generally lead to longer battery life too.
  • Self-discharge – All battery chemistries suffer some amount of self-discharge over time. This generally isn’t a concern as far as your product design is concerned. However, electronics have reached such low current levels that the battery’s self discharge may play a significant factor in your product’s charge duration and may even be higher than your product’s discharge rate.
  • State of charge – One of the trickiest things about using batteries is determining their state of charge. Simply monitoring the battery voltage level is the simplest method to implement but often tends to provide poor results. A lead-acid battery that hasn’t been fully charged will have a fairly high voltage that drops rapidly when a load is applied, giving the impression the battery is discharging very quickly. A lightly loaded lithium polymer battery has such a flat discharge rate that there won’t be a significant voltage drop until there is only 5-10% of capacity left. A battery “gas-gauge” chip can provide a better indication of the state of charge but you still have to characterize the battery in your application to properly make use of the information the chip provides.
  • Multiple batteries – Batteries are easily put in series to increase voltage, in parallel to increase current capability or both. This can be done with little concern with non-rechargeable batteries. For rechargeable batteries, there are a number of considerations primarily around charging. The details on this are also outside the scope of this book but if you use multiple batteries in your product, you should use a battery pack instead of individual cells to ensure the cells are from the same manufacturer and roughly the same age
  • Physical considerations – There are a few physical considerations you must take into account in your product design when using certain types of batteries. For example, some types of batteries may out-gas during charging (usually a sign the battery is being abused) and require venting to the outside world to avoid explosion. The lithium based rechargeable batteries can literally swell during charging and require some amount of room to expand. Battery manufacturers usually provide information if special considerations are needed.

If you are new to designing battery powered products, it will be well worth your time to do some in research into the various battery technologies Even if you are an old hand at designing with batteries, if you are considering a battery technology you haven’t used before for you product you should do some in depth research in that technology to understand it’s intricacies. Manufacturers of batteries intended for industrial applications or OEM use generally provide considerably more details in their spec sheets than those for consumer oriented batteries. These spec sheets and app notes are a good source of valuable information.

For the most part, your application will dictate the type of battery you use. In some cases you may have a choice of battery types or may have to decide between battery types when more than one would be suitable for you application. Below is a high level overview of the pro’s and con’s of the most popular battery types.

 batt table 

 

Welcome to the CMicrotek Low Power Design Blog

We live in an era where saving energy is a topic that receives considerable attention. For design engineers, there are many different motivations for saving energy from your company being able to claim your newest gizmo has longer battery life than any of its competitors to conserving natural resources to reducing the air pollution and greenhouse gas emissions associated with generating electricity. Until recently, reducing energy usage in electronic circuit designs was primarily a concern for designers of battery power products. Today, legislative restrictions on energy usage are covering more and more types of products and the marketplace pressures for reducing energy usage are impacting nearly all types of electronic products from consumer electronics to IT equipment and even industrial and manufacturing equipment. In our “instant on” world where few things are ever really turned completely off, the energy a device uses when it is doing nothing is becoming more important than the energy it uses while operating. These so called phantom loads drive megawatts of electricity generation daily and are squarely in the sights of legislators writing energy efficiency regulations.

There are a number of ways to reduce the energy usage of your designs. Your hardware design will establish a baseline for the minimum amount of power your product consumes but for many types of products the firmware will really determine the overall power usage. Sophisticated software power management schemes that were once mainly employed in laptop computers and cell phones are being implemented in increasingly less complex products to reduce power usage. However, simply selecting the latest low power micro and implementing sophisticated power management is the “big stick” approach to power savings. There are dozens of hardware design decisions and hundreds of firmware design decisions that will either enhance or sabotage your power saving efforts. The accumulation of these smaller savings can often save more power than the big stick savings.

There are many things to consider in your designs, some will have big pay-offs in power savings but . The over-riding theme in the tips and techniques I will present is anything your design does that it doesn’t need to do is wasting energy. That sounds very obvious but many of the things we do in our designs that waste energy often are not obvious. Some of the information that will be presented can be found in other places on the Internet but newcomers to low power design may not have seen it. Many of the tips and techniques that I’ll discuss were learned through years of developing low power products. I look forward to helping with your power saving efforts.