Skip to content

Commit 355dde3

Browse files
authored
Merge pull request #45 from brentru/add-eco2
Add CO2, eCO2 sensor types
2 parents 6ac3e2d + 175c626 commit 355dde3

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Adafruit_Sensor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ void Adafruit_Sensor::printSensorDetails(void) {
7070
case SENSOR_TYPE_NOX_INDEX:
7171
Serial.print(F("Nitrogen Oxides (Index)"));
7272
break;
73+
case SENSOR_TYPE_CO2:
74+
Serial.print(F("Carbon Dioxide (ppm)"));
75+
break;
76+
case SENSOR_TYPE_eCO2:
77+
Serial.print(F("Equivalent/estimated CO2 (ppm)"));
78+
break;
7379
}
7480

7581
Serial.println();

Adafruit_Sensor.h

100755100644
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ typedef enum {
6969
SENSOR_TYPE_COLOR = (17),
7070
SENSOR_TYPE_TVOC = (18),
7171
SENSOR_TYPE_VOC_INDEX = (19),
72-
SENSOR_TYPE_NOX_INDEX = (20)
72+
SENSOR_TYPE_NOX_INDEX = (20),
73+
SENSOR_TYPE_CO2 = (21),
74+
SENSOR_TYPE_eCO2 = (22),
7375
} sensors_type_t;
7476

7577
/** struct sensors_vec_s is used to return a vector in a common format. */
@@ -142,6 +144,9 @@ typedef struct {
142144
normal (unitless) */
143145
float nox_index; /**< NOx (Nitrogen Oxides) index where 100 is normal
144146
(unitless) */
147+
float CO2; /**< Measured CO2 in parts per million (ppm) */
148+
float eCO2; /**< equivalent/estimated CO2 in parts per million (ppm
149+
estimated from some other measurement) */
145150
sensors_color_t color; /**< color in RGB component values */
146151
}; ///< Union for the wide ranges of data we can carry
147152
} sensors_event_t;

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ typedef enum
7777
SENSOR_TYPE_COLOR = (17),
7878
SENSOR_TYPE_TVOC = (18),
7979
SENSOR_TYPE_VOC_INDEX = (19),
80-
SENSOR_TYPE_NOX_INDEX = (20)
80+
SENSOR_TYPE_NOX_INDEX = (20),
81+
SENSOR_TYPE_CO2 = (21),
82+
SENSOR_TYPE_eCO2 = (22),
8183
} sensors_type_t;
8284
```
8385

@@ -143,6 +145,8 @@ typedef struct
143145
float tvoc;
144146
float voc_index;
145147
float nox_index;
148+
float CO2,
149+
float eCO2,
146150
sensors_color_t color;
147151
};
148152
} sensors_event_t;
@@ -188,6 +192,8 @@ A key part of the abstraction layer is the standardisation of values on SI units
188192
- **tvoc**: values are in **parts per billion** (ppb)
189193
- **voc_index**: values are an **index** from 1-500 with 100 being normal
190194
- **nox_index**: values are an **index** from 1-500 with 100 being normal
195+
- **CO2**: values are in **parts per million*** (ppm)
196+
- **eCO2**: values are in **parts per million*** (ppm)
191197

192198

193199
## The Unified Driver Abstraction Layer in Practice ##

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit Unified Sensor
2-
version=1.1.7
2+
version=1.1.8
33
author=Adafruit <[email protected]>
44
maintainer=Adafruit <[email protected]>
55
sentence=Required for all Adafruit Unified Sensor based libraries.

0 commit comments

Comments
 (0)