MQ135 Gas Sensor with ESP8266 and LCD Display with I2C

MQ135 gas sensor works on analogue and digital pins with Arduino boards. It gives analogue value in PPM of Air Quality. When we use a digital pin, it gives on signal at a particular value of analogue. This can be adjusted via potentiometer. So, you can also detect a particular gas without using any micro controller. Just seeing a green LED, you can know it.

MQ135 Gas Sensor with ESP8266 and LCD Display with I2C

Nowadays, we see different gasses being emitted in atmospheres from home appliances like air conditioner and industrial chimneys. Monitoring of these gasses is very important as a safety point of view.

Here, for this project I will use Wemos D1 Board which is a ESP8266 based IoT board.

Components Used:(Click to Buy)

What is MQ135 Gas Sensor?

The MQ-135 gas sensor module consists of a steel exoskeleton under which a sensing element is housed. This sensing element is subjected to the current through connecting leads. So, this current is known as the heating current through it, the gases coming close to the sensing element get ionized and are absorbed by the sensing element. This changes the resistance of the sensing element which alters the value of the current going out of it. This resistance value shows in analogue reading.
It works on the 5V pin of Arduino or ESP8266 boards. It is suitable for detecting NH3, NOx, alcohol, Benzene, smoke, CO2, etc.

Connect ESP8266 with 1602 LCD via I2C

This display works with 5V power and via the I2C interface. To know in detail, how to connect LCD display via I2C, Follow this post.

Connect LCD Display with ESP8266 Using I2C Module

So, now connect display according to the diagram below.

MQ135 Gas Sensor with ESP8266 and LCD Display with I2C

So, here I have connected 5V of ESP8266 with VCC of MQ135. I will not use Digital Pin.

Code Explain

Firstly, in the void setup area, I have initialized the display with static texts like PPM, Air quality.
Next, in the void loop area, we are displaying sensor value every 2 seconds which is being read on line no 21.

Arduino Sketch for MQ135 Gas Sensor

Output

MQ135 Gas Sensor with ESP8266 and LCD Display with I2C

Finally, here you can see Air quality is showing in PPM on the LCD display.

If you do not have LCD display, you can also do this using ST7789 SPI TFT LCD Display. Follow this post.

MQ135 Gas Sensor with ESP8266 and ST7789 SPI Display

Share with Friends
0 0 votes
Rating
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments