meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| sensor:ens160 [2026/03/21 20:45] – created vamsan | sensor:ens160 [2026/03/22 02:14] (current) – [lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module] vamsan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module ====== | ====== lamaPLC: ENS160 + AHT21 Air Quality Sensor - CO, ECO, TVOC, Temp & Humidity Module ====== | ||
| - | The ENS160 + AHT21 Air Quality Module is a combined environmental sensor board that measures indoor air pollutants (VOCs, eCO2, AQI) and climate conditions (Temperature, | ||
| - | | + | {{ : |
| + | The ENS160 + AHT21 Air Quality Module is a combined environmental sensor board that measures indoor air pollutants (VOCs, eCO< | ||
| + | |||
| + | | ||
| * MOX supports up to 4 gas sensors | * MOX supports up to 4 gas sensors | ||
| * Integrated sensor measurement and heater drive control | * Integrated sensor measurement and heater drive control | ||
| * Integrated pre-calibrated sensor fusion and automatic correction algorithm | * Integrated pre-calibrated sensor fusion and automatic correction algorithm | ||
| - | Key Capabilities | + | **Key Capabilities** |
| - | ENS160 (Air Quality): Uses Metal-Oxide (MOX) technology to detect reducing and oxidizing gases. | + | |
| - | Outputs: Total Volatile Organic Compounds (TVOC), equivalent | + | * **ENS160 (Air Quality):** Uses Metal-Oxide (MOX) technology to detect reducing and oxidizing gases. |
| - | ), and Air Quality Index (AQI). | + | * **Outputs:** Total Volatile Organic Compounds (TVOC), equivalent |
| - | Target Gases: Ethanol, toluene, hydrogen, | + | * **Target Gases:** Ethanol, toluene, hydrogen, |
| - | , and ozone. | + | * **AHT21 (Climate):** A high-precision digital temperature and humidity sensor. |
| - | AHT21 (Climate): A high-precision digital temperature and humidity sensor. | + | * **Temperature: |
| - | Temperature: | + | * **Humidity: |
| - | | + | |
| - | to | + | **Technical Specifications** |
| - | . | + | |< 100%>| |
| - | Humidity: | + | ^Feature^Specification| |
| + | ^Supply Voltage (VIN)|2.0V | ||
| + | ^Interface|[[com: | ||
| + | ^I2C Addresses|ENS160: | ||
| + | ^Warm-up Time| < 1 minute for immediate use; up to 1 An hour for full accuracy| | ||
| + | ^Power Use|1.2 to 46 mW depending on operating mode| | ||
| + | |||
| + | ==== Pinout ==== | ||
| + | ^Pin Name^Type^Description| | ||
| + | ^VIN / VCC|Power|Power supply input. Usually supports 3.3V to 5V due to onboard regulators.| | ||
| + | ^GND|Power|Ground connection.| | ||
| + | ^SCL|I²C|Serial Clock line for both ENS160 and AHT21.| | ||
| + | ^SDA|I²C|Serial Data line for both ENS160 and AHT21.| | ||
| + | ^ADDR / ADO|Control|(Optional) I²C address selection for ENS160. Connect to GND for 0x52 or VCC for 0x53.| | ||
| + | ^INT|Output|(Optional) Interrupt pin; can signal when new data is ready.| | ||
| + | |||
| + | ==== Example Arduino code ==== | ||
| + | To use the ENS160 + AHT21 module with Arduino, you'll typically need two libraries from the Arduino Library Manager: Adafruit ENS160 and Adafruit AHTX0. | ||
| + | |||
| + | **Install Required Libraries** | ||
| + | |||
| + | Open the Arduino IDE and install the following: | ||
| + | |||
| + | * Adafruit ENS160 Library | ||
| + | * Adafruit AHTX0 Library (works for both AHT20 and AHT21) | ||
| + | * Adafruit Unified Sensor (dependency for many Adafruit libraries) | ||
| + | |||
| + | This code initializes both sensors via I²C and prints climate and air quality data to the Serial Monitor every two seconds. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | Adafruit_ENS160 ens160; | ||
| + | Adafruit_AHTX0 aht; | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | while (!Serial) delay(10); // Wait for Serial Monitor | ||
| + | |||
| + | Serial.println(" | ||
| + | |||
| + | // Initialize AHT21 (Address 0x38) | ||
| + | if (!aht.begin()) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | Serial.println(" | ||
| + | |||
| + | // Initialize ENS160 (Address 0x53 or 0x52) | ||
| + | // Most combo boards default to 0x53 | ||
| + | if (!ens160.begin(0x53)) { | ||
| + | Serial.println(" | ||
| + | while (1) delay(10); | ||
| + | } | ||
| + | |||
| + | // Set operating mode: Standard (detecting) | ||
| + | ens160.setMode(ENS160_OPMODE_STD); | ||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // 1. Read Climate Data from AHT21 | ||
| + | sensors_event_t humidity, temp; | ||
| + | aht.getEvent(& | ||
| + | |||
| + | // 2. Feed Temperature/ | ||
| + | ens160.setTempRH(temp.temperature, | ||
| + | |||
| + | // 3. Read Air Quality Data from ENS160 | ||
| + | if (ens160.available()) { | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | delay(2000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Usage Tips** | ||
| + | |||
| + | * Baud Rate: Set your Serial Monitor to 115200 to match the code above. | ||
| + | * Warm-up: The ENS160 requires about 1 hour to achieve full accuracy, though it will start providing initial readings within 1 minute. | ||
| + | * Address Conflict: If the ENS160 is not found, try changing // | ||
| + | * Library Alternatives: | ||
| + | |||
| + | ===== I2C topics on lamaPLC ===== | ||
| + | {{topic> | ||
| - | RH accuracy; range of | + | {{tag> |
| - | | + | |
| - | | + | This page has been accessed for: Today: {{counter|today}}, |