hackAIR app: Sky photos for air quality estimation

Just one click on your smartphone – and you know more about the air quality in your neighbourhood!

With the hackAIR app , you can take a sky photo that will be analysed and will inform you about the estimated levels of air pollution. Contribute to the growing number of sky photos on the hackAIR platform and learn more about the air quality where you live.

Here is a step-by-step guide how to do it.

Step 1: Download the hackAIR app (if you haven’t done so already)

Step 2: Check the weather: you need at least some BLUE sky (not only clouds)

Step 3: Consider time of the day: don’t take photos close to sunset or sunrise

Step 4: Go to the app feature “Take a sky photo”

Step 5: Hold your phone in an upright position (see above)

Step 6: Focus your phone camera on sky – do not photograph the sun directly

Step 7: Take a photo

Step 8: Submit your photo to the hackAIR platform through the app feature

 

Your photo will show up in your hackAIR user profile immediately. It takes a couple of hours until your photo is analysed and is visible on the map of the hackAIR platform. You can search for your sky photos by choosing “My photos” on the platform.

 

(Sky photo published on hackAIR platform, taken on March 27. Rated as good air quality.)

 

 

How does this work?

Particles in the atmosphere (dust, smoke, pollution) can block sunlight by absorbing or by scattering light. This affects the colour of the blue sky. From your image, we calculate the ratio between red and green. This ratio, in correlation to location, time and date, allows an estimation of the current air pollution levels.

Make sense of your hackAIR sensor data

Once you’ve set up your hackAIR sensors, the question is: what can you do with the data? Of course, you can check it day by day on the map, but wouldn’t it be cool to do more? Let’s see what’s already possible.

This blog post has been written for hackAIR users who are familiar with Excel and curious about data visualisation. Please check out what hackAIR communications lead Wiebke Herding has learned about visualising data! We’d also love to hear from you what you have been experimenting with.

From the sensor profile

Each sensor has its own profile page that you can find by going to Profile > Sensors. After a moment’s wait, you’ll get a list of the latest measurements translated as air quality ratings.

Using the ‘Export Measurements’ button, you can then download the exact measurements from your sensor in CSV format. This way, you can export 5000 measurements at a time – if you need more, just run multiple exports. Note: the timestamp in the export is in GMT – depending on your own time zone, you might need to adjust this (e.g. add an hour if you are based in Berlin).

Air pollution over time with Excel

After downloading the files, you can open them in Excel. I then added three columns to be able to access the values I was interested in:

  • Date CET: =<Date>+”01:00″
  • PM10: =IF(<Pollutant_Q_Name>=”PM10_AirPollutantValue”,<Pollutant_Q_Value>,””)
  • PM2.5: =IF(<Pollutant_Q_Name>=”PM2.5_AirPollutantValue”,<Pollutant_Q_Value>,””)

Note: these formulas assume that you use English localisation settings. If you use Excel in a different language, you might need to adjust quotation marks and commas.

Using Insert >PivotChart, I created a chart with Date CET as the axis and PM10 and PM2.5 as the values. I set both values to show the average PM measurement and changed the chart type to a line graph. The result was a time series of daily averages:

Using the report filter buttons at the bottom right, I could then zoom into the hourly averages and finally into the individual measurements.

As I am currently running two sensors (120 is a hackAIR home v1 at the front of my house, 255 is a hackAIR home v2 in a more protected space at the back), I can also compare the two:

 

On average, the sensor at the front of my house picked up 53% more PM10 particles, and 23% more PM2.5 particles in the testing period.

Building graphs that update themselves

As downloading the files can get tedious over time, we could also use the hackAIR API to access our data. We can use a service like data.world for that. After setting up an an account and creating a new project, you can add your own sensor data using Add data > Add from URL.

Paste the following link: https://api.hackair.eu/hackair_data?access_key=1234 (replace 1234 with your own sensor’s access key). Add the extension .json to the file name, and you’re good. 

To enable automatic updates, go to project settings, and enable the Automatic Sync Options. You can then explore your data and build graphs like the one below.

