How to measure CO2, Ammonia and Detect Smoke using MQ135

Setup Info:

MQ135 + Arduino+16x2LCD+ESP8266+ThinkSpeak.

Hi All, I have just bought a MQ135 . I started arduino basics with LED blinking , interfacing and then started with my real project.
e
I have seen in the data sheet of MQ135 that it can measure Ammonia, Sulfide,CO2 and Benze steam. It can also be used to detect smoke and alert.

But in the Arduino uno Serial monitor, I can see only one value 408.

Now, I dont know how to differentiate it in all different values of required gases and trigger smoke alarm

Also, my friend suggested to calibrate this sensor for which I found really good material and started with 24 Hours on test after dumping a code to read data from it.
Now I read 1836 which was 1795 , about half an hour back.

Kindly reply and let me know what info or input is required from My side.
This is my first of my many uno projects to come.

Regards,
Sillicon

But in the Arduino uno Serial monitor, I can see only one value 408.

Although I haven't seen your sketch (you're hiding it from us) I guess that is the reading from an analog input and that shows a digital measurement of the analog output of the sensor. Although the sensor is sensitive to a variety of gases it cannot distinguish between them so the only information you get from it is one single output voltage. The interpretation of that value is up to your sketch. You cannot use this sensor to get a gas concentration in ppm or the like but you might get a changed value if the air quality in a room descends.

Agreed. One sensor will tell you only that something changed.

But with several different types of those sensors you can do some very interesting things, like make an electronic nose.

Well, I have no issues in sharing the connections. its just analog out from MQ135 to uno and then 5V and GND connected. After that I have connected the ESP8266 with UNO 3.3V supply, TX RX from ESP to PWM Pins of UNO and ground.
There is nothing much.
After doing this connection, I have dumped the code only to read MQ135 sensor data.

I started this setup 14 hours from now.
Serial data in the beginning was ~400
Later, it went till 1400 then 1800 7 hours back.
Now, I connected again, 10 mins back it was 1725, now it is 1678.59.

I dont know how to configure ESP and UNO with thinkspeak yet. That's Another challenge for a noobie.

Sillicon:
I started this setup 14 hours from now.
Serial data in the beginning was ~400
Later, it went till 1400 then 1800 7 hours back.
Now, I connected again, 10 mins back it was 1725, now it is 1678.59.

I think you need to read the data sheet. there is a pre-heat time.


Before the sensor reaches it specific reading point, it has to have had a total of 24hrs pre-heat.
Tom... :slight_smile:

SNS-MQ135.pdf (146 KB)

I did the same. I have left the sensor running for 26 hours straight now......

Should I be concerned for following?:-

The sensor data is being read serially via Serial monitor. IT is now changing by keeping in same environment.

for last 8 mins, it changed from 1975 to 2079 value in monitor.

Any code sample to transfer these Serial values to CO2, Ammonia and NO2?

And thank you for the attachments

Sillicon:
Any code sample to transfer these Serial values to CO2, Ammonia and NO2?

I don't think you understand, the sensor will detect these gases, but you have to calibrate it of one gas only, you cannot get it to give you all the gas concentrations from the one output pin.
The sensor will only give proper results when it is in an atmosphere of gases that contains the gas you want to measure, but has NO concentration of the other gases it can detect.
So if you want to calibrate the sensor for CO2, then you can do it, but that atmosphere must not contain Ammonia or NO2.
It is not a multi-gas realtime detector.
Its use is as a level alarm, not a precise gas level meter.
You set it up to detect a threshold to set off an alarm, for example in a room with a gas heater, to detect the buildup of CO2.

For a laboratory level detector you will need to use more elaborate and hence expensive sensor, preferably one sensor for each gas
.
Tom... :slight_smile:

Sillicon:
Now, I dont know how to differentiate it in all different values of required gases and trigger smoke alarm

This sensor can't. It measures all and puts out a total value. That's it.

I agree. I had plans on using MQ4,6,7,9 and 135 together. If you apply a best-fit regression to each response curve, you get the idea how each gas sensor interelates. That's why there are several MQ gas sensors. They sense each gas at a different gradient to concentration. If you are handy with calculus, which I am not, you could figure out a way to get several sensors to induct which gas is high and perhaps by a how much without calibrating for every gas.

Alright. I get that all now.

I m worried regarding the sensor value now.
Its not stable. I have kept the sensor in my room and now I'm trying to measure the value after 24Hrs preheat.

Value just changed from 2078 to 1576 in 8 mins span

It measures CO2. Your presence (breath) will affect the sensor.

Hi,
How are you powering the sensor heater?

Tom.. :slight_smile:

From http://www.maskau.dk/projects/electronic-nose