One of the many design choices you face when designing an electronic device, is how to power it. It's often just an afterthought, but for finished products that go beyond simple prototype and must function error-free for years, it's crucial. The basic choices we have are:
- Use (rechargeable) batteries
- Use an external power supply (like a wall wart)
- Built a power supply into the device (and feed it mains or other external power)
- Harvest external energy source (like solar or thermo energy)
Obviously, sometimes a combination is applicable, like using solar power combined with rechargeable batteries.
They all have pro's and con's. For instance, whether battery operation is an option depends on power consumption and location/accessibility (e.g.: Is it not near a power source? Can the batteries be replaced?). A good power source is a must for any microcontroller circuit. Not only from safety and environmental point of view, but also to ensure its long lasting uninterrupted workings.
We will focus on means to get 3.3V and/or 5V from a power source, since that is what most microcontroller circuits need. Note that for other components like relays or LED strips higher voltages may be needed. And complex microcontroller circuits may also need a power rail with different voltage and current levels, but that's beyond the scope of this article.
Choose the power
First, let me come clean: I hate batteries and wall warts! Batteries always run out when you don't have the right replacements. And if your household is anything like mine, you probably have a boatload of wall warts collected over time for all the different devices. Modern mobile devices usually run out of charge within a day, resulting in a lot of occupied power sockets throughout our house, where everyone is charging their smartphones, tables, e-readers, laptops, wireless headsets, wireless mouse, etc. simultaneously.
I prefer mains power as the source whenever possible. It never runs out like batteries - we do have a very reliable power grid in The Netherlands ;o). This can be in conflict with the basic house rule of my wife: No Visible Wires, but I had the fortune to move to a new house recently and took the opportunity to add some extra wiring and wall sockets (though never enough as it turned out!). For low power scenario's I don't mind to use coin cell batteries, suitable for most size constraint situation. Your circuit and software must be power efficient, and they must be replaced some day so your devices should be easily accessible. As a third option I prefer to use a type of 'over the wire' power source, like Power-over-Ethernet (PoE) or other means of getting remote power over the wires (1-wire, RS485, USB, ...). And of course if all that is not possible, I can turn to the good old AA or AAA type (rechargeable) battery for my device, if form factor permits.
In the (near?) future I will investigate energy harvesting techniques using light, heath, motion, radiation, or other sources of energy all around us. But since that is still a relatively new development, I'll leave that for a later date. Take a look at the EnOcean website to get some ideas of what is possible today.
Learn from the pro's
We are about to dive into the details of different ways of powering a microcontroller circuit, but since I prefer mains power (230V/50Hz in my country) whenever available, I did some preliminary research. I recently bought a Schuko power socket from Busch-Jaeger with built-in 5V/700mA USB charging option for my new house. It is a standard sized wall socket with a small USB interface on the side, that set me back more than 50 Euro (!), while a standard wall socket is about 5 Euro. But, I wanted to figure out how to mimic that type of design, given the small form factor that easily fits behind a wall socket. Obviously I cracked it open to look inside. At its heart we find a Power Integrations IC of the LinkSwitch-II family, the LNK614DG. There are six larger non-SMD components. The transformer, clearly visible with a metal shielding, is made by Würth Electronics (WE). It looks like a custom low profile model, probably resembling this EE16 model. Next are two 6.8uF/400V capacitors. The PI reference design show these on the high voltage side. The capacitor that hangs inside a hole in the PCB is a 680 uF/10V model. There is also a high voltage X2 type ceramic capacitor (the light blue component) and finally a 100ohm/2W wire wound resistor that doubles as fuse. This design looks promising, but more on that later; first we dive other device powering options.
Running on batteries
Despite my preference for mains power, I'll start by looking closely at powering a device using a battery. The fact that the device can be placed just about anywhere, obviously is an advantage. The only precondition being the temperature and humidity should stay within the specified operating range. That usually means Arctic or Desert environments are off limits ;o). Even so, be aware that batteries have much (!) less power in low temperature conditions. Also, using batteries prevents any potential grounding issues, hazard of high voltage circuitry, power ripple or signal interference. The downside of course being that batteries run out (sooner or later).
There is a large collection of so called LDO's (low dropout) voltage regulators that can turn a battery source in a stable power source for your microcontroller circuits. They have two downsides: the excess power is dissipated (turned into heat) and the battery voltage level must be higher than the 3.3V we want to produce. This can only be accomplished by placing cells in series, increasing size. As I try to design circuits that can fit just about anywhere, I will try to avoid that. Comes the so called switching mode power supply to the rescue. They don't turn most of the extra energy into heat, but are a bit more complex and require more components. There are step-up (or boost) controllers that provide a higher output voltage than it's input level and step-down (buck) controllers that work like efficient LDO regulators. There even are buck/boost combinations. Simple conclusion: step-up controllers are suitable for turning the voltage level of a single battery cell (usually between 1 and 3V) into a nice 3.3V or even 5V without losing much energy in the process.
I will focus on IC's that can be soldered without a reflow oven, as I don't own one yet. This rules out any BGA, PGA and other no-leads packages for now.
There are many types of batteries, and I will not go into details about different technologies as most batteries these days use a variant of a Lithium or Alkaline compound. Batteries also come in different sizes, shapes and capacities, but for the use in embedded devices I'll limit that to the most obvious types.
Primary (non-rechargeable) AA and AAA type batteries provide a nominal 1.5V output and the rechargeable versions (e.g. NiMH or NiCad) do at least 1.2V. They come in different capacities.
AA batteries usually deliver between 1.5 Ah and 3.0 Ah (Ampere Hour), depending on the materials used, while AAA typically provide half of that. BTW, the IEC standard specifies the AA sized batteries as type 6 and the AAA sized batteries as type 03, prefixed with letter(s) to designate the specific compound used (like Alkaline or NiMH). Coin cell batteries often use a Lithium-based compound and provide a higher voltage, in the order of 2V to 3V depending on type and charge level. A well known coin (or button) cell type is CR2032, found in many commercial devices. It has a nominal voltage level of 3V (which drops to 2V when almost fully discharged) and usually delivers around 225 mAh, obviously much less than a typical AA or AAA battery.
For now, we will focus on use cases with a primary or rechargeable battery cell (replaced or recharged outside the device when depleted) to power a 3.3V or 5V device:
- First of all single coin cell (CR2032 type) providing 3V nominal and dropping to about 2V when almost discharged. Useful for small sensor type nodes on remote locations. See this paper from TI with test results of CR2032 coin cells. They can provide peak current of up to 30mA, but average current should not be higher than a few mA to prevent them from draining too fast or even overheating.
- A single AA or AAA battery providing 1.2-1.5V nominal and dropping to about 0.9V when almost discharged. Useful when more power is required than a coin cell can provide. Capacity and peak current varies greatly between different type/brand batteries. Rechargeable batteries have much lower internal resistance and can provide higher peak current without heating too much. Peaks of more than 1A are no problem. Average current draw should stay well below a few hundred mA; the higher the average current drawn, the lower the actual battery capacity. See this battery showdown.
When we want a stable 3.3V (or 5V for that matter) out of a standard battery we should use a step-up controller that can deal with lower input voltage than the required output voltage. Since there are probably hundreds of these IC's from many manufacturers, I will focus on a few interesting ones. The criteria I used to select them are:
- Low price
- High efficiency (don't want to waste precious battery power)
- Low quiescence current
- Soldering friendly packaging (ruling out no-lead or BGA form factors for me)
- Low external component count and small footprint (to reduce cost and size)
- Optionally a 'battery low' signal pin
Those are key parameters I look for (they can be somewhat contradictive) in a step-up power management IC. Well known manufacturers are Linear Technology, Microchip, Maxim, TI, Power Integration, STMicroelectronics and On Semiconductor, among others.
LDO regulators are not applicable for this scenario. They cannot deal with lower input voltage compared to the required output and usually are less efficient than switching power supplies. But for multi voltage scenario's - like both 3V3 and 1V8 - they can be added when needed. Alternatively we could look for a power regulator with two output voltage levels. But for now, we only focus on single voltage requirements of 3.3V or 5V.
After researching many data sheets I've created a table to compare the most interesting step-up controllers for single AA/AAA or coin cell operation (in my humble opinion and based on my criteria). The table below summarizes a number of controllers that can drive 3.3V (or 5V) output at 100mA or more from one CR2032 or AA(A) battery.
|Manufacturer||Model||# External Components||Largest Capacitor||Largest Inductor||Average Price||Min. @1.2V||Min. @2.4V||Efficiency @1-10mA|
For low power scenario's the Microchip MCP16252 is a good candidate and for higher power needs we can use the Texas Instruments TPS61016. Both are cost effective (especially the one from Microchip) and have a high efficiency across a wide range of output current drawn. In particular the MCP16252, thanks to the combined PFM/PWM step-up technique. And if we need a second power rail with lower voltage (like 1.8V) we can simple add a small LDO regulator to the 3.3V output in case of an AA(A) battery source, or directly at the battery if a CR2032 is used. But that's for later.
First, let's draw a schematic for the MCP16252 and select the proper external components. The reference circuit from the datasheet is straightforward, we will use that to build our prototype.
The PCB design should pay attention to a few rules. The capacitors and inductor must be placed close to the pins they are connected to. My first test setup will be on a breadboard, before designing a PCB layout with the power supply integrated. The Microchip Application Note AN1337 contains more information on designing the best circuit, preferred components and PCB layout. Time to select the right external components, paying attention to footprint, price and quality.
You may have noticed that I frequently refer to prices or datasheets from the Farnell (Element 14) website. Although I do order from them from time to time, as they deliver promptly, have a huge stock and are reasonably priced, I am in no way affiliated to them or get any benefit out of it. And as a matter of fact, I also frequently order from eBay, AliExpress and others.
The BOM (Bill of Materials) based on the specifications in the Microchip datasheet is:
I have increased the output capacitor to 22uF (from the minimal recommended value of 10uF) to reduce ripple, anticipating that some RF components are rather sensitive to ripple while transmitting. And the input capacitor to 10uF (from 4.7uF) to support longer wires to the battery. The inductors advised in the datasheet are either out of production or difficult to solder without a reflow oven, so I opted for a similar type from Würth Electronics in the WE-PD4 series. As far as the resistors for the divider network are concerned, manufacturer is not relevant (I just presented an example in the table) as long as they are 1% or better precision. Note that the calculated output voltage is slightly over 3.3V at 3.308V.
To get 5V out of this circuit we must change the resistors. A value of 1Mohm for R2 and 3.09Mohm for R1 will result in 5.08V output. All other components can remain the same.
That concludes part 1 of this series, having a good look at a simple, efficient, cost-effective and low-footprint friendly way of powering a device from a single AA(A) battery or coin cell. Oh, And let's not forget: (steady) hand soldering compatible. I am not going to use this power supply separately, as it will be integrated into multiple circuit designs, but I am going to define the layout for this part of the PCB's.
Now that we figured out what the circuit should look like and what components to use, it is time to get the missing components ordered. After that we can start building a proof of concept on a small breadboard and do some measurements on power ripple, noise and efficiency. But that is a topic for next time...