Methane Sensor¶

Written by Grace Lo & Alina Wang

The methane recording procedure was developed and tested on the Figaro NGM2611-E13 Methane Sensor Module. It is pre-calibrated at controlled humidity and temperature and outputs continuous analog results, ideal for detecting changes. The NGM2611-E13 has been used in previous research, including the original flux chamber prototype. As such, it has a known calibration method and are readily deployable. The data is provided in raw values to reduce compuation on the device and give scientists the autonomy to post-process as they see fit. It is important to note that when energizing the sensor after a period of inactivation, the resistance drops significantly causing high voltage readings. However after a moment of recovery, it will stabilize and be ready for data collection. Current lab testing (in absense of varying methane concentrations) has shown values of 25 to 310, with the output generally hovering at approximately 20 to 40.

At the current moment, the SD card and methane sensor functionality are combined in the SD_Card_Methane library. However, there are future plans to separate the two for a more modular design with the methane sensor interface in a standalone Methane library.

Pin Connections¶

Breadboarding best practices should be followed.

Pin Connections

Pin connections from the methane sensor → Pico are as follows:

  • VIN (5V) → VBUS (pin 40)
  • VOUT → ADC0 (pin 31)
  • VREF → ADC_VREF (pin 35)
  • GND → GND

Code¶

All SD_Card_Methane library code is in [this git repository]. The code for interfacing with the methane sensor is incorporated into sd_card_serial.c.

Includes¶

The first lines of code in the C source file include header files. Don't forget to link these in the CMakeLists.txt file!

In addition to the header files mentioned in the SD Card library, the following files enable the specified GPIO pin to read continuous analog values instead of binary digital values.

#include "hardware/gpio.h"
#include "hardware/adc.h"

main()¶

There is currently no additional functionality in main, but once the separate library is made to isolate the interaction with the methane sensor, its protothread will be added to the thread schedule.

File Protothread¶

Initializations¶

The protothread begins with initializing the analog-to-digital (ADC) converter, making sure to select 1 of 3 ADC inputs (GPIO 26, GPIO 27, or GPIO 28).

adc_init();
adc_gpio_init(26);
adc_select_input(0);

Serial Terminal Write Command¶

Within the write command, the methane sensor module is read using adc_read() and directly written to the file.

An example of setdate, setfreq, write, and print used on the serial terminal and the corresponding CSV file is provided below:

Serial Terminal CSV File

Note that CO2, TEMP, and HUM columns are empty and integration with the combined sensor still needs to be completed.