MQ135 gas sensor

Github Repo C Header C source JS source
mongoose-os-libs/mq135     api_mq135.js

Mongoose OS api for MQ135 Air Quality sensor (CO2 meter) Based on ViliusKraujutis MQ135 library for Arduino.

mq135

mq135pins

Getting Started

  1. Download and install Mongoose OS.
  2. You have a complete documentation and video tutorials about Mongoose OS.

Usage of MQ135 Library

Any GPIO pin with ADC capability can be used

MQ.MQ135.attach(pin);

You can use ambient temperature/humidity correction factor:

MQ.MQ135.getCorrectedPPM(temperature, humidity);

Note:

  • This type of sensor needs 24h after powered to "warning-up" (calibration).

Example of MQ135 Library

See example.


JS API


MQ135.attach

MQ135.attach(pin)

Attach to a given pin.

MQ135.getResistance

MQ135.getResistance()

Get the resistance of the sensor, ie. the measurement value. Return sensor resistance in kOhm

MQ135.getPPM

MQ135.getPPM(pin)

Get the ppm of CO2 sensed (assuming only CO2 in the air). Return the ppm of CO2 in the air

MQ135.getRZero

MQ135.getRZero()

Get the resistance RZero of the sensor for calibration purposes. Set this value to your "MQ.RZERO" variable if you need.

MQ135.getCorrectionFactor

MQ135.getCorrectionFactor(temperature, humidity)

Get the correction factor to correct for temperature and humidity. temperature is the ambient air temperature, humidity is the relative humidity. Return the calculated correction factor.

MQ135.getCorrectedResistance

MQ135.getCorrectedResistance(temperature, humidity)

Get the resistance of the sensor, ie. the measurement value corrected for temperature/humidity @param[in] temperature The ambient air temperature @param[in] humidity The relative humidity @return The corrected sensor resistance kOhm

MQ135.getCorrectedPPM

MQ135.getCorrectedPPM(temperature, humidity)

Get the ppm of CO2 sensed (assuming only CO2 in the air), corrected for temperature/humidity @param[in] temperature The ambient air temperature @param[in] humidity The relative humidity @return The ppm of CO2 in the air

MQ135.getCorrectedRZero

MQ135.getCorrectedRZero(temperature, humidity)

Get the resistance RZero of the sensor for calibration purposes @param[in] temperature The ambient air temperature @param[in] humidity The relative humidity @return The sensor resistance RZero in kOhm

edit this doc