Message Boards Message Boards

Capturing Data from an Android Phone using Wolfram Data Drop

Posted 10 years ago

Started reading Bruce Schneier's "Data and Goliath's" Book, which made me wonder on the potential of mass surveillance. Let's tests some concepts of what can be done by the metadata generated by the smartphone, using the Wolfram Data Drop announced by Stephen Wolfram this march on the wolfram blog.

There is a neat application called Tasker, which allows for the automation of scripts (tasks) on the android phone, triggered by events, time or phone state changes. In this example, we'll simulate the "It's just metadata" approach by capturing some phone variables and pushing the values into the new DataDrop Universal accumulator via the web api.

Here is the how-to recipe to establish a data push to the databin every two minutes.

Task Creation. Created a task called WolframDataDrop, which contains two actions. The first action:Say was placed there for debugging purposes. It will announce that data will be pushed to the cloud. The HTTP Post is the actual action that uses the Web API to accumulate the data points into the Databin.

enter image description here

HTTP Post Action. This is the actual WEBAPI Details, the screen capture explains how to set up the different data pieces. enter image description here

Profile. I've generated a profile that will trigger the posting of the variables into the Wolfram Data Drop every two minutes.

enter image description here

After releasing the profile, we can check if the data is flowing by visiting the databin's web page.

enter image description here

Now to the Mathematica side of things.


enter image description here

The Tasker HTTP Posting is sending the data in String type, so we need to convert the records to numbers.

DateListPlot[battery,PlotRange->{Automatic,{0,100}},PlotLabel->"Battery Charge (%) Trend",PlotTheme->"Detailed"]

enter image description here

We can also see on a map where we've been located since we turned on the data log.


What about speeding during the commute? Let's take the GPS Speed variable and chart this morning's travel. The pnone captures the speed in meters/second. Let's chart using miles per hour.

PlotLabel->"Speed of Commute (mph)",PlotTheme->"Detailed"]

enter image description here

POSTED BY: Diego Zviovich
12 Replies
Posted 10 years ago

Wanted to share with the community some extra very interesting functionality that @nikie answered in the mathematica stackexchange that can be very useful and cool when combined with the GeoLocation Data gathering functionality. Extracting road curves from image.

POSTED BY: Diego Zviovich

Diego, this is terrific. Tasker hadn't occurred to me before, but I immediately started creating some tasks and profiles on my phone after reading your post.

You might consider adding "Interpretation" to your databin so all the values for a given key are automatically assigned correct quantities or put into more immediately useful formats.

Here you can find out standard units for different Tasker variables:

And then you could do something like this with your example bin above :

      "locSpeed" -> Restricted["StructuredQuantity", ("Meters")/("Seconds")], 
      "lightLevel" -> Restricted["StructuredQuantity", "Lux"], 
      "magneticField" -> Restricted["StructuredQuantity", "Microteslas”]
POSTED BY: Alan Joyce
Posted 10 years ago

Thank you for the posting Alan, it is most helpful!

POSTED BY: Diego Zviovich

Another trick I'm enjoying:

Rule[#[[1]], #[[2]]] & /@ Values[Normal[bin[All, {"loc", "magneticField"}]]];

There's almost certainly a more elegant way to handle the first step there, but the output is a nice map that plots the intensity of some selected variable at the point it was sampled.

POSTED BY: Alan Joyce


I did something similar, but without Databin at the time for the iPhone,

I have managed to look at Parkinson tremor data with it though. The things is that the streaming only works within the same network or it records the data locally - which is not that much fun. Alternatively, a Raspberry can pick the signal up and relay it to the Databin. I, too, have tried to get a Tasker like program for the iPhone and the closest thing I could find was:

It can send data by email. I managed to record my GPS positions on the way to work with it and have it sent to an email account. So technically it should work with the Databin. I'll try to show results later.



POSTED BY: Marco Thiel

Yes, Marco, I also thought of your smart phone post right away. If you get any experimenting with iOS done - let us know, I would be very curious. There is new Barometer sensor on iPhone 6 - interesting to test.

POSTED BY: Vitaliy Kaurov

I'd be interested to see if there was an iPhone version of Tasker as well.


POSTED BY: Adriana O'Brien

You can try IFTTT apps.

POSTED BY: Vitaliy Kaurov

This is fantastic, Diego, thank you for sharing! I will have to play with this. I am giving the link to the Tasker app you were using. Looks like they have some starter guides on their site.

POSTED BY: Vitaliy Kaurov
Posted 10 years ago

Thanks Vitaly! I'm currently logging a snapshot of the variables every 2 minutes. For a better study on my phone usage pattern, I created three additional profiles:one when I turn on the screen, one when I turn off the screen, one when I navigate between applications. I had to remove the wolframdatalog task from them and replace it with a data logger on the phone memory due to the restrictions of a maximum of 60 data points per hour on the free account.

I'll have to search for a similar app for my kid's iphones. Im interested to see how much of their time they spend on their phone. Seems they are always plugged to the device.

POSTED BY: Diego Zviovich

This is just amazing Diego! I'll definitely experiment with my Android Tablet using this. Thanks for sharing!

POSTED BY: Bernat Espigulé
Posted 10 years ago

Thanks Bernat. Loved your Time Lapse Video and Data Drop example. Please let me know what cool things you got to do with the table.

POSTED BY: Diego Zviovich
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract