Skip to content

Commit

Permalink
Merge pull request #41 from tyeth/add-voc-nox-index
Browse files Browse the repository at this point in the history
Adds NOx and VOC index to sensor types
  • Loading branch information
brentru authored Dec 20, 2022
2 parents 334044c + d3d2fd7 commit 6ac3e2d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Adafruit_Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ void Adafruit_Sensor::printSensorDetails(void) {
case SENSOR_TYPE_TVOC:
Serial.print(F("Total Volatile Organic Compounds (ppb)"));
break;
case SENSOR_TYPE_VOC_INDEX:
Serial.print(F("Volatile Organic Compounds (Index)"));
break;
case SENSOR_TYPE_NOX_INDEX:
Serial.print(F("Nitrogen Oxides (Index)"));
break;
}

Serial.println();
Expand Down
12 changes: 9 additions & 3 deletions Adafruit_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ typedef enum {
SENSOR_TYPE_VOLTAGE = (15),
SENSOR_TYPE_CURRENT = (16),
SENSOR_TYPE_COLOR = (17),
SENSOR_TYPE_TVOC = (18)
SENSOR_TYPE_TVOC = (18),
SENSOR_TYPE_VOC_INDEX = (19),
SENSOR_TYPE_NOX_INDEX = (20)
} sensors_type_t;

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

/* Sensor details (40 bytes) */
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ typedef enum
SENSOR_TYPE_AMBIENT_TEMPERATURE = (13),
SENSOR_TYPE_VOLTAGE = (15),
SENSOR_TYPE_CURRENT = (16),
SENSOR_TYPE_COLOR = (17)
SENSOR_TYPE_COLOR = (17),
SENSOR_TYPE_TVOC = (18),
SENSOR_TYPE_VOC_INDEX = (19),
SENSOR_TYPE_NOX_INDEX = (20)
} sensors_type_t;
```

Expand Down Expand Up @@ -137,6 +140,9 @@ typedef struct
float relative_humidity;
float current;
float voltage;
float tvoc;
float voc_index;
float nox_index;
sensors_color_t color;
};
} sensors_event_t;
Expand Down Expand Up @@ -179,6 +185,10 @@ A key part of the abstraction layer is the standardisation of values on SI units
- **current**: values are in **milliamps** (mA)
- **voltage**: values are in **volts** (V)
- **color**: values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format
- **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


## 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.6
version=1.1.7
author=Adafruit <info@adafruit.com>
maintainer=Adafruit <info@adafruit.com>
sentence=Required for all Adafruit Unified Sensor based libraries.
Expand Down

0 comments on commit 6ac3e2d

Please sign in to comment.