Data.world alone will not give you graphs that you can permanently link to, but it’s provides good access to the API data. One option for building graphs is Google Data Studio. Log in and add a data source, adding data.world as a community connector. You’ll need the URL of your data.world project. To import all data from your sensor, add “SELECT * FROM <table_name>” as your SQL query. To be able to use the data, you’ll need to make a few adjustments:

  • date_str: set the type to Date Hour (YYYMMDDHH)
  • pollutant_q_value: set the aggregation to None

Now add two new fields and set both of them to aggregation = Average.

  • PM10 with the formula “CASE WHEN pollutant_q_name=”PM10_AirPollutantValue” THEN pollutant_q_value ELSE 0 END”
  • PM2.5 with the formula “CASE WHEN pollutant_q_name=”PM2.5_AirPollutantValue” THEN pollutant_q_value ELSE 0 END”

Now you can set up your report, for example using the time series chart or the data table. Play around – and when you’re done, you can share the link to your sensor data. Here’s the view of my recent measurements: https://datastudio.google.com/open/11iG_TgonCmPy0nFmUS0ObVWLudstQk4M

How about measurements from a specific geographic area?

You can download the latest measurements from a rectangular geographic area as follows:

  1. Determine the coordinates of the top left corner of your area, e.g. by locating it on OpenStreetMap and selecting show address. This will give you a pair of two numbers, the latitude (e.g.  52.6315 for Berlin) and the longitude (e.g. 13.1259 for Berlin). We’ll call them lat1 and lon1.
  2. Determine the coordinates of the bottom right corner of your area, e.g.  52.3153, 13.7569 for Berlin. Again, we’ll call them lat2 and lon2.
  3. Go to the following location: https://api.hackair.eu/hackair_data?location=lon1,lat1|lon2,lat2 (replacing the lon and lat variables with your actual values)

Now you can either add this link to data.world (as explained above) or transform it to a csv file using a JSON to CSV service (like Konklone.io/json). After you import or connect this data to Google Data Studio, you’ll again need to make a few adjustments:

  • date_str: set the type to Date Hour (YYYMMDDHH)
  • pollutant_q_value: set the aggregation to None

Now add two new fields:

  • with the formula “CASE WHEN pollutant_q_name=”PM10_AirPollutantValue” THEN pollutant_q_value ELSE 0 END”. Set the aggregation to average.
  • coordinate with the formula “CONCAT(loc_coordinates_1,”,”,loc_coordinates_0)”

You can now add a map to your report. Here are, for example, some of the latest measurements in the Netherlands:

Over to you!

  • What other ideas do you have to visualise and use the data you collect through hackAIR? Any cool tools we’ve missed?

My hackAIR story: Manuel from Berlin

Manuel Fricke was one of the first to set up a hackAIR home sensor in Berlin. He joined us last week at the hackAIR partners meeting for a conversation. Manuel works in the volunteer management department of BUND in Berlin.

Here is what he shared with us:

What motivated me to build my own hackAIR sensor? I am interested in climate politics, cycling and local politics. And: I wrote an article about hackAIR for BUND. That sparked my interest even more. I thought: this is cool! I can be the first in my network to build a sensor!

When I heard that BUND was offering sensor kits, I ordered one immediately. I wanted to build something and to use technology in order to learn more about my environment. I thought it would not be too complicated and it would not take too long.

Building the sensor

As a digital native, downloading the Arduino software was not difficult for me. I found out quickly that I had to turn off my firewall before I could access the different libraries. The labelling on the board to set up the cables was slightly different from the tutorial. But I managed to connect everything. When I started to build the sensor, I wasn’t aware that I would need a power supply outside. That meant that I needed to set up the sensor in my backyard. I would have preferred to have it at the front of my house with the busy traffic, but I could not get a power cable through my window there. For the sensor casing, I chose the plastic bottle. It works fine.

After following the steps as explained in the tutorial, I was not sure whether my sensor was connected. It was trial and error. When I finally connected my sensor to the hackAIR platform, I could see data in my profile and on the map. Measurements in my profile are always up-to-date, that is great. On the map, there is currently a delay: it shows measurements from two days ago. That needs to be fixed.

