Wolfram Computation Meets Knowledge

A Smart Programming Language for a Smart Cities Hackathon

On Friday, February 20, I had the pleasure of giving a talk to a group of young and smart individuals enlisted to represent Barcelona in the Global Urban Datafest. For this hackathon, the organizers offered one Raspberry Pi platform per team and a variety of sensors to capture physical parameters. Their list of suggested project topics included data acquisition and actuation, monitoring and management, security transport and mobility, the environment, and more. The event lasted three days and was locally organized by Anna Calveras and Josep Paradells with the help of Universitat Politècnica de Catalunya, Barcelona’s City Council, iCity Project, Urbiotica, IBM, and Wolfram Research.

Hackathon participants

Early on, hackathon participants were oriented to the various tools available to aid them with development. I showed the hackathon participants that the Wolfram Language knows about thousands of real-world entities, and that everything in the language is a symbolic expression.

symbolic expression of real-world entities in wolfram language

Using CityBikes API to get real-time data, it was easy to track usage in a bike-sharing system in a smart city. Importing and visualizing this data with GeoGraphics was straightforward:

Importing and visualizing citybikes api data with geographics

I ran a scheduled task to obtain the data for Barcelona every 10 minutes. Here is an animation of that data, showing bike usage in Barcelona over a 24-hour period:

Download CDF

Then I explained how I used a Raspberry Pi to digest Friday’s bicycle data overnight. The microprocessor was set up to compute the total number of bicycles available in different cities every 10 minutes from 3:30–8:30am CET:

Using raspberry pi to compute the total number of bicycle available in different citiies every 10 minutes

European cities showed a valley in the number of available bicycles at 8am when people cycled to work. Citizens from New York and Mexico City were found to head back home around 5am CET.

Essential for this hackathon was the new Wolfram Data Drop, an open service that makes it easy to accumulate data of any kind, from anywhere, which works great on the Pi while connected to the Wolfram Cloud. The following is a dataset that I created for Barcelona’s bike-sharing system. Every 3 minutes the total number of parked bicycles is added to a Databin:

Dataset for barcelona's bike sharing system using wolfram data drop

One of the cool features of Data Drop is that you can directly analyze this data through Wolfram|Alpha:

Analyzing data through wolframalpha

Another dataset that I created using a Raspberry Pi monitored the pedestrian flow happening at the front door of my apartment. If any movement was detected by a PIR motion sensor, the RaspiCam would take a photo, and a new entry would be added into a databin:

RaspiCam takes photos and adds them to the databin

This appears in the Data Drop cloud like this:

How data appears in datadrop cloud

The result was this DateListPlot of cumulative numbers of movements detected:

DataListPlot of cumulative numbers of movements detected

Then I showed how it could be set up to monitor my home hall’s activity in regular periods of time:

Set up to monitor hall's activity in regular periods of time

Certainly, this opens up a new world of possibilities. For example, you can use Data Drop to combine data from specific events from different devices. This was exactly what one of the teams did. They set up a Twitter account with ServiceConnect to inform people of the current air pollution in “La Diagonal,” Barcelona’s most important avenue. Every 20 minutes they checked the latest values of 10 gas sensors, and then generated and tweeted a ListLinePlot with a map of the sensors:

Generated and tweeted ListLinePlot with a map of the sensors

Other smart city projects involved the use of the new Machine Learning capabilities available in Mathematica 10, such as FindFaces to estimate the number of individuals in a bar, or BarcodeRecognize for a universal citizen ID card project. For most of the participants, this was their first encounter with the Wolfram Language, and yet they made useful, functional prototypes in just 48 hours. So I can’t wait to see what they are capable of with just a bit more practice. I wish all of them tons of happy, smart coding!

Smart cities hackathon participants

If you haven’t participated in a hackathon yet, check out the Smart City App Hack. Also feel free to contact us for future events, and don’t forget to have a look at Create, Code, Deploy: Workshop for Hackathons if you missed it. Finally, if you are looking for a three-week-long hackathon, apply now to the Wolfram Innovation Summer School or the Wolfram Science Summer School.

Download this post as a Computable Document Format (CDF) file


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.

1 comment

  1. I find the Timeline plot of Date: hour of day vs. time in the Wolfram|Alpha databin analysis mildly amusing.