8000 Add CO2, eCO2 sensor types by brentru · Pull Request #45 · adafruit/Adafruit_Sensor · GitHub
[go: up one dir, main page]

Skip to content

Add CO2, eCO2 sensor types #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Adafruit_Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ void Adafruit_Sensor::printSensorDetails(void) {
case SENSOR_TYPE_NOX_INDEX:
Serial.print(F("Nitrogen Oxides (Index)"));
break;
case SENSOR_TYPE_CO2:
Serial.print(F("Carbon Dioxide (ppm)"));
break;
case SENSOR_TYPE_eCO2:
Serial.print(F("Equivalent/estimated CO2 (ppm)"));
break;
}

Serial.println();
Expand Down
7 changes: 6 additions & 1 deletion Adafruit_Sensor.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ typedef enum {
SENSOR_TYPE_COLOR = (17),
SENSOR_TYPE_TVOC = (18),
SENSOR_TYPE_VOC_INDEX = (19),
SENSOR_TYPE_NOX_INDEX = (20)
SENSOR_TYPE_NOX_INDEX = (20),
SENSOR_TYPE_CO2 = (21),
SENSOR_TYPE_eCO2 = (22),
} sensors_type_t;

/** struct sensors_vec_s is used to return a vector in a common format. */
Expand Down Expand Up @@ -142,6 +144,9 @@ typedef struct {
normal (unitless) */
float nox_index; /**< NOx (Nitrogen Oxides) index where 100 is normal
(unitless) */
float CO2; /**< Measured CO2 in parts per million (ppm) */
float eCO2; /**< equivalent/estimated CO2 in parts per million (ppm
estimated from some other measurement) */
sensors_color_t color; /**< color in RGB component values */
}; ///< Union for the wide ranges of data we can carry
} sensors_event_t;
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ typedef enum
SENSOR_TYPE_COLOR = (17),
SENSOR_TYPE_TVOC = (18),
SENSOR_TYPE_VOC_INDEX = (19),
SENSOR_TYPE_NOX_INDEX = (20)
SENSOR_TYPE_NOX_INDEX = (20),
SENSOR_TYPE_CO2 = (21),
SENSOR_TYPE_eCO2 = (22),
} sensors_type_t;
```

Expand Down Expand Up @@ -143,6 +145,8 @@ typedef struct
float tvoc;
float voc_index;
float nox_index;
float CO2,
float eCO2,
sensors_color_t color;
};
} sensors_event_t;
Expand Down Expand Up @@ -188,6 +192,8 @@ A key part of the abstraction layer is the standardisation of values on SI units
- **tvoc**: values are in **parts per billion** (ppb)
- **voc_index**: values are an **index** from 1-500 with 100 being normal
- **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)


## The Unified Driver Abstraction Layer in Practice ##
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit Unified Sensor
version=1.1.7
version=1.1.8
author=Adafruit <info@adafruit.com>
maintainer=Adafruit <info@adafruit.com>
sentence=Required for all Adafruit Unified Sensor based libraries.
Expand Down
0