The PCB Artists methane sensor is a tiny, low power and compact methane gas sensor with a built-in ARM Cortex-M0+ MCU for signal processing and determining methane concentration in the air.
This sensor is yet another addition to our environmental sensor solutions such as the outdoor air quality sensor and sound level sensor series.
The host system can connect with the methane sensor using a standard I2C interface. The sensor module has open-drain SDA and SCL pins allowing the host to use any I2C bus voltage level. The sensor module is based on a Figaro TGS2611 but implements signal processing and compensation routines to produce accurate digital values. This also eliminates the need for the host system to have ADCs to interface to the TGS2611 sensor.
Now available on our Store
-
I2C Methane Sensor Module
$27.00Original price was: $27.00.$25.00Current price is: $25.00.
Initializing the I2C Methane Sensor Module
The PCB Artists methane sensor module can be initialized over I2C as follows:
- Power up the methane sensor module
- Allow at least 50 ms for the module to boot up and perform internal warm-up operations
- Optionally, write 0x55 to the SCRATCH register and read back to confirm that SCRATCH register has read/write access over I2C
- If needed, write a value to TS register to set sampling time. Recommended time duration is 3-5 minutes for power sensitive applications. Note that a longer sampling time provides higher accuracy.
- If available, write % RH value to the RH register.
- The host can read the CH4_H and CH4_L at any time. However, for accurate results when using one-shot mode, the host should poll STATUS register and read the CH4_H and CH4_L registers when the new measurement flag is set.
- During continuous measurement, the host may access the ppm values any time after initial heater warm-up duration of 3 minutes.
I2C Terms and Meanings
The following sections use these common abbreviations to describe I2C bus states and conditions.
- SLA + W is slave address (0x49 for this sensor) with a write flag
- SLA + R is slave address (0x49 for this sensor) with a read flag
- START, STOP and RESTART conditions are I2C bus start condition, stop condition and restart condition respectively
- REGADDR is the 8-bit sensor module register address that the host wants to read/write to
- REGDATA is the data byte that is to be written or read from REGADDR
Reading Methane Sensor Registers
The methane sensor registers can be read by using the following sequence:
- Generate a START condition
- Send SLA + W to module
- Send REGADDR to module
- Generate RESTART condition
- Send SLA + R to module
- Read REGDATA byte from module
- Generate a STOP condition
Writing to Methane Sensor Registers
The methane sensor registers can be written by using the following sequence:
- Generate a START condition
- Send SLA + W to module
- Send REGADDR to module
- Send REGDATA to module
- Generate a STOP condition
Sensor I2C Register Descriptions
The following sections list I2C registers implemented inside the methane sensor. Their address, description and default values are mentioned as well.
Note that reading from a write-only (W/O) register will read 0x00.
Writing to a read-only (R/O) register has no effect.
Addresses not mentioned below are reserved and host should not interact with them.
VERSION register (0x00)
ADDRESS | DEFAULT VALUE | TYPE |
0x00 | 0x12 | R/O |
DESCRIPTION
- VERSION [7:4]
Hardware version - VERSION [3:0]
Firmware version
ID3 register (0x01)
ADDRESS | DEFAULT VALUE | TYPE |
0x01 | unique ID | R/O |
DESCRIPTION
- ID [31:24]
Fourth and highest order byte of unique device ID
ID2 register (0x02)
ADDRESS | DEFAULT VALUE | TYPE |
0x02 | unique ID | R/O |
DESCRIPTION
- ID [23:16]
Third byte of unique device ID
ID1 register (0x03)
ADDRESS | DEFAULT VALUE | TYPE |
0x03 | unique ID | R/O |
DESCRIPTION
- ID [15:8]
Second byte of unique device ID
ID0 register (0x04)
ADDRESS | DEFAULT VALUE | TYPE |
0x04 | unique ID | R/O |
DESCRIPTION
- ID [7:0]
First and lowest order byte of unique device ID
SCRATCH register (0x05)
ADDRESS | DEFAULT VALUE | TYPE |
0x05 | 0xAA | R/W |
DESCRIPTION
- SCRATCH [7:0]
Scratchpad register, host may write and read any value from this register at any time.
Writing and reading back values from this register may be useful for I2C testing.
CONTROL register (0x06)
ADDRESS | DEFAULT VALUE | TYPE |
0x06 | 0x00 | R/W |
DESCRIPTION
- Low Power Sleep [3]
Set to put the module in sleep mode, where the MCU and sensor element both enter low-power mode.
Only this bit should be set for the module to enter sleep mode (register 0x06 = 0x08).
To wake up the module, set the Reset bit only (register 0x06 = 0x04). - Reset Module [2]
Set to soft-reset the module and restore all register settings to defaults. Also used to wake up the module from sleep.
This bit is self-clearing. - Constant Measurement [1]
Set to enable sensor heater and measurement stream (continuous measurement).
Resetting this bit disables measurement and causes the gas sensor heater to turn off. - Single Measurement [0]
Setting this bit powers up the sensor to make one measurement.
On completion, the methane sensor heater will turn off after calculating final ppm value. This bit is self-clearing.
STATUS register (0x07)
ADDRESS | DEFAULT VALUE | TYPE |
0x07 | 0x00 | R/O |
DESCRIPTION
- Heating Element Error [2]
If this bit is set, the heating element of the sensor may have been damaged. - Sensing Element Error [1]
If this bit is set, the sensing element of the sensor may have been damaged. - New Measurement Flag [0]
This bit is set when a new set of valid measurements is available in CH_H and CH_L.
If the host MCU reads CH4_H and then CH4_L, this bit is cleared automatically.
TS register (0x08)
ADDRESS | DEFAULT VALUE | TYPE |
0x08 | 3’d | R/W |
DESCRIPTION
- Sampling Time (in minutes) [7:0]
Time interval for activating the heating element and sensing methane concentration. The New Measurement Flag in STATUS register is set when this interval is over.
TEMP register (0x09)
ADDRESS | DEFAULT VALUE | TYPE |
0x09 | 85’d | R/O |
DESCRIPTION
- Sensor Temperature [7:0]
Subtract 60 from this value to get the sensing element temperature in Celsius.
To manually set a compensation temperature, write ambient temperature in Celsius + 60 to this register.
HUMIDITY register (0x0A)
ADDRESS | DEFAULT VALUE | TYPE |
0x0A | 75’d | R/W |
DESCRIPTION
- Relative Humidity Setting (% RH) [7:0]
The host should write humidity information (if available) to this register to increase the methane sensor’s accuracy.
CH4_H register (0x0B)
ADDRESS | DEFAULT VALUE | TYPE |
0x0B | 0x00 | R/O |
DESCRIPTION
- Methane Concentration in ppm, high byte [7:0]
High byte of CH4 concentration value in ppm. Always read this register first, followed by CH4_L.
CH4_L register (0x0C)
ADDRESS | DEFAULT VALUE | TYPE |
0x0C | 0x00 | R/O |
DESCRIPTION
- Methane Concentration in ppm, low byte [7:0]
Low byte of CH4 concentration value in ppm. Reading this after reading CH4_L resets the New Reading Available flag in STATUS register.
Measured methane concentration in ppm = CH4_H*256 + CH4_L
Feel free to ask away via the Quick Contact form in the sidebar, or leave a comment below.
Change Log
- 23 Nov 2023
– Updated specifications to firmware version (currently available on our store) - 13 July 2022
– Initial Release