SparkFun GM-X02B Arduino Library  v1.0.1
An Arduino library for the SparkFun Qwiic MEMS gas sensor breakouts built on the Winsen GM-x02B sensor family
Loading...
Searching...
No Matches
SparkFun_GMX02B.h File Reference

Arduino-specific implementation for the SparkFun Qwiic MEMS gas sensor breakouts. More...

#include <SparkFun_Toolkit.h>
#include "sfTk/sfDevGMX02B.h"
#include <Arduino.h>

Go to the source code of this file.

Classes

class  SfeGMX02BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-x02B gas sensor breakouts. More...
 
class  SfeGM102BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-102B gas sensor breakout (nitrogen dioxide (NO2)). More...
 
class  SfeGM202BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-202B gas sensor breakout (ethanol and smoke). More...
 
class  SfeGM302BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-302B gas sensor breakout (alcohol and ethanol vapor). More...
 
class  SfeGM402BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-402B gas sensor breakout (methane and propane). More...
 
class  SfeGM502BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-502B gas sensor breakout (VOCs). More...
 
class  SfeGM512BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-512B gas sensor breakout (breath odor (H2S, ethanol, acetone)). More...
 
class  SfeGM602BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-602B gas sensor breakout (hydrogen sulfide (H2S)). More...
 
class  SfeGM702BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-702B gas sensor breakout (carbon monoxide (CO)). More...
 
class  SfeGM802BArd
 Arduino I2C implementation for the SparkFun Qwiic GM-802B gas sensor breakout (ammonia (NH3)). More...
 

Detailed Description

Arduino-specific implementation for the SparkFun Qwiic MEMS gas sensor breakouts.

This file provides the Arduino-specific wrapper for the SparkFun Qwiic gas sensor boards built around the Winsen GM-x02B MEMS sensing elements. SfeGMX02BArd inherits from the platform-independent sfDevGMX02B driver and implements I2C communication using Arduino's Wire library via the SparkFun Toolkit.

The sensor type and the I2C address are set separately. The installed sensing element cannot be read back from the hardware (the onboard ADC101C021 has no ID register), so it is declared in the constructor. The I2C address is set by jumpers and can be overridden in begin():

SfeGMX02BArd mySensor(GM_602B);
mySensor.begin();          // this part's factory address, 0x58
mySensor.begin(0x51);      // jumpers moved: same sensor, new address, correct math

This matters because the declared part selects the sensitivity curve direction (see sfDevGMX02B). If the part were inferred from the address, moving an ADR jumper could cause a GM-102B to be treated as a GM-602B, inverting its readings.

Author
SparkFun Electronics
Date
September 2026

SPDX-License-Identifier: MIT

See also
https://github.com/sparkfun/SparkFun_GM-X02B_Arduino_Library