Adafruit is open and shipping! Let's build back better, together!
0

iCufflinks improved battery life code change
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: iCufflinks improved battery life code change

by scott_42 on Fri Jul 22, 2011 7:52 pm

adafruit wrote:you can solder to the pads with 30 AWG wire

Turns out my problem with TPI was that I suck at soldering SOT23-6 size devices. Once I got it soldered down properly, it all just worked as expected.

Here are my gheto cufflinks. Factory code on left, my custom code on the right.
Image
IMG_0538 by scott-42, on Flickr

scott_42
 
Posts: 124
Joined: Mon May 30, 2011 10:46 am
Location: Santa Clara, CA

Re: iCufflinks improved battery life code change

by adafruit on Sat Jul 23, 2011 8:07 pm

ok so we realized during testing your mod that the code in github was a wrong (older) version
we've pushed the right code and then integrated yours. we'll be testing this mod in a race! but agree it should be better because its now WDT sleeping and at a lower speed (we may change the speed slowdown to keep the quality of the LED pwm fairly high) :)
please try out the latest commit!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by scott_42 on Sat Jul 23, 2011 8:42 pm

The PWM is running at 58.5Hz (cpu at 32kHz) and 1.88kHz (cpu at 1MHz). Clock speed is about a 35 μA option, that is the difference between 1MHz and 32kHz clocks.

I'm working on a write up about the different power savings for each part I changed.

scott_42
 
Posts: 124
Joined: Mon May 30, 2011 10:46 am
Location: Santa Clara, CA

Re: iCufflinks improved battery life code change

by adafruit on Sat Jul 23, 2011 9:17 pm

yeah, only issue is now its a little flickery. we might bump it to a div64 instead of div256 and see how that looks :)

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by scott_42 on Sat Jul 23, 2011 9:53 pm

Here is a link to my writeup of the code and power: http://www.garlicsoftware.com/articles/

scott_42
 
Posts: 124
Joined: Mon May 30, 2011 10:46 am
Location: Santa Clara, CA

Re: iCufflinks improved battery life code change

by adafruit on Sat Jul 23, 2011 11:17 pm

awesome analysis! we'll post this on the blog!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by len17 on Sat Jul 23, 2011 11:42 pm

scott-42 wrote:Here is a link to my writeup of the code and power: http://www.garlicsoftware.com/articles/

A landmark work in the field of Fashion Science! :)

len17
 
Posts: 394
Joined: Sat Mar 14, 2009 7:20 pm

Re: iCufflinks improved battery life code change

by adafruit on Mon Jul 25, 2011 4:21 pm

scott-42 wrote:Here is a link to my writeup of the code and power: http://www.garlicsoftware.com/articles/


scott, email support@adafruit.com - we have a special gift for you!

cheers,
adafruit

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by Catmacey on Tue Jul 26, 2011 11:06 am

Would it be possible to remove the LED series resistor and let the coin cell itself provide that function due to it's internal resistance? Does it work like that?

Removing that resistor would save even more power.
If the LED is too bright you could always reduce the PWM maximum values to compensate and save more power again due to lower average current?
Catmacey
 
Posts: 2
Joined: Tue Jul 26, 2011 10:57 am

Re: iCufflinks improved battery life code change

by adafruit on Tue Jul 26, 2011 2:18 pm

thats a good question. the problem is that the PWM would have to be much more precise: right now we're maybe using 0.5-1mA to drive the LED. if it was driven directly from the battery it would probably draw 5mA so we'd have to have the PWM range from 0 to maybe 10% instead of now where it ranges from 0 to 100% which tends not to look as good :/

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by Catmacey on Tue Jul 26, 2011 5:24 pm

You could try using a larger PWM Period counter whilst retaining the same duty values.

For example; Keep your 8bit PWM duty values, but run the Period at 9 bit or 10 bit. That would half or quarter your maximum average current (256/512 or 256/1024) and still give you good resolution at the low end.

You'd have to run the PWM at a higher frequency to avoid flicker, but I'm assuming that savings on not having a resistor outweigh the cost of running CPU a bit faster. That assumption might be wrong of course...

It should actually give you better control at the lower intensity range as the higher frequency PWM would give a smaller duty step so the difference between off and duty = 1 would be smaller.

Does that make sense?
I hope I'm explaining myself... Not sure of the exact terminology.
Catmacey
 
Posts: 2
Joined: Tue Jul 26, 2011 10:57 am

Re: iCufflinks improved battery life code change

by adafruit on Wed Jul 27, 2011 3:15 pm

its a possibility. we dont think we'd remove the resistor overall, but maybe reduce it to a 10 ohm. the tradeoff is we'd have to run the chip at a much higher speed to keep the PWM smooth. for example, even a 64 divider was noticeable - we'd probably back it up to 1 Mhz or higher. in such cases, even 'naptkin' math doesn't help you at all in these situations because the LED is being driven nonlinearly :)

hey scott42, want to try it? ;)

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: iCufflinks improved battery life code change

by scott_42 on Thu Jul 28, 2011 12:51 am

To test that I would need to acquire a stack of CR1220 batteries, a couple battery holders that I can get leads on, and a couple more of those SMT LEDs (I can imagine at least one going poof while testing this kind of stuff). I only have stacks of CR20xx here at the moment. I'll try to remember to add that to my next order so I can play around with it a bit.

I wonder what the internal resistance profile is for various discharge rates. I'll need to find some data sheets on the specific battery brand if they even have any. This is sort of getting into organic chemistry land. Lithium/manganese dioxide (Li/MnO2) electrodes with an organic electrolyte. I'm sure someone has figured it out already and wrote it down, just need to find it.

Apparently these batteries are covered under the standard ANSI C18.3M, Part 1-2008 ($85 if you want an official copy, don't waste your money it's not worth it, I have a copy). It doesn't specify any internal resistance values to be followed, only the certification values. So the battery needs to be able to drive a 62k ohm load 24 hours a day for 750 hours to qualify. Cutoff voltage is 2.0V (from starting point of 3.0V). There is an integral to figure that out and I don't want to hurt my brain right now, so that is about 36mAh at a 48μA draw.

Once I get some goodies I'll play around with it.

scott_42
 
Posts: 124
Joined: Mon May 30, 2011 10:46 am
Location: Santa Clara, CA

Re: iCufflinks improved battery life code change

by scott_42 on Thu Aug 04, 2011 3:02 pm

Got some goodies in the mail today. CR1220 batteries along with some CR1216 since I'm sure your trying to use those as well. :P A couple of battery holders and I'm all set for some testing later on today.

Image
IMG_0569 by scott-42, on Flickr

scott_42
 
Posts: 124
Joined: Mon May 30, 2011 10:46 am
Location: Santa Clara, CA

Re: iCufflinks improved battery life code change

by adafruit on Thu Aug 04, 2011 3:13 pm

oooh goody! :) we are hoping to use the CR1216 in the inecklace design, right now we're in the middle of getting the necklace chains done

we will also try to hammer on this code this weekend

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.