Skip to content

Commit

Permalink
add pm readings
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Mar 3, 2023
1 parent 175c626 commit ea6ce0b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Adafruit_Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ void Adafruit_Sensor::printSensorDetails(void) {
case SENSOR_TYPE_eCO2:
Serial.print(F("Equivalent/estimated CO2 (ppm)"));
break;
case SENSOR_TYPE_PM10_STD:
Serial.print(F("Standard Particulate Matter 1.0 (ppm)"));
break;
case SENSOR_TYPE_PM25_STD:
Serial.print(F("Standard Particulate Matter 2.5 (ppm)"));
break;
case SENSOR_TYPE_PM100_STD:
Serial.print(F("Standard Particulate Matter 100 (ppm)"));
break;
case SENSOR_TYPE_PM10_ENV:
Serial.print(F("Environmental Particulate Matter 1.0 (ppm)"));
break;
case SENSOR_TYPE_PM25_ENV:
Serial.print(F("Environmental Particulate Matter 2.5 (ppm)"));
break;
case SENSOR_TYPE_PM100_ENV:
Serial.print(F("Environmental Particulate Matter 100 (ppm)"));
break;
}

Serial.println();
Expand Down
18 changes: 18 additions & 0 deletions Adafruit_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ typedef enum {
SENSOR_TYPE_NOX_INDEX = (20),
SENSOR_TYPE_CO2 = (21),
SENSOR_TYPE_eCO2 = (22),
SENSOR_TYPE_PM10_STD = (23),
SENSOR_TYPE_PM25_STD = (24),
SENSOR_TYPE_PM100_STD = (25),
SENSOR_TYPE_PM10_ENV = (26),
SENSOR_TYPE_PM25_ENV = (27),
SENSOR_TYPE_PM100_ENV = (28)
} sensors_type_t;

/** struct sensors_vec_s is used to return a vector in a common format. */
Expand Down Expand Up @@ -147,6 +153,18 @@ typedef struct {
float CO2; /**< Measured CO2 in parts per million (ppm) */
float eCO2; /**< equivalent/estimated CO2 in parts per million (ppm
estimated from some other measurement) */
float pm10_std; /**< Standard Particulate Matter 1.0 in parts per million
(ppm) */
float pm25_std; /**< Standard Particulate Matter 2.5 in parts per million
(ppm) */
float pm100_std; /**< Standard Particulate Matter 100 in parts per million
(ppm) */
float pm10_env; /**< Environmental Particulate Matter 1.0 in parts per
million (ppm) */
float pm25_env; /**< Environmental Particulate Matter 2.5 in parts per
million (ppm) */
float pm100_env; /**< EnvironmentalParticulate Matter 100 in parts per
million (ppm) */
sensors_color_t color; /**< color in RGB component values */
}; ///< Union for the wide ranges of data we can carry
} sensors_event_t;
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ typedef enum
SENSOR_TYPE_NOX_INDEX = (20),
SENSOR_TYPE_CO2 = (21),
SENSOR_TYPE_eCO2 = (22),
SENSOR_TYPE_PM10_STD = (23),
SENSOR_TYPE_PM25_STD = (24),
SENSOR_TYPE_PM100_STD = (25),
SENSOR_TYPE_PM10_ENV = (26),
SENSOR_TYPE_PM25_ENV = (27),
SENSOR_TYPE_PM100_ENV = (28)
} sensors_type_t;
```

Expand Down Expand Up @@ -147,6 +153,12 @@ typedef struct
float nox_index;
float CO2,
float eCO2,
float pm10_std,
float pm25_std,
float pm100_std,
float pm10_env,
float pm25_env,
float pm100_env,
sensors_color_t color;
};
} sensors_event_t;
Expand Down Expand Up @@ -194,7 +206,12 @@ A key part of the abstraction layer is the standardisation of values on SI units
- **nox_index**: values are an **index** from 1-500 with 100 being normal
- **CO2**: values are in **parts per million*** (ppm)
- **eCO2**: values are in **parts per million*** (ppm)

- **pm10_std**: values are in **parts per million*** (ppm)
- **pm25_std**: values are in **parts per million*** (ppm)
- **pm100_std**: values are in **parts per million*** (ppm)
- **pm10_env**: values are in **parts per million*** (ppm)
- **pm25_env**: values are in **parts per million*** (ppm)
- **pm100_env**: values are in **parts per million*** (ppm)

## The Unified Driver Abstraction Layer in Practice ##

Expand Down

0 comments on commit ea6ce0b

Please sign in to comment.