Skip to content

Commit 6ac3e2d

Browse files
authored
Merge pull request #41 from tyeth/add-voc-nox-index
Adds NOx and VOC index to sensor types
2 parents 334044c + d3d2fd7 commit 6ac3e2d

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

Adafruit_Sensor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ void Adafruit_Sensor::printSensorDetails(void) {
6464
case SENSOR_TYPE_TVOC:
6565
Serial.print(F("Total Volatile Organic Compounds (ppb)"));
6666
break;
67+
case SENSOR_TYPE_VOC_INDEX:
68+
Serial.print(F("Volatile Organic Compounds (Index)"));
69+
break;
70+
case SENSOR_TYPE_NOX_INDEX:
71+
Serial.print(F("Nitrogen Oxides (Index)"));
72+
break;
6773
}
6874

6975
Serial.println();

Adafruit_Sensor.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ typedef enum {
6767
SENSOR_TYPE_VOLTAGE = (15),
6868
SENSOR_TYPE_CURRENT = (16),
6969
SENSOR_TYPE_COLOR = (17),
70-
SENSOR_TYPE_TVOC = (18)
70+
SENSOR_TYPE_TVOC = (18),
71+
SENSOR_TYPE_VOC_INDEX = (19),
72+
SENSOR_TYPE_NOX_INDEX = (20)
7173
} sensors_type_t;
7274

7375
/** struct sensors_vec_s is used to return a vector in a common format. */
@@ -136,8 +138,12 @@ typedef struct {
136138
float current; /**< current in milliamps (mA) */
137139
float voltage; /**< voltage in volts (V) */
138140
float tvoc; /**< Total Volatile Organic Compounds, in ppb */
139-
sensors_color_t color; /**< color in RGB component values */
140-
}; ///< Union for the wide ranges of data we can carry
141+
float voc_index; /**< VOC (Volatile Organic Compound) index where 100 is
142+
normal (unitless) */
143+
float nox_index; /**< NOx (Nitrogen Oxides) index where 100 is normal
144+
(unitless) */
145+
sensors_color_t color; /**< color in RGB component values */
146+
}; ///< Union for the wide ranges of data we can carry
141147
} sensors_event_t;
142148

143149
/* Sensor details (40 bytes) */

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ typedef enum
7474
SENSOR_TYPE_AMBIENT_TEMPERATURE = (13),
7575
SENSOR_TYPE_VOLTAGE = (15),
7676
SENSOR_TYPE_CURRENT = (16),
77-
SENSOR_TYPE_COLOR = (17)
77+
SENSOR_TYPE_COLOR = (17),
78+
SENSOR_TYPE_TVOC = (18),
79+
SENSOR_TYPE_VOC_INDEX = (19),
80+
SENSOR_TYPE_NOX_INDEX = (20)
7881
} sensors_type_t;
7982
```
8083

@@ -137,6 +140,9 @@ typedef struct
137140
float relative_humidity;
138141
float current;
139142
float voltage;
143+
float tvoc;
144+
float voc_index;
145+
float nox_index;
140146
sensors_color_t color;
141147
};
142148
} sensors_event_t;
@@ -179,6 +185,10 @@ A key part of the abstraction layer is the standardisation of values on SI units
179185
- **current**: values are in **milliamps** (mA)
180186
- **voltage**: values are in **volts** (V)
181187
- **color**: values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format
188+
- **tvoc**: values are in **parts per billion** (ppb)
189+
- **voc_index**: values are an **index** from 1-500 with 100 being normal
190+
- **nox_index**: values are an **index** from 1-500 with 100 being normal
191+
182192

183193
## The Unified Driver Abstraction Layer in Practice ##
184194

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.6
2+
version=1.1.7
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)