Introduction
Gravity SFA40 HCHO Sensor — based the latest SFA40 released by Sensirion— features a wide measurement range (0–1000 ppb), high accuracy (±20 ppb).
Unlike most commercially available formaldehyde sensors, it offers extremely low cross-sensitivity. Traditional formaldehyde sensors based on electrochemical principles often respond to various volatile substances. For instance, using perfume near the sensor or placing an orange close to it can cause abnormally high readings.
In contrast, the SFA40 shows almost no response to other non-formaldehyde volatile compounds — it reacts specifically and accurately to formaldehyde.
Note: The yellow vent membrane on the SFA40 sensor must not come into contact with organic solvents or be scratched by sharp objects.
Feature
- Wide measurement range (0–1000 ppb), High accuracy (±20 ppb)
- Low cross-sensitivity, significantly reducing false alarms (cross-sensitivity to ethanol <0.3%).
- Gravity standard interface allows rapid deployment in just 2 minutes — no more complex circuit debugging.
Specification
- Supply Voltage: 3.3V-5.5V
- Working temperature: -40~125℃
- Operating humidity: 0–100% R.H. (non-condensing)
- Operating current: 80μA(Average@2Hz), 2mA(peak),
- PCB Size: 32 * 22mm
- Mounting hole size: φ3.0mm
- Start up time: 5min
Pinout
| Pin | Description |
|---|---|
| VCC | DC 3.3V-5.5V Input |
| GND | Ground |
| SCL | I2C Clock |
| SDA | I2C Data |
Tutorial
Prepare
Hardware Prepare
- DFRduino UNO+IO Expansion Board (SKU:DFR0216-2) ×1
- Gravity: SFA40 HCHO Sensor(SKU:SEN0661)×1
- [Gravity Sensor Cable](Comes with Gravity: SFA40 HCHO Sensor)
Software Prepare
- Download Arduino IDE: Click to download Arduino IDE
- Download DFRobot_SFA40 library:DFRobot SFA40
- Arduino IDE V1.8.19 (or below) can extract the .zip library downloaded from GitHub into the “libraries” folder located in the Arduino IDE installation directory.
- Arduino IDE V2.0.0 (or above) can directly search for the "DFRobot_SFA40" library in the Library Manager and install it.
Wire Diagram

Example Code
- Upload the following code and open Serial monitor to check the output
/*!
* @file getSensorData.ino
* @brief This example shows how to obtain data collected by SFA40, including HCHO and temperature and humidity data
* @copyright Copyright (c) 2025 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [fary]([email protected])
* @version V1.0
* @date 2025-04-08
* @url https://github.com/DFRobot/DFRobot_SFA40
*/
#include "DFRobot_SFA40.h"
DFRobot_SFA40 SFA40;
void setup() {
Serial.begin(115200);
while(!Serial);
Serial.print("SFA40 init...");
while(SFA40.begin()!=0){
Serial.print("failed,Not found SFA40!");
}
Serial.println("successed");
SFA40.startMeasurement();
}
void loop() {
uint8_t status = SFA40.readMeasurementData();
if(status==0){
Serial.println("The sensor is ready and the data is reliable! ");
static int number=0;
Serial.print("TemperatureC: ");
Serial.print(SFA40.temperatureC);
Serial.println(" C");
Serial.print("TemperatureF:");
Serial.print(SFA40.temperatureF);
Serial.println(" F");
Serial.print("humidity:");
Serial.print(SFA40.humidity);
Serial.println(" %RH");
Serial.print("HOCO:");
Serial.print(SFA40.HOCO);
Serial.println(" ppb");
}else if(status&0x01){
Serial.println("The sensor is not ready!");
}else if(status&0x02){
Serial.println("Sensor is not up to specification!");
}
delay(1000);
}

Tutorial
Prepare
Hardware Prepare
- UNIHIKER K10 (SKU:DFR0992-EN) ×1
- Gravity: SFA40 HCHO Sensor(SKU:SEN0661)×1
- PH2.0-4Pin Sensor Cable (SKU:DFR0992-EN) ×1
Software Prepare
- Download Mind+: Click to download Mind+
- Gravity SFA40 HCHO Sensor User Extension: https://github.com/YeezB/ext-sfa40-hcho-sensor
- Copy, paste and search the above user extension URL in the User-Ext search box

Example code

FAQ
Q1: Why does the SFA40 measure only 2 ppb of formaldehyde concentration after powering on?
A1:The SFA40 requires 5 minutes to start up after each power-on cycle. Accurate formaldehyde readings can be obtained after 5 minutes.
More
[Get one in DFRobot store]( "Get one in DFRobot store")