I tried to export the sensor data, it has not worked yet. I have seen that the sensor collects data on air pollution, humidity and temperature, but those values are not being displayed. It would be really interesting to have access to all the data.

How to use the air quality data

I’d like to see my sensor data being used by researchers and to talk to others in my neighbourhood about the traffic in our street. Especially the morning commute brings a lot of cars, because people take side roads and everything gets blocked. You can smell and hear them. At the same time, everyone opens their windows to let ‘fresh’ air in, and children walk to school. It would be great to set up a bunch of hackAIR sensors to monitor those peaks of air pollution.

As a cyclist, I want to explore how such measurements can support my own viewpoint also on a political scale. Better infrastructure for bikes would mean less cars on the road and less pollution.  

What’s next?

I have been sharing information about hackAIR with my friends, and I will order a second kit to set up another measurement point. My tip for hackAIR: involve young people! Invite teenagers who are interested in computers. It is easy enough and still challenging enough. hackAIR has potential: just get the kids engaged!

What I really like about hackAIR? It is cool – new – nice design – for me very inviting! It is fun, not too hard to assemble, not very high-tech. And it is a great way to let people know about the issues of air quality in cities.

Thank you, Manuel, for your engagement! And thank you, Arne Fellermann and Lisa Bieker from BUND, for inviting Manuel to our meeting.

Build your own sensor: hackAIR in action

While it is possible to contribute to a better air quality map on your own, it’s a lot more fun to do so in a community of people. That’s why we’re travelling across Europe to participate in and organise workshops and activities on air quality and citizen sensing: Have a look at some recent events in Germany, Belgium and Norway!

Linking up at Open Data Day

Open Data Day is an annual celebration of open data all over the world: 406 events took place on March 3, 2018! It is an opportunity to show the benefits of open data and encourage the adoption of open data policies in government, business and civil society.

hackAIR was partner of the Frankfurt Hackathon, and hackAIR team members Arne Fellermann (BUND) and Carina Veeckman (VUB) also contributed to Open Data Day events in Stuttgart and Brussels.

Arne travelled across Germany on March 3 (Berlin to Frankfurt to Stuttgart and back) and participated in two Open Data Day events: at OK Lab Frankfurt and at OK Lab Stuttgart. He concludes:

 

“Great communities of OK Labs, inspiring talks and input. Great to discuss the activities of luftdaten.info. We also received valuable and constructive feedback on hackAIR.”

 

 

The Open Data Day event in Brussels (“Towards clean air with open data”) was organised by Open Knowledge Belgium and Civic labs. All resources are available and open for everyone to use: presentations, videos and pictures. Carina Veeckman (VUB) spoke about: “Participatory processes for air quality measurements through hackAIR”. Carina’s presentation slides and the video of her talk give a good overview of the work of hackAIR in the field of air quality measurement and citizen science. She says:

 

Open Data Day was celebrated in Brussels with an event fully dedicated to open air quality.

The event was a great networking opportunity for hackAIR to strengthen collaborations, and make new contacts.”

 

Build your own sensor: workshop by NILU

 On March 1, hackAIR partner NILU organised a sensor-building workshop in Oslo. 16 people showed up, from high school students, civil servants of the municipality of Oslo, students of meteorology and environmental activists. After building the hackAIR home sensor, they set them up in simple cases (thanks to luftdaten.info for providing fantastic ideas), with the following adaptations:

  • conductive silicone tube (10 cm) to avoid particles to be attached/accumulated inside the tube
  • sensor mounted on the vertical part of the PVC pipe to facilitate the air flow
  • extra part to the PVC pipe added to avoid sensor falling down

 

The sensors will now be set up across Oslo and operate until June to increase our collective understanding of air quality patterns in the Norwegian capital.

Want to organize your own hackAIR workshop? We’ve got a full workshop toolkit with all instructions for you – or give us a shout, and we might even come by!

Copyright 2021. All rights reserved

Take part in this short survey and help us improve your hackAIR experience.