Powering Made With Magic devices

Submitted by khyizang on Fri, 05/13/2016 - 15:06

"Dead Batteries Tell no Tales"
-Ancient Pirate Wisdom

The TI TPS61221 boost regulator is the key

boost regulator componentsI haven't seen a recent Made With Magic device teardown that doesn't uncover a TI TPS61221 low voltage boost converter on the circuit board.  It's job is to accept input voltages between 0.7V and 5.5V and output a constant 3.3V to the other board components, providing a minimum of 200 mA current up to a maximum current of 400 mA.  An under voltage or over current condition will cause a shutdown.

TI has this to say about their converter:

  • "... for products powered by either a single-cell, two-cell, or three-cell alkaline, NiCd or NiMH, or one-cell Li-Ion or Li-polymer battery. " 

Including this great little component really expands the possibilities for powering Made With Magic items!  We're not stuck with the usual 2 AA/AAA batteries found in all the current MWM merchandise.  Tolerance of 5V is particularly welcome as 5V USB wall warts and backup battery packs have become common household items since cell phones and tablets have become popular.  Same goes for being able to use a rechargeable LiPo battery. 

So what approximate run times may be expected from these different power options?

I haven't seen anything posted providing estimates for the expected run times for MWM devices using each of these power sources.  So I foolishly, and quite naively, ran some very unscientific tests to see what I could get out of the options at my disposal.  For the alkaline battery tests, brand new Duracell batteries were used.  The battery packs were attached to components from either the WOC Sipper or Glove devices and let run continuously in 15 hr blocks with checking every hour until they shutdown.  Some other devices always were run at the same time off AC->DC power to prevent the test items from tripping the 'lonely 5hrs' shutdown and messing up the results.  And those results were:

battery size number hrs
alkaline AAA 1 5-6
alkaline AAA 2 22-23
alkaline AAA 3 37-38
alkaline AA 2 57-58
LiPo 3.7V 1200mA 1 50-51

... surprising single cell vs double cell results

The first surprise from these tests was that the single AAA only runs the device for 5+ hrs, while adding a second battery runs the setup for 22+ hrs, about 4X longer, not 2X as might be expected!  Adding a third AAA battery only gives approximately 15 hrs additional run time instead of another 17+ hrs as was seen when the second battery was added. 

Hooking the multimeter to the single AAA alkaline cell after it quit running the MWM item, it gave an unloaded voltage reading of 1.1-1.2V.  That's well above the 0.7V the boost converter is supposed to work with.  So it was hooked up again to see if it would run longer.  At best, it would only run another 10 min or so.  Done.  That, also, was surprising.

... consistent AA vs AAA results

Comparing the specs for a Duracell AAA battery under constant 100 mA load with a Duracell AA battery under the same load, the AA batteries have a bit more than twice the capacity (2348 mAh) of the AAA batteries (970mAh), and that's about what was seen here: 57/22 = 2.6X observed vs 2348/970 = 2.4X calculated.  The test results were actually just a bit longer than expected based upon the calculations.  Possible reasons for the discrepancy are discussed below.

After the poor results from a single AAA battery, I didn't bother trying a single AA battery to see how long it lasts.

... surprising LiPo results

Another surprise was how long the 3.7V LiPo battery lasted.  Based solely upon the differences in stated capacities, 1200mAh for the LiPo vs 2348mAh for 2 AA batteries,  I expected the LiPo battery would only last somewhere around 29h, or 51% of the AA battery run time.  It actually lasted a little over 50 h - or about 88% of the run time of the AA batteries.  That's quite a difference, around 72% longer than expected.

... initial impressions

  • Two AAA alkaline batteries may run a MWM device for just shy of 24 hrs.
  • Two AA alkalines will more than double that run time giving almost 2 and half days of output.
  • Three AAA alkaline batteries will give about a day and a half of run time.  
  • The 3.7V LiPo battery gave much longer than expected run times
  • The single AAA alkaline battery gave much less run time than expected. 

