Thursday, April 25, 2024
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:
Serial.begin(115200);
}

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. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! 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! Linkedin

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

Leave a Reply

Your email address will not be published. Required fields are marked *