This folder contains two Arduino (.ino) files used to work with an MQ-4 methane gas sensor and an Arduino Uno.
The sensor readings collected using these programs are part of this dataset:
https://doi.org/10.6084/m9.figshare.30783827
- Warms up the MQ-4 sensor
- Finds the clean-air baseline value (
R0)
- Run once when setting up the sensor
- Run again only if the sensor or wiring changes
- Raw sensor values
- Sensor resistance
- Final stable
R0value (shown in Serial Monitor)
Note down the R0 value — required for further measurements.
- Uses the saved
R0value - Converts sensor readings into methane concentration (ppm)
- During actual measurements
- Raw ADC value
- Sensor resistance
- Methane concentration in ppm
(All shown in the Serial Monitor)
- Data appears in the Serial Monitor
- You can:
- Copy it manually, or
- Use a serial logging tool
- Save it as
.txtfiles outside Arduino
gas_sensor_warming.ino→ prepares the sensorgas_sensor_ppm.ino→ measures methane- Output = Serial monitor only
- File saving = manual