Protecting children from breathing hazardous air

By James Abela. Posted

Circuit design of the CO2 sensor using just Raspberry Pi Designed on circuito.io

Originally published in Hello World Issue 17: Health and well-being, October 2021. All information true at the time of original publishing.

James Abela shares how his computer science students solved the very real problem of predicting air pollution and looks at the classroom environment that made this possible

In 2018, Indonesia burned approximately 529,000 hectares of land. That’s an area more than three times the size of Greater London, or almost the size of Brunei. With so much forest being burned, the whole region felt the effects of the pollution. Schools frequently had to ban outdoor play and PE lessons, and on some days schools were closed completely. Many schools in the region had an on-site CO2 detector to know when pollution was bad, but by the time the message could get out, children had already been breathing in the polluted air for several minutes.

My Year 12 students (aged 16–17) followed the news and weather forecasts intently, and we all started to see how the winds from Singapore and Sumatra were sending pollution to us in Kuala Lumpur. We also realised that if we had measurements from around the city, we might have some visibility as to when pollution was likely to affect our school. 

Making room for student-led projects

I’ve always encouraged my students to do their own projects, because it gives programming tasks meaning and creates something that they can be genuinely proud of. The other benefit is that it is something to talk about in university essays and interviews, especially as they often need to do extensive research to solve the problems central to their projects.

This project was much more than this: it was a genuine passion project in every sense of the word. Three of my students approached me with the idea of tracking CO2 to give schools a better idea of when there was pollution and which way it was going. They had had some experience of using Raspberry Pi computers, and knew that it was possible to use them to make weather stations, and that the latest versions had wireless LAN capability that they could use. I agreed to support them during allocated programming time, and to help them reach out to other schools.  

I was able to offer students support with this project because I flip quite a lot of the theory in my class. Flipped learning is a teaching approach in which some direct instruction, for example reading articles or watching specific videos, is done at home. This enables more class time to be used to answer questions, work through higher-order tasks, or do group work, and it creates more supervised coding time.

I initially started doing this because when I set coding challenges for homework, I often had students who confessed they spent all night trying to solve it, only for me to glance at the code and notice a missing colon or indentation issue. I began flipping the less difficult theory for students to do as homework, to create more programming time in class where we could resolve issues more quickly. This then evolved into a system where students could work much more at their own pace and eventually led to a point at which older students could, in effect, learn through their own projects, such as the pollution monitor.

Building the pollution monitor

The students started by looking at existing weather station projects — for example, there is an excellent tutorial at helloworld.cc/weatherstation. Students discovered that wind data is relatively easy to get over a larger area, but the key component would be something to measure CO2. 

We found a sensor (the CCS811 sensor module) on a Malaysian site called Lazada. It was designed to work with an Arduino, and so we connected our Raspberry Pi via its USB port to an Arduino and so to the CO2 sensor. You could also order a more accurate sensor directly from the Arduino store (the MG-811 sensor) or order a variety of sensors from eBay, such as the MQ-135 hazardous gas sensor. We then used the ‘Get started with Arduino’ guide to help us connect the two together. The advantage for us was that the CO2 sensor module we bought was designed to interface with the Arduino, so it was easier to install. It is also possible to connect Raspberry Pi directly to such a sensor using a breadboard, an analogue-to-digital converter (MCP3008 will work), a 1K resistor, and a 470 ohm resistor (see the circuit design image above).

Arduino sensor used for detecting pollution

We were very pleased to see that data started to come through showing us the CO2 levels. Our plan was to run the Raspberry Pis headless and export this data to Google Sheets. We found an excellent way to do this in Python using the Google Sheets API. This meant that our spreadsheet was automatically loaded with real data and from there, we could make a visualisation to show the CO2 data as it was being generated. We also contacted other schools around Kuala Lumpur to see if they would be interested in putting a device on their roof, and most were interested in the idea. 

Beaten to the punch

We were not the only ones with such an idea and around this time, a company called IQAir began selling the AirVisual Pro, which did almost exactly what we hoped to do and did it incredibly well. Schools were already very receptive to the idea and quickly invested in the technology. It is still very impressive to think that three Year 12 students came up with an idea that solved the very real concern of pollution visibility and were only fractionally behind a commercial solution. 

This project really helped these students to decide whether they enjoyed the hardware side of computing, and solving real-world issues really encouraged them to see computing as a practical subject. This is a message that has really resonated with other students, and we’ve since doubled the number of students taking A level computer science. Since doing this project, I’ve encouraged students to take on the Extended Project Qualification. This will give them time to really explore concepts and allow them to put their programming to good use, tackling problems that interest them and that the world needs solving.


https://twitter.com/eslweb

Print

Free - UK only

If you’re a UK-based teacher, volunteer, librarian or something in between, we'll send each issue free to your door.

Digital

Free

Just want to read the free PDF? Get each new issue delivered straight to your inbox. No fuss and no spam.

Buy

From £6

If you’re not a UK-based educator, you can buy print copies from our store.