In this project, students make a calculator that determines the Air Quality Index (AQI) given user-input sensor data. All calculations follow methods published by the US Environmental Protection Agency (EPA) and give students practice handling user input, rounding/truncating, calculating the max and min, and must handle a a simple calculation that requires either a look-up table or conditionals. This assignment can be given early in the semester to help students gain experience and proficiency with loops, calculating max/min, using conditionals and boolean expressions.
It can also be used--with some modifications--at many points in the curriculum to explore more complex data structures (2d arrays or dicts), to practice function decomposition, or even object-oriented programming. I have successfully used the assignment twice in one semester, letting students return to the assignment later to see how much simpler the solution becomes when they are able to use functions and complex data structures. See the "redux" files attached here.
Introduce the idea of the different sensors in class by showing pictures of devices that capture sensor readings from the environment --- there are many pictures consumer-grade and commercial-grade sensors that you can find online and show to the class. Also, as of 2018, the EPA publishes ArcGIS data of EPA sensor locations used by AirNow (https://www.epa.gov/outdoor-air-quality-data, https://www.epa.gov/outdoor-air-quality-data/interactive-map-air-quality-monitors) so you can show what sensors are nearby. Making this connection to the local air quality maps increases the relevancy of the assignment.
This project provides a relevant context for students and helps them see interdisciplinary connections. Students enjoy exploring AQI maps of their local community from the AirNow website, learning about the embedded sensors that collect the data in the field, and learning how the formula from the EPA works. Students can check their calculator against an 'official' AQI calculator online, so they recognize that they are doing a 'real world' calculation and not some over-simplified version.
The project has several required "code checks" built in that provide opportunity for faculty or TAs to give individualized feedback to students. But these kinds of interactions can do so much more: They are opportunities to give students encouragement, to impart tacit professional knowledge, and to help students begin to see themselves as computer scientists.