Go Down

Topic: Help with methane gas sensor MQ-4 (Read 249 times) previous topic - next topic

ItaloXXXX

Aug 22, 2019, 11:43 pm Last Edit: Aug 22, 2019, 11:48 pm by ItaloXXXX
Hi, I need your help. How can I transform the value analog output voltage (0 to 1023) to PPM (parts per million)?

jremington

#1
Aug 22, 2019, 11:54 pm Last Edit: Aug 22, 2019, 11:58 pm by jremington
You have to first "burn in" the sensor for 72 hours or more, as described in the MQ-4 data sheet, then calibrate it by exposing it to known concentrations of methane in dry air.

The sensor responds to other gases, which if present will make the calibration useless.

ItaloXXXX

Thank you. But, how can I show, mathematically, the result (analog value) in PPM?

jremington

#3
Aug 23, 2019, 05:33 am Last Edit: Aug 23, 2019, 05:34 am by jremington
To convert analog readings to PPM, you use the scale factor and offset that you determine when you calibrate the sensor.

Code: [Select]
float ppm = scale*analogRead(pin)+offset;

Wawa

Seems the sensor is not that linear (never used one).
With the graph from the datasheet you can try to convert to PPM with multiMap, before final calibration.
Leo..

jremington

The nonlinearity in response is the least of the sensor's problems.

hammy

I'd agree - these are really combustible gas sensors , they suffer with drift and don't return to the same output after detecting gas ( esp high concentrations ) . I would only use to detect a rapid change where absolute values don't matter .


Go Up