The inconsistencies  raise the following

... new questions

  • Why do two 1.5V alkaline batteries last SO much longer than one?
  • Why doesn't the third battery increase the run time as much as the second one?
  • Why do the MWM devices stop running when the residual battery voltage is still above 0.7V?
  • Why does the LiPo battery last much longer than expected, based upon the results from the alkaline batteries?

Getting to the bottom of things

To get a handle on what is going on with the power usages, an INA219 current sensor was purchased from LadyAda and hooked up downstream from a LM317 variable voltage regulator and upstream from an Arduino Uno.  The getcurrent.ino INA291 example program was modified to sample the current/voltage data every 10 msec, calculate a running ave current and track the maximum and minimum current values and then output the data each minute.

... testing the contribution of the LEDs under command mode, aka show mode

LEDs tend to use a lot of energy.  It seemed probable that their activity is responsible for a major portion of the device's overall energy usage.  To determine their relative contribution to the device's overall energy usage, the current draw was measured when the LEDs were turned off by sending the MWM command:

  • 93 60 D0 05 FF BA = no light, off

and another reading was taken when all three of the component RGB leds in each of the device's physical LEDs are held full on by sending:

  • 93 67 D0 05 FF 3C = steady white

Solid white should provide an estimate of the maximal energy usage each device is capable of at the indicated voltage.  In this case, 3.3V.

Measurements were taken for 5 min@ at an input voltage of 3.3V, a value which should minimize the necessary work by the boost converter.  The observed readings:

device LEDs V I ave, off I max, off I ave, white P ave,white I max, white P max,white
Ear Hat 1.6 2 3.3 2.8 mA 5.2 mA 79 mA 261 mW 87.5 mA 289 mW
Ear Hat 2.2 2 3.3 3 mA 5.3 mA 76 mA 251 mW 84 mA 277 mW
Headband 1.1 2 3.3 3 mA 5.3 mA 77.5 mA 256 mW 86 mA 283 mW
WOC 1.42 4 3.3 3 mA 5.5 mA 107 mA 353 mW 118 mA 389 mW
Chernabog 1.42 4 3.3 3 mA 5.2 mA 100 mA 330 mW 109.5 mA 361 mW
Glove(4) 1.2 4 3.3 3 mA 5.5 mA  95 mA 314 mW 105 mA 347 mW
Glove(12) 1.2 12 3.3 3 mA 5.5 mA 119 mA 393 mW 131 mA 432 mW

... takeaways

  • The 3mA-5.5mA current draw, when the LEDs are off, may be due entirely to the main processor running at 12-16MHz and 3.3V
  • As expected, the LEDs do contribute the most to the overall device energy usage.
  • The 100.7mA average current draw by devices with 4 LEDs is only 30% higher than the 77.5mA average draw by devices with 2 - instead of the 100% that might be expected.  The boards containing 4 LEDs share a single set of resistors on the right side and also on the left, which apparently keeps a lid on the current drawn when additional LEDs are added.
  • The 100mA drawn by 4 LEDs is substantially below the 400mA limit for the boost converter implying there may be room to drive even more LEDs from a single board.  The last entry in the table shows the result of connecting 12 RGB LEDs to a single glove board.  At 119mA drawn, that's a scant 18% higher than that drawn by 4 LEDs!   Yet, the visual impression is that the colors are still strong with no apparent skewing of the colors towards red as usually happens as the supplied voltage tails off.  See the glove customizing page for a short video.

... testing demo mode usages at various voltages

The basic electronic components used to construct the circuit boards for most of the MWM devices are pretty much the same.  However, the visual effects each device runs in demo mode are not always the same and the ones each uses at any given time seem to be randomly selected.   There's the possibility of substantial differences in energy utilization between the devices.

To get at an explanation for the results shown in the first table above, measurements had to be made on the devices running in their demo modes and at the different voltages representative of the various voltages these power sources pass through during discharge.   Each device was simply allowed to run through it's standalone/demo routines during an hour's worth of measurements made at a constant voltage. 

