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.



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.



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:



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:



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:



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



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:



This appears in the Data Drop cloud like this:



The result was this DateListPlot 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:




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:



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!



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



Svenja avatar

The Raspberry Pi Foundation’s endorsement of Proprietary software always make me sad …

Tom West avatar

The Foundation’s central aim is to improve computing skills through better education. Nothing in that excludes proprietary software.

SimonFD avatar

Why sad? RasPi is not about exclusion – it’s about inclusion. It’s about getting people to expand their horizons, and hats off to wolfram for proving what is a very sophisticated and expensive tool FOR FREE!!!!!

Nigel MacLeod avatar

The Pi Weekly headline was talking about analysing weather data, of which I have collected about 10 years worth and want to present in some way. Is there an article anywhere which explains how this might be done on my Pi 2 with Wolfram?

Comments are closed