Saturday, September 23, 2023
How ToIoT HardwaresSensorsTutorials/DIY

Interface MQ135 (Gas Sensor) with NodeMCU

In this Tutorial we will learn how to Interface MQ135 (Gas Sensor) with NodeMCU. We need Arduino IDE and MQ Sensor only for this tutorial. This is simple tutorial. We print ppm and rzero value on serial console only.

MQ 135 Sensor used for monitor the air quality especially CO2 with NodeMCU as microcontroller. You need MQ135 library and little modification to connect internet.

You may like also: Using Mq135 Sensor with InfluxDB

Hardware Required:

  • NodeMCU
  • MQ135 Sensor
  • Breadboard
  • Micro USB cable
  • Connecting Wires

Software Required:

Connection beetwen NodeMCU to MQ135

Connect NodeMCU A0 to MQ135 AO
Connect NodeMCU GND to MQ135 GND
Connect NodeMCU VIN (5V) to MQ135 VCC

Arduino Sketch for Interface MQ135 (Gas Sensor) with NodeMCU

#include "MQ135.h"
#define ANALOGPIN A0

MQ135 gasSensor = MQ135(ANALOGPIN);

void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:
float rzero = gasSensor.getRZero(); //this to get the rzero value, uncomment this to get ppm value
float ppm = gasSensor.getPPM(); // this to get ppm value, uncomment this to get rzero value
Serial.println(rzero); // this to display the rzero value continuously, uncomment this to get ppm value
Serial.println(ppm); // this to display the ppm value continuously, uncomment this to get rzero value

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. I am a tech blogger and an IoT Enthusiast. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!

One thought on “Interface MQ135 (Gas Sensor) with NodeMCU

Leave a Reply