The Adafruit SGP40 is an advanced sensor module designed to detect volatile organic compounds (VOCs) in the air. Utilizing Sensirion's SGP40 sensor, it offers a reliable and accurate way to measure the air quality index (AQI), making it an essential component for environmental monitoring, air purifiers, smart home devices, and HVAC systems.
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | SDA | I2C data line |
4 | SCL | I2C clock line |
#include <Wire.h>
#include "Adafruit_SGP40.h"
Adafruit_SGP40 sgp;
void setup() {
Serial.begin(9600);
// Initialize I2C communication
Wire.begin();
// Initialize the SGP40 sensor
if (!sgp.begin()) {
Serial.println("Sensor not found, check wiring!");
while (1);
}
Serial.println("SGP40 sensor initialized.");
}
void loop() {
// Read the VOC index from the sensor
int vocIndex = sgp.measureVocIndex();
if (vocIndex == -1) {
Serial.println("Sensor reading failed!");
} else {
Serial.print("VOC Index: ");
Serial.println(vocIndex);
}
// Wait for 1 second before the next reading
delay(1000);
}
Q: How long does the sensor need to warm up? A: The SGP40 typically requires a warm-up time of less than 15 seconds after power-up.
Q: Can the sensor detect specific VOCs? A: The SGP40 provides a total VOC reading and is not designed to detect specific compounds.
Q: Is the sensor waterproof? A: No, the SGP40 is not waterproof and should be protected from moisture and water exposure.
Q: How do I calibrate the sensor? A: Calibration procedures can vary; refer to the manufacturer's documentation for specific calibration instructions.