Back to Smartcitizen.me

Calculating Barometric Pressure, eCO2 and eTVOC from API

Hello the SCK dashboard measures and displays these three values (pressure, eco2, eTVOC) routinely, but these values don’t seem to be immediately available through the API.

I checked out the documentation about CCS811 and noticed that they consider temperature and humidity to compensate for values of this sensor.

In looking through the documentation for pulling the latest readings, these lines of code seemed redundant (older versions?) using sensors that I don’t believe are in the SCK 2.1:

{
        "id": 8,
        "ancestry": null,
        "name": "MICS-2710",
        "description": "MOS NO2 gas sensor",
        "unit": "kOhm (ppm)",
        "created_at": "2015-02-02T18:17:23Z",
        "updated_at": "2015-07-05T19:56:21Z",
        "measurement_id": 6,
        "uuid": "1eb0249d-29d8-41be-8e24-d3b1e5773c0f",
        "value": 197.574,
        "raw_value": 197574,
        "prev_value": 182.971,
        "prev_raw_value": 182971
      },
      {
        "id": 9,
        "ancestry": null,
        "name": "MICS-5525",
        "description": "MOS CO gas sensor",
        "unit": "kOhm (ppm)",
        "created_at": "2015-02-02T18:17:44Z",
        "updated_at": "2015-07-05T19:56:07Z",
        "measurement_id": 5,
        "uuid": "7baaecb7-2586-4063-9c15-bfa999e329aa",
        "value": 276.753,
        "raw_value": 276753,
        "prev_value": 278.468,
        "prev_raw_value": 278468
      },
      {
        "id": 21,
        "ancestry": null,
        "name": "Microchip RN-131",
        "description": "802.11 b/g WiFi",
        "unit": "# networks",
        "created_at": "2015-05-04T11:17:18Z",
        "updated_at": "2015-07-05T19:57:22Z",
        "measurement_id": 9,
        "uuid": "5b1f0e38-336a-4abf-9989-69b48f0026ef",
        "value": 4,
        "raw_value": null,
        "prev_value": 4,
        "prev_raw_value": null
      },

I would love some guidance on knowing the calculations or calls for getting real-time values of:

  1. Barometric Pressure
  2. eCO2
  3. eTVOC

(It’s okay if they’re not super accurate and if we still need to consider burn-in time)

thank you very much! :slight_smile:

The most important thing to know about the Barometric pressure readings is that they are “actual” values, not adjusted in any way for altitude (which the SCK does not know). The government weather report includes barometric pressure adjusted for altitude, that is, 0 metres above mean sea level. Barometric pressure of course varies with altitude in roughly linear fashion, and a barometer can be used as an altimeter.
So SCK pressure readings will almost never agree with the published weather report.
You can do 3 things:
a) ignore it, because you need actual pressure that’s why you got SCK.
b) if your location is fixed, you can modify pressure readings mathematically to eliminate the altitude effect giving you barometric pressure at MSL.
c) if you move your SCK around you can add a GPS sensor which can give you exact dynamic altitude no matter where you are and use this value to mathematically offset your pressure readings to MSL adjusted values.

Part 2: why you might want to use absolute pressure readings.

Being a physics nerd you may already be aware of the relationship between relative humidity, temperature and pressure. Others might not.

Did you ever wonder why bottoms of clouds in the sky seem to be at (roughly) the same altitude ?
Well that might be because, that at that altitude, pressure drops to the right amount, temperature falls to the right amount for the relative humidity to reach 100% saturation aka “dew point”. Water precipitates into droplets that form around microscopic dust particles to form clouds. If the water droplets are big enough gravity causes them to fall as rain.

If the barometric pressure should fall then the dew point might occur at a lower altitude. So clouds are lower in the sky, and you might even get precipitation in the form of fog, rain or snow at ground level.
So, this is the phenomena we see put to use in an old style barometer. The design of the dial embodies the simple relationship that when pressure falls it means rain on the way.

So now you can see the role of the various (Temp, Hum, Press, Dust) sensors in SCK. The pressure used in such calculations is of course the absolute pressure. It corresponds to the weight of atmospheric air in a column above the measurement point.

You needed to know all that right ? Not everyone realizes or remembers this stuff from high school physics classes.