Thursday, June 11, 2015

A Smart Programming Language for a Smart Cities Hackathon

Liz: Here’s a guest post from Bernat at Wolfram, who has been putting the Wolfram Language on the Pi to work at a Smart Cities Hackathon in Barcelona. If you haven’t used the Wolfram Language before, this is a nice little glimpse into what it’s capable of: enjoy!
____
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.

workingatahackathong

 

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

 

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:

CityBikesAPI-with-GeoGraphics

 

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:

number-of-bicycles-available1

 

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:

bike-sharing-system-and-data-drop

 

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

WolframAlpha-data

 

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:

PIR-motion-sensor-and-RaspiCam-add-to-databin

 

This appears in the Data Drop cloud like this:

data-in-datadrop-cloud

 

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

DataListPlot-of-cumulative-numbers

 

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

monitor-halls-activity

 

 

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:

tweeted-ListLinePlot

 

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!

SmartCities-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

 

The post A Smart Programming Language for a Smart Cities Hackathon appeared first on Raspberry Pi.

No comments:

Post a Comment