Датчик качества воздуха GY-SGP40 предназначен для измерения летучих органических соединений (VOC), предоставляет данные о концентрации через I2C-интерфейс, что позволяет легко интегрировать его в проекты на Arduino, ESP8266/ESP32, Raspberry Pi и др.

VOC Index

VOC Index | Качество воздуха | Меры |
---|---|---|
0 – 100 | Отличное | не требуются |
100 – 200 | Хорошее | не требуются |
200 – 300 | Слабое загрязнение | рекомендуется вентиляция |
300 – 400 | Умеренное загрязнение | увеличение вентиляции чистым воздухом |
400 – 500 | Сильное загрязнение | оптимизация вентиляции воздуха |
Применение
- Мониторинг качества воздуха в помещениях.
- Умные системы вентиляции и очистки воздуха.
- IoT-устройства для экологического мониторинга.
- Детекторы загрязнения воздуха в умных домах
Пример подключения

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#include <DFRobot_SGP40.h> /* * Method 1: pass in the specified I2C object address * #include <Wire.h> * DFRobot_SGP40 mySgp40(&Wire); * Method 2: use the default I2C object&Wire * I2C Default Address:0x59 */ //#include <Wire.h> //DFRobot_SGP40 mySgp40(&Wire); DFRobot_SGP40 mySgp40; void setup() { Serial.begin(115200); Serial.println("sgp40 is starting, the reading can be taken after 10 seconds..."); /* * Sensor preheat time: 10s * duration: init wait time. Unit: ms. It is suggested: duration>=10000ms */ while(mySgp40.begin(/*duration = */10000) !=true){ Serial.println("failed to init chip, please check if the chip connection is fine"); delay(1000); } Serial.println("----------------------------------------------"); Serial.println("sgp40 initialized successfully!"); Serial.println("----------------------------------------------"); /* * Set the relative humidity and temperature of current environment * The sensor has internal temerpature & humidity calibration. For more accurate VOC index, please open the function setRhT(). * relativeHumidity:ambient relative humidity, refer to the moisture content in air. Range:0-90, unit: %RH,e.g. 50% * temperatureC:ambient temperature. Range: -10~50, unit: °C, e.g. 20°C */ //mySgp40.setRhT(/*relativeHumidity = */ 50, /*temperatureC = */ 20); } void loop() { /* * Get VOC index * VOC index can directly indicate the condition of air quality. The larger the value, the worse the air quality * 0-100,no need to ventilate,purify * 100-200,no need to ventilate,purify * 200-400,ventilate,purify * 400-500,ventilate,purify intensely * Return VOC index, range: 0-500 */ uint16_t index = mySgp40.getVoclndex(); Serial.print("vocIndex = "); Serial.println(index); delay(1000); } |
Скачать библиотеку DFRobot_SGP40 (ZIP)
Скачать библиотеку Adafruit_SGP40 (ZIP)
Скачать даташит SGP40 (PDF)