How phone batteries measure the weather (August 2013)

This is the story of the most surprising thing we have yet discovered at OpenSignal.

Eighteen months ago we began gathering data on battery performance from our Android app - the metrics available on Android include charge level, voltage and battery temperature. These are relevant to our mission to understand and map the world's wireless networks, since poor signal can lead to increased battery consumption.

After 6 months of data collection, we chanced on an unexpected relationship. Aggregating daily battery temperature readings to city level revealed a strong correlation with historic outdoor air temperature. With a mathematical transformation, the average battery temperature across a group of phones gives the outdoor air temperature.

Harnessed properly, this could change the way weather data is collected, which is why we built Weathersignal an app and a website for crowdsourcing the weather.

At that time, we were in contact with Dr Aart Overeem, one of a group of researchers at the Royal Netherlands Meteorological Institute (KNMI) and Wageningen University (Hydrology and Quantitative Water Management Group; Meteorology and Air Quality Section) investigating how data from cell towers can be used to measure rainfall. We showed them the graphs below. Working together, and with additional input from Berthold Horn of MIT, we produced a scientific paper which has just been published by Geophysical Research Letters. Here we provide the story behind that paper.

The Data

This time last year we had built up 40 million readings of battery temperature from 150k Android devices. On a whim, we took the subset covering London and tried plotting it alongside data from Except for a few exclusions - such as filtering out extremely high and low battery temperatures and a couple of models - we left the data raw.

The following graph shows mean daily battery temperature for phones in London alongside mean daily temperature recorded by a London weather station.

An echo of a shape

Through all the noise, there is a signal: the outside ambient air temperature

The temperature of the battery depends on several factors: whether it is indoors/outdoors/in a pocket; how intensively it is used, and its efficiency. In producing the above graph we did not attempt to correct for any of these, yet through all this noise, there is a signal: the outside ambient air temperature.

The graph demonstrates a strong linear correlation between battery temperature and air temperature for London (Pearson coefficient of 0.82). A linear correlation means that a linear transformation - a simple formula - will map from one to the other. This is what the transformation produces:

Transforming from battery to air temperatures: a magic formula

Preliminary results, in the paper we look at look at longer periods (3 months+)

The two lines are in good agreement, the mean absolute difference between the two is 1.45°C, impressive considering the temperature varies over a 14°C range during this period. Furthermore, the weather station remains fixed in one place while our readings are aggregated over all of London, so some degree of that difference is explained by the fact we are measuring temperature in different places.

A similar approach yields good results for other cities:

It's not just London

Transformed battery temperature
Historic temperature

Android devices could provide a valuable supplement to weather station data

Extending this approach, we looked at 8 cities worldwide, each across two different seasons, the mean absolute error was 1.52°C.

Note how the LA weather station data for July 4th is incorrect - unless it was a seriously chilly Independence Day - check out this error where we found it at Wunderground. Here we have one data point where the Android data is actually more reliable than the traditional source.

Spilling the secret sauce, the transformation for London: Te= 2.55*Tc - 60.52

As promised the transformation that aligns our lines so neatly is simple:

For London: Te= 2.55*Tc - 60.52
In general: Te= mTc + k (the general form for a linear transformation)
Where: Te is environmental (outside) air temperature; Tc is temperature of the cellphone battery. Temperatures are in °C.

There are just two things we need to do to translate cellphone battery temperatures into outdoor temperatures. We stretch the temperature by multiplying by m (2.55 for London) then we shift it by adding k (-60.522).

How it (sort of) works: single user

Let's get a feeling for why this formula makes sense by looking at a special case. By "special case" we mean something that never actually happens, but hopefully it will help us understand the phenomenon better. Imagine a phone being carried in a user's pocket whilst outside. Suppose both the user and the battery generate a constant supply of heat. For this phone, we can say two things:

1. The battery temperature will be offset from the outdoor temperature. The skin tends to be hotter than the environment and heat generated within the battery further raises its temperature. This accounts for the fact that we need to subtract something - i.e k. In general the shift could be positive, for example if the user spends time in an air-conditioned environment.

2. The only thing that can budge the temperature of the battery are changes in environmental temperature. Note, however, that one degree of change in environmental temperature will produce a change in the battery temperature of less than one degree. The battery is insulated by the fabric of their trousers while the constant heat produced within it also moderates the influence of external temperature changes. We need to multiply by m.

Each of the premises in the above example is unlikely to be true. Users aren't always outside, the phone is not always in their pocket and neither body nor battery produce a constant supply of heat. It doesn't matter, because the formula doesn't apply to single users.