The voltages evaluated were:

  • 5.1V - typical USB AC-DC converter output.  In the neighborhood of the 5.5V max for the boost converter.
  • 4.7V - close to the voltage expected for 3, new alkaline batteries in series.
  • 4.2V - initial output for fully charged 3.7V LiPo battery
  • 3.7V - average output for LiPo battery
  • 3.2V - close to the voltage expected for 2, new alkaline batteries in series.
  • 2.7V - lowest voltage some LiPo batteries hit before undervoltage protection shutoff
  • 1.6V - close to the voltage expected for 1, new alkaline battery.
  • 1.2V - lowest voltage from the adjustable voltage regulator and close to the observed residual battery voltages measured after some MWM devices have shutdown.

The raw results are laid out in an Excel file, along with some scatter graphs, available for any of you who might be interested in taking a look at those details. 

... reality check

It would be just a matter of time until one of you out there checks these results and points out that most of the maximum mA values taken at 3.2V in demo mode exceed what we saw for solid white maximums just a while ago.  Here's the comparisons:

device LEDs V I max, white I max, demo dif % dif
Ear Hat 1.6 2 3.3 87.5 mA 93 mA 5.5 mA 6%
Ear Hat 2.2 2 3.3 84 mA 90 mA 6 mA 7%
Headband 1.1 2 3.3 86 mA 95 mA 9 mA 10%
WOC 1.42 4 3.3 118 mA 98 mA -20 mA -17%
Chernabog 1.42 4 3.3 109.5 mA 128 mA 18.5 mA 17%
Glove(4) 1.2 4 3.3 105 mA 114 mA 9 mA 9%
Glove(12) 1.2 12 3.3 131 mA -    

MWM infra red emitter5-6% we could probably chalk off to experimental error.  17% we can't. 

One LED's contribution that wasn't included in the 'solid white' measurements is the infrared LED that sends the demo-mode MWM codes to other devices.  That's it in the image to the right.  That component stops emitting codes after receiving external 'show' commands, as were sent to the devices to turn off the LEDs in that initial test.  However, it would have been fully functional in these more recent tests and, no doubt, contributed to some of those results.

Now that I have a customized Glove board to work with, I popped all the RGB LEDs out of their sockets and hooked that board up to the current sensor and let it run for an hour.  Here's what I got:

Load Voltage:    3.24 V
Ave Current:       3.18 mA
Max Current:       33.40 mA
Min Current:       1.60 mA

That average current value is only 0.18 mA above the 'off' value, but the maximum current value is 33.4 - 5.5 = 27.9 mA higher than when the 'off' signal is sent and the demo mode components have taken a pause.  Checking online, IR diodes that look like the one pictured above are usually rated at 20mA-60mA+.  So maybe we have our culprit. 

Actually, the Ear Hats, Headband and Glove boards all have what looks like an additional, smaller LED.  Could be it also contributes.  As far as I know, it's function hasn't been established yet.  It's missing on the World of Color and Chernabog boards.  That's interesting because the boards that have that extra LED all tend to sync with one another whereas the ones missing that LED don't seem to sync with anything!  Maybe it has something to do with syncing the devices.  Dunno.

... general observations

  • minimum average current drawn always at 3.7V; device averages, 2 LEDs = 28mA, 4 LEDs = 27mA
  • maximum average current drawn at 1.2V; device averages, 2 LEDs = 140mA, 4 LEDs = 149mA
  • lowest average power usage falls in a broad range between 2.7V-3.7V; device averages, 2 LEDs = 102mW, 4 LEDs = 102mW.
  • highest average power usage of 304mW at 5.1V, roughly 3X higher than the lowest average values!
  • the maximum power usage recorded was by the Chernabog device running at 5.1V, 1.1W!!
  • power efficiency at 1.6V only about 75% of that at 3.2-3.7V
  • power efficiency at 1.2V only about 60% of that at 3.2-3.7V

... why the LiPo battery runs longer than expected

It's now clear that the reason the LiPo battery lasted so much longer than the alkaline batteries is because a larger portion of it's discharge cycle falls within the voltage range with the most efficient energy usage.  3.7V is the discharge midpoint, which is right in the sweet spot.  The battery cuts out around 2.75-3V when the over discharge protection circuitry kicks in.  So the entire last half of the LiPo discharge takes place at optimal voltages.  The first half starts off around 4.2V, which comes with a 50% power penalty.  But that value decreases rapidly.  I saw 4.04V after the first hour.   Near as I can tell, probably 60%, or more, of the LiPo's capacity discharges at optimal voltages.  That beats all the other alternatives.

... why the devices shutdown before they hit 0.7V and what happens then

The maximum currents measured at 1.2V for many of the devices were already in the 300mA+ range.  Assuming the boost converter will continue trying to output the same amount of power at voltages down in this range, the voltage at which the current spikes will top out at the maximal 400mA can be estimated by:

  • V=P/I
device W (1.2V) I (max) est cutoff V
Ear Hat v1.6 0.41 0.4 1.03
Ear Hat v2.2 0.31 0.4 0.78
Headband v1.1 0.43 0.4 1.07
Chernabog v1.42 0.46 0.4 1.14
World of Color v1.42 0.40 0.4 1.00
Mickey Glove v1.2 0.40 0.4 1.01

So, for all but the Ear Hat v2.2, shut off due to an over current condition might be predicted to occur when the most energy demanding effect runs AND the remaining voltage is around 1 V. 

As a test, a single AAA battery, with a multimeter reading of 1.25V, was hooked up to the Headband board, let run until shutoff, monitoring continuously using the getcurrent.ino program instead of the modified program used previously. 

The last two measurements before shutdown and the subsequent two measurements afterwards were:

Bus Voltage:   0.78 V
Shunt Voltage: 21.33 mV
Load Voltage:  0.81 V
Current:       210.80 mA

Bus Voltage:   0.78 V
Shunt Voltage: 20.58 mV
Load Voltage:  0.80 V
Current:       203.70 mA

================== quit emitting ========================

Bus Voltage:   1.01 V
Shunt Voltage: 1.49 mV
Load Voltage:  1.01 V
Current:       14.90 mA

Bus Voltage:   1.03 V
Shunt Voltage: 1.45 mV
Load Voltage:  1.03 V
Current:       14.70 mA

Testing with a multimeter gave an apparent battery reading of 1.15V, but as seen above, the reading under a slight load was actually closer to 1V. 

It was also apparent during this test that the voltage under the heavier load actually approached 0.7V.  So was it low voltage under load or an over current situation that shut it down?  Don't know.  But it sure looks like 1V is where the action takes place.

And did it shut down or simply turn off the LEDs?  Once the LEDs went off, there remained an approximately 15mA draw for a drain of 1.03*14.7 = 15mW.  We saw in a previous section that simply  turning the LEDs off at 3.3V led to a 3.3v*3mA = 9.9mW draw - attributed most likely to continuing processor activity.  We've also seen that the boost converter is only about 60% efficient at 1.2V.  Doing the math, 9.9mW/15mW = 0.66 or 66% efficiency, which is right in line with what might be expected if the LEDs were simply turned off and the processor keeps running.

... why a single AAA battery runs such a comparably short time

The single alkaline AAA battery never even comes close to the more efficient power utilizing voltages.  It starts off with an approximately 25% power penalty that increases to around 40% by the time it hits 1.2V, which, near as I can tell, is close to where a good portion of the discharge cycle resides.

On top of that, the boost converter likely shuts off around 1V.  That's close to the end of the battery's capacity, but there is still a little more left in the tank that doesn't get used.  Combined, all these factors help explain why a single alkaline battery doesn't perform that well.

... why adding a third AAA battery doesn't increase run time as much as adding a second AAA battery

Adding that second battery in series jacks the initial output voltage to around 3.2V - right within the sweet spot for efficient power utilization and low current draw.  It stays within the sweet spot for at least 0.5V before dropping below 2.7V and beginning to take significant hits on efficiency and the current really begins to climb.  Yet, even below 2.7V, the efficiency is still higher than the 1.6V starting point for the single battery.  In essence, 2 batteries get a full 1.6V of discharge at a higher efficiency than the best a single battery can manage.   Apparently, that accounts for an improvement of 17 hrs over the single battery's run time, instead of just another 5 hrs.

Adding a third battery in series jacks the initial voltage to around 4.8V.  At that voltage, current draw is, on average, 40% higher than it is at 3.2V.  So even though the discharge by three batteries will linger 0.5V longer in the sweet spot than with two batteries, the preceding 1V will discharge at a current draw sufficiently higher to offset that advantage.  Consequently, we don't get as much improvement out of the third battery as we do with the second.  We only get an additional 15 hrs from the third instead of the 17 hrs seen from the second.  Apparently, starting at those higher voltages leads to a 2 hr discount when a third battery is added.

... coin cell batteries won't cut it - at least not without a lot of fiddling

Ideally, we'd be able to run our MWM devices off a 3V Lithium coin cell or two like the devices from Xylobands, Sendrato and Pixmob.  When I tried running a modified Glove board with only 2 LEDs plugged in, I got about 5 minutes run time out of a fresh CR2032 3V battery.  That's all.  The Ear Hat v2.2 board wouldn't even start up using a coin cell.  Not encouraging.

A white paper from TI puts the capacity of such coin cells at about 220mAh and makes an argument that the battery may handle currents up to 30mA and that adding a capacitor of 100uf may help get even more out of the coin cell.  Now 30mA is close to the average draw by most of the MWM devices at 3.2V.  So that part looks like it could work.  However, maximal usage bursts to 3-4X that value at that voltage.  That's clearly beyond what the coin cell can handle.  Maybe including the 100uf capacitor can handle the spikes?   However, when tested, including a 100uf capacitor only gave a run time of 2 minutes!  Actually, much worse than with no capacitor at all.  Didn't see that coming.

To make this work would require some major fiddling with the electronics.  Removing the LEDs involved in peer-to-peer syncing could save 20mA+ when running in demo mode.  Then total current sent to the RGB LEDs would need to be limited to 20-25mA as the base current draw of the typical MWM device at 3.2V was 3-5mA.  Maybe then this could work.  220mA/h with a continuous 30mA draw = 7 hrs run time, assuming we can drain the battery dry.  Wouldn't that be something? 

Looking ahead

  • Measure power usage by all the members of the 0x48 XX series of macros.  With such knowledge, it becomes possible to design very efficient sequences.  Here's a teaser:
    - 48 16 ave 17mA, max 88mA
    - 48 88 ave 48mA, max 91mA
  • Explore the dimming commands, such as 0xD0 0x32 XX, as a means to further conserve energy utilization.  In many instances, the output light level need not be 100%.  Example using 0x48 0x83 as the routine:
    - D0 32 7F (100% illum) ave 48mA, max 91mA
    - D0 32 40 (50% illum) ave 13mA, max 88mA
    - D0 32 20 (25% illum) ave 5.2mA, max 59mA
  • Dive into the energetics of the Wand and Paintbrush items. 
    - What is the cost of switching between the different stored routines?
    - What is the cost of transmitting the codes to other devices?
    - How much is drained when the Paintbrush plays a tune?
    - I have the impression that the ability of the Paintbrush to play tunes fails before the device,
      as a whole shuts down.  If true, what are the energy parameters at work there?


So there you have it.  Please do check out the numbers and correct things I may have gotten wrong.  I freely admit to flunking my Physics course in college that covered electronics and I don't even know where the College of Engineering was located on that campus.  I'm no expert, but thought this topic was important enough to take a go at.  Hope it helps some of you plot out your strategies when designing your own hacks.