

The Gravity: H2S Sensor (Calibrated) - I2C & UART (Manufacturer Part ID: SEN0467) is a high-precision sensor designed by DFRobot to detect hydrogen sulfide (H2S) gas concentrations in the environment. This sensor is pre-calibrated, ensuring accurate and reliable measurements right out of the box. It supports both I2C and UART communication protocols, making it versatile and easy to integrate into a wide range of applications.








Below are the key technical details of the Gravity: H2S Sensor:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V - 5.5V |
| Power Consumption | < 0.5W |
| Measurement Range | 0 - 100 ppm (parts per million) |
| Resolution | 0.1 ppm |
| Accuracy | ±3% of reading |
| Communication Protocols | I2C, UART |
| I2C Address (Default) | 0x74 |
| Operating Temperature Range | -20°C to 50°C |
| Operating Humidity Range | 15% - 90% RH (non-condensing) |
| Dimensions | 37mm x 32mm |
The sensor has a 4-pin Gravity interface for easy connection. The pinout is as follows:
| Pin | Label | Description |
|---|---|---|
| 1 | VCC | Power supply (3.3V - 5.5V) |
| 2 | GND | Ground |
| 3 | RX | UART Receive (connect to MCU TX) |
| 4 | TX | UART Transmit (connect to MCU RX) |
| 5 | SDA | I2C Data Line |
| 6 | SCL | I2C Clock Line |
#include <Wire.h>
#include "DFRobot_H2S.h"
// Create an H2S sensor object using the default I2C address (0x74)
DFRobot_H2S h2sSensor;
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
Wire.begin(); // Initialize I2C communication
// Initialize the H2S sensor
if (!h2sSensor.begin()) {
Serial.println("H2S Sensor initialization failed!");
while (1); // Halt execution if initialization fails
}
Serial.println("H2S Sensor initialized successfully.");
}
void loop() {
// Read H2S concentration in ppm
float h2sConcentration = h2sSensor.readH2SConcentration();
// Check if the reading is valid
if (h2sConcentration >= 0) {
Serial.print("H2S Concentration: ");
Serial.print(h2sConcentration);
Serial.println(" ppm");
} else {
Serial.println("Error reading H2S concentration.");
}
delay(1000); // Wait 1 second before the next reading
}
Sensor Not Responding:
Inaccurate Readings:
I2C Address Conflict:
Library Not Found:
Q1: Can the sensor detect gases other than H2S?
A1: No, the sensor is specifically calibrated for hydrogen sulfide (H2S) detection and may not provide accurate readings for other gases.
Q2: How often should I recalibrate the sensor?
A2: The sensor is factory-calibrated and does not require frequent recalibration. However, if you notice significant drift in readings, contact DFRobot for support.
Q3: Can I use this sensor with a Raspberry Pi?
A3: Yes, the sensor supports I2C and UART, which are compatible with Raspberry Pi. Use appropriate libraries for integration.
Q4: What is the maximum cable length for I2C communication?
A4: For reliable communication, keep the I2C cable length under 1 meter. For longer distances, consider using UART.