The SGP40 is Sensirion’s new digital gas sensor for integration into air treatment devices and air quality monitors. The sensor provides a digital raw signal that is sensitive to most volatile organic compound (VOC) gases typically present in indoor environments. The signal is proportional to the logarithm of the resistance of the sensing material.
The raw signal from the SGP40 is processed by Sensirion’s Gas Index Algorithm, which provides a VOC Index as a robust measure of indoor air quality. For improved accuracy, the Gas Index Algorithm reads the temperature and relative humidity measurements from the second sensor on this board, the SHT40 from Sensirion. This way, the Gas Index Algorithm adapts to the environmental conditions the sensor is exposed to.
The VOC Index is a value ranging from 1 to 500. The value 100 refers to the average indoor gas composition over the past 24 hours. While values between 100 and 500 indicate a deterioration, values between 1 and 100 indicate an improvement in the air quality.
The temperature and humidity sensor SHT40 also contains a temperature-controlled micro hotplate, which can be used for self-decontamination. This is particularly useful for creep compensation caused by extended exposure to high humidity or environments with solvents present.
Now let’s get started with the BlueDot SGP40+SHT40 and take our first steps with this environmental sensor board.
Description
Here are the board’s main features:
- High Repeatability. Typical repeatability of ±5 VOC Index points at 25°C and 50% relative humidity.
- Temperature and Humidity Compensation. The measurements from the SHT40 are used by the Gas Index Algorithm to improve the accuracy of the VOC Index.
- Wide Range Supply Voltage. The sensor operates from 1.8 V and 5.5 V at VCC, dispensing the need for voltage regulation.
- I²C Communication. Using the I²C communication protocol you need no more than two wires to transfer data from and to your board.
This quick start guide on the BlueDot SGP40+SHT40 will show you how to take the first steps with this environmental sensor board.
Connecting via I²C
It is very easy to connect the SGP40 and the SHT40 sensors to the I²C bus. The first step is to connect the board to the power supply.
- VCC Pin. Connect the VCC pin from the board to either 5V or 3.3V output from your Arduino.
- GND Pin. Connect the GND pin from the board to the GND from the Arduino.
Great! Now we need to connect the sensor to the I²C bus. The I²C communication uses two wires. The clock signal is generated by the Arduino and transferred to the sensor through the SCL line. The Arduino can send commands to the sensor using the SDA line. Just as well, all data from the sensor goes back to the Arduino through the SDA line. Because of that, the SDA line is bidirectional.
- SDA Pin. Connect the SDA pin from the board to the SDA line on the Arduino. This corresponds to the pin A4 on the Arduino Uno.
- SCL Pin. Connect the SCL pin from the board to the SCL line on your Arduino. This corresponds to the pin A5 on the Arduino Uno.
Installing Arduino Library
The BlueDot Library for the Arduino contains an example sketch to run the SGP40 and SHT40 sensors and is based on the Adafruit libraries for both sensors. You can download and install the library directly from the Arduino IDE. Just open the Arduino IDE and go to Sketch > Include Library > Manage Libraries… and search for the BlueDot on the Library Manager. You can find this library under the name “BlueDot SGP40 SHT40“.
Alternatively, you can download the latest version of the library from the GitHub repository or just click on this link to get it directly from our Website (Download BlueDot Library for SGP40+SHT40).
Upload Example-Sketch
After installing the library we can open an example sketch. Just go to File > Examples > BlueDot SGP40 SHT40 and open the sketch SGP40_SHT40_Test.
At the start of the sketch, you can make a few changes to your SHT40 setup, but you can upload and run your sketch without changes as well.
The default setup for the SHT40 is to run all measurements with high precision. Changing the measurement precision affects the measurement duration, noise level, and energy consumption of your sensor. If power consumption is not an issue for your application, just run the sensor with high precision.
//Here we can configure the SHT40 Temperature and Humidity Sensor
//First we set the measurement precision
//There are three precision levels: High, Medium and Low
//The precision levels direclty affect the measurement duration, noise level and energy consumption
//On doubt, just leave it on default (High precision)
sht4.setPrecision(SHT4X_HIGH_PRECISION);
switch (sht4.getPrecision()) {
case SHT4X_HIGH_PRECISION:
Serial.println(F("SHT40 set to High precision"));
break;
case SHT4X_MED_PRECISION:
Serial.println(F("SHT40 set to Medium precision"));
break;
case SHT4X_LOW_PRECISION:
Serial.println(F("SHT40 set to Low precision"));
break;
The second setup allows you to activate the internal hotplate from the SHT40 sensor, as well as to adjust the temperature level and heating duration.
But why would you need to activate the hotplate in the first place? The SHT40 is a polymer-based capacitive sensor, which operates best between 5°C to 60°C and 20% and 80% relative humidity. When the sensor is permanently operating in an environment with very high relative humidity, for example close to 90%, the measured value may slowly increase due to an offset.
You can correct this offset by activating the hotplate and shortly increasing the temperature from the SHT40. By periodically activating the hotplate you can eliminate any long-term offsets caused by high humidity. For more information, please consult the Sensirions application note on the subject.
// The SHT40 has a built-in heater, which can be used for self-decontamination. // The heater can be used for periodic creep compensation in prolongued high humidity exposure. // For normal operation, leave the heater turned off. sht4.setHeater(SHT4X_NO_HEATER); switch (sht4.getHeater()) { case SHT4X_NO_HEATER: Serial.println(F("SHT40 Heater turned OFF")); break; case SHT4X_HIGH_HEATER_1S: Serial.println(F("SHT40 Heater: High heat for 1 second")); break; case SHT4X_HIGH_HEATER_100MS: Serial.println(F("SHT40 Heater: High heat for 0.1 second")); break; case SHT4X_MED_HEATER_1S: Serial.println(F("SHT40 Heater: Medium heat for 1 second")); break; case SHT4X_MED_HEATER_100MS: Serial.println(F("SHT40 Heater: Medium heat for 0.1 second")); break; case SHT4X_LOW_HEATER_1S: Serial.println(F("SHT40 Heater: Low heat for 1 second")); break; case SHT4X_LOW_HEATER_100MS: Serial.println(F("SHT40 Heater: Low heat for 0.1 second")); break; }
After starting the sketch, you will notice that the VOC Index will still be at zero. This is normal and only lasts for a few moments.
The VOC Index will slowly increase and after a few minutes will stabilize around 100. As mentioned earlier, values between 100 and 500 indicate a deterioration of the indoor quality, and values below 100 indicate an improvement.
3D Model
A 3D model of the BlueDot SGP40+SHT40 board is available as a STEP file (click here to download). A STEP file is a CAD file format widely used for exchanging CAD files between companies and can be easily read by most (if not all) CAD software applications.
You can also view 3D models online without installing any software on your computer. The images below were taken using Autodesk Viewer, an online, free-to-use tool from Autodesk. It does require registration at Autodesk, but it is worth it!