Reference

Last revision 2025/12/18

Library

Communication Protocol Description

The sensor uses I2C communication with a default I2C address of 0x59.

API Description

 /**
   * @brief  Initialization function
   * @param duration Warm-up time
   * @return return true succeed ;return false failed.
   */
  bool begin(uint32_t duration = 10000);
  
  /**
   * @brief  Set the temperature and humidity
   * @param  relativeHumidityRH  Current environmental relative humidity value, range 0-90, unit: %RH
   * @param  temperatureC  Current ambient temperature, range -10~50, unit: °C
   */
  void setRhT(float relativeHumidity = 50,float temperatureC=25);
  
  /**
   * @brief  Measure VOC index after humidity compensation
   * @note   VOC index can indicate the quality of the air directly. The larger the value, the worse the air quality.
   * @note       0-100,no need to ventilate, purify
   * @note       100-200,no need to ventilate, purify
   * @note       200-400,ventilate, purify
   * @note       400-500,ventilate, purify intensely
   * @return The VOC index measured, ranged from 0 to 500
   */
  uint16_t getVoclndex(void);

Principle

1

VOC Index Air Quality Suggested Action
0-100 Excellent No measures needed
100-200 Good No measures needed
200-300 Lightly Polluted Ventilation suggested
300-400 Moderately Polluted Increase ventilation with clean air
400-500 Heavily Polluted Optimize ventilation

2

  • The sensor provides the change of air quality trend, and the algorithm will continuously adjust the baseline of typical air according to historical data. The longer the sensor is used, the better the sensitivity and accuracy of trend and change.
  • In the normal air environment, the sensor can obtain the accurate VOC index immediately after use; in the heavily-polluted environment, the sensor can obtain the accurate VOC index after use for about 1 hour. It is recommended to integrate it into the long-term indoor projects.
  • For more information about VOC index, please refer to: SGP40 VOC Index for Experts.pdf

Other Supplementary Information

Was this article helpful?

TOP