AQI calculations

In the latest Arduino code for the Pro v4.2, the AQI calculations don’t quite seem to match the calculation listed on Wikipedia, so wondering if there is just a slight correction needed, or a different formula used
Air quality index - Wikipedia

For example, for the Moderate level, the Arduino code shows

  else if (pm02 <= 35.4) return ((100 - 50) / (35.4 - 12.0) * (pm02 - 12.0) + 50);

According to the Wikipedia article, the I(low) value should be used in two places, which is 51 in the article, but 50 in the code.
Similarly, C(low) should be used in 2 places, which would be 12.1 according to the article, but 12.0 in the code.

Minor difference, but I assume you want it to be as accurate/consistent as possible

If I’m reading it right, it should be

  else if (pm02 <= 35.4) return ((100 - 51) / (35.4 - 12.1) * (pm02 - 12.1) + 51);
3 Likes