In case you're wondering, that little orange fellow in the image on the right is Atmos. He lives in the WeatherSignal app and tries to work out where you are and what you're doing (walking, cycling ... ) using your phone's sensors.

How it (really) works: many users

After showing the above graphs to Berthold Horn of MIT, he devised a general heat-flow model showing why - when averaged over many users - the simple formula works. A derivation of that model appears in the paper - which due to the generosity of the Netherlands Organisation for Scientific Research is open access, here we'll describe it in non-mathematical terms.

Although for each phone and user the heat produced in the battery and body varies, as does the degree of insulation between phone and outside, when averaged over a lot of phones these values are roughly constant.

Things are slightly more subtle than that: the "constants" k and m have a hidden dependence on the environmental temperature - for example when a heat wave strikes in the UK, people change the clothes they wear and try to spend more time outside. This behaviour influences the values of m and k and means that the model requires tuning for place and times of year. The good news is that m and k seem stable over periods of time - the graph for London shows that despite the 14°C range of temperature, the same values produce good results across one month.

The Big Data Approach

From large volumes of noisy data, valuable information can be distilled.

This finding demonstrates the validity of our approach at OpenSignal: from large volumes of noisy data, valuable information can be distilled. This is key to understanding the power of the Big Data approach: more data can beat cleaner data. With WeatherSignal we're applying this to meteorology, with OpenSignal to measuring network performance.

WeatherSignal: Real time weather crowdsourcing

This research is based entirely on data gathered from users of OpenSignal, our app to help find better signal and create independent coverage maps. It's a great app, trust us, but it's not a weather crowdsourcing app. To take full advantage of the potential of smartphones in meteorology, we built WeatherSignal.

WeatherSignal allows users to monitor the many sensors on their device - light, magnetism, pressure and more - while contributing to a realtime weather map. At the moment we're not using it make weather predictions, that will come.

The more people using WeatherSignal greater the possibilities become. We've just reached 90,000 downloads worldwide. With a hundred thousand people in single city using this app, we would have a picture of the weather of unprecedented detail. Changes in light would allow the tracking of single clouds and historic data would enable precise modeling of the urban heat island effect. For some more ideas on how this app could be used, check out this blog post we wrote after one week of WeatherSignal.

We will be releasing data dumps of WeatherSignal data for academic use, please contact us if this could be of use to your research.

Start contributing:
Download WeatherSignal
Get it on Google Play
Don't have Google Play? Download here!

Sensor repurposing & sensor networks

The addition of a hygrometer and ambient temperature sensor in the Galaxy S4 are evidence of the trend to incorporate more and more sensors into devices. Often these sensors are added with one particular use case in mind - barometers for example are used to assist the GPS in getting an altitude fix; light sensors are used to regulate screen brightness. As with the battery thermometer, these sensors can be repurposed.

Much, perhaps most, of the data in existence is produced by our interactions with the internet, providing a partial view of our lives and surroundings. On aggregate this data can be useful in informing us about the world - for many years Google was able to monitor flu epidemics based on searches for flu symptoms, no-one is sure why, but lately Google has been getting this wrong.

Sensor networks - automated crowdsourcing of data - provide an unmediated view of the world. There will still be noise in the data but it may be of a more predictable sort than the data that can be garnered from social networks.

Left: the addition of sensors to Samsung's Galaxy S series The full story of how temperature and humidity sensors made it into the Samsung Galaxy S4 is rather fascinating.

The smartphone as blackbox

In as much as being a node in a sensor network is of benefit to society, it is of personal benefit also; but there is a more immediate way in which sensor data could be used: it turns your phone into the personal equivalent of a plane's Black Box Recorder.

Imagine your doctor could instantly access data on which countries you've been in, the extremes of pressure and temperature you'd experienced, the amount of exercise you are getting, even the humidity where you live. The smartphone-sensor-network is poised to become one of the most powerful tools in both meteorology and medicine.

If, like us, you're impatient for the future, you can start using WeatherSignal as your Black Box right now. Here're some instructions on how to use WeatherSignal for Quantified Self tracking.

This study and these apps, and even billion dollar sensor networks like Waze, are just the beginnings of this type of technology. Enough social networks, let's build a better world with sensors.

Right: to improve our weather crowdsourcing, we're trying to understand the conditions readings were taken under (indoors, outdoors, the activities of the user), since our model would likely give better results if we tuned it differently according to these problems. The medical "Black Box" and crowdsourced weather are closely related.