Jon's Place

Monday, January 19, 2015

Work Stuff

Some of you might be interested in the stuff I am doing at my day job (Mozilla - been working for them for two years now).

In general, I'm building tools for measuring power consumption on FirefoxOS phones. Those tools include hardware and software components. I did a post a little over a year ago, when I first started working on power stuff.

This year, I'm building a new version of the battery harness, one that is portable. The idea is, you attach it to your phone, and spend the day wandering around, doing whatever it is that you do, and all the while the battery harness is logging power usage data to a micro SD card.

I assume the people reading this are more interested in how it all works, so I'll dive down into the details now.

The battery harness basically pulls the battery out of the phone, and provides a secure mechanical adapter to power the phone from the battery, while allowing the positive line to be intercepted, between the battery and the phone. This shunt goes to the ammeter (a custom board that I designed and built), and the ammeter measures voltage drop across a resistor to get instantaneous current.

Normally, the ammeter is in a small 3D printed box, and is connected to a PC view a USB cable. There is an AVR on the ammeter running some custom C code, and it sends power usage data over this USB cable to a Python application running on the host PC. With this new portable harness, I mounted the ammeter directly to the harness, and mounted a Sparkfun OpenLog board under it, connected to the debug hardware serial port on the ammeter (which normally isn't used). You can see these pieces on the following pictures:

Portable Harness with Ammeter

Bottom of Portable Harness, with OpenLog Board

You can also see a small Pololu Voltage Regulator board tucked in there in the second picture. It is a step-up/step-down regulator, and produces a steady 5 volts from anything between 2.7 and 11.8 volts.

Normally the ammeter is powered from the host PC over USB, but with this setup there is no host PC. We can't power it from the phone, because that will interfere with the power consumption measurements. So I got another little single cell 850 mAh Lipo battery from Sparkfun, and mounted it where the phone battery would normally go. It provides 5 volts (using the regulator) to power both the ammeter and the logging board.

Here's what it looks like together:

Portable Battery Harness
I designed and 3D printed a cover, so you could put the whole assembly into your pocket without electrocuting yourself or damaging the electronics. In the above picture, the cover is on the left, and contains an on/off power switch, a charge port (for the small lipo battery), and a neat little turning catch to hold it in position.

Here's what it looks like put together:

Portable Battery Harness with Cover
It make the phone somewhat thicker of course, but it allows you to still use all the features of the phone (including the camera) while measuring power consumption.

Here's a picture with the power switch on. The three LEDs are on the ammeter - green is power, red is a flashing heartbeat, and yellow is an indicator for a software switch on the ammeter. The OpenLog board has a small blue LED, but you can't really see it in the picture.

Portable Battery Harness - Powered Up
There is still a lot of work to do on this - the charging system is not ideal, and I'd like to integrate it better, I also need to write some software on the phone itself, so it logs specific events (like "Took a picture") that can be correlated with the power log. I also need to figure out a way to monitor the voltage on the small LiPo, so I don't accidentally drop its voltage down below 3.0 volts (which can cause permanent damage to these batteries).


  • It looks really cool, for sure. Will you share some measures too? I always wanted to know how much power are using our devices.

    By the way, It would be great if we could compare it to an Android device too.

    By Blogger Unknown, At January 20, 2015 at 6:38 AM  

  • The basic design works for any type of phone that has a removable battery, but this one is specifically designed to fit Flame devices. We have a normal harness that works with the Nexus-4 phone, and we use that to compare FirefoxOS and Android power usage.

    By Blogger Unknown, At January 20, 2015 at 7:40 AM  

  • If you hook up to the serial console port of the phone, you should be able to log any messages that the phone generates. Depending then on the size of the storage on the logger, you can correlate the activities on the phone to the power consumption.

    By Blogger Rogan Dawes, At March 12, 2015 at 9:45 AM  

  • Pretty cool.

    What are using to measure current? Something like INA219B? That is what I use for the USB Tester.

    Also the battery will shutdown itself if the voltage drops too low. All the batteries from SFE or Adafruit have a protection circuit. Also you can use the MAX fuel gauge to monitor the battery. sells breakouts for it.

    By Blogger MrMobileWill, At March 16, 2015 at 5:16 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home