Arduino DIY CO2 PPM Meter
HTML-код
- Опубликовано: 25 мар 2017
- In this video, we use the MQ135 gas sensor to measure the concentration of carbon dioxide in the air.
We know that the average CO2 level is 400ppm, so by doing a little math and a little stats we can form a curve to calculate the CO2 PPM for any given reading of the sensor. We output this data to an OLED display in both text and as a bar graph.
You can put this easy DIY project together in a few minutes and for about $15.00. That's alot better than paying over 400 for a commercial unit.
All of my sketches are available here: www.dropbox.com/sh/m6c40pu99f...
~-~~-~~~-~~-~
Please watch: "Diodes: The basic building block of all digital circuits"
• Diodes: The basic buil...
~-~~-~~~-~~-~ Развлечения
Because I here get no answer to fix my project, I stopped this project and start with an other similar project using a MH-Z19b sensor. This guy answered my questions very fast.
Great video-DIY! What more I love is you explaing the code that nobody does in detail as you did! You got a NEW subscriber man. Best regards from Buenos Aires, Argentina (Im really from the States but living here)
you are the boss!! thank you so much! I was investigating how to make this mq135 show me values of co2 ppm for my mushroom farm and you make it so easy. count me in for more videos
Paul thank you again, excellent stuff. Love to see you add a DTH11 or something similar, especially battery powered. I personally like to be mobile, however you have a great library of videos. I have liked, subscribed. Love to set this diagram
I finished your editing but I tried with an arduino minipro and I had to give up because not enough memory so I did it with a nano arduino. it works thanks for sharing.
I like the video. There are, however, assumptions implied which are not realistic to expect. For example, while going outside to the back yard, one can reasonably assume (if located far from mixed, citified air) that the MQ135 detection reading is indeed mostly C02. This sensor detects an assorted group of gases. In the back yard environment, one can reasonably assume that benzene or ammonia (NH3) for example, are NOT present - nor are others to which the '135' reacts..
Thus the reading reflects C02 concentrations vs., say, Ammonia NH3, for example. However, upon changing the environment (i.e., moving to an inside location where other 'detectables' might exist) ALL BETS ARE OFF. With this sensor, it is totally a guess to assume that any reading in an unknown environment would be only from C02 levels. As an example, (for adults only), is the exhalation of breath after having an alcoholic beverage (ethol group symbol OH) will drive the sensor's output nuts! Yes, CO2 is also in the mix but the sensor can't discern the relative contribution of each compound it detects. Or, spraying certain aerosols or using cleaning liquids in the home will also contribute significantly to the sensor's reading. How much CO2? It's impossible - yes, impossible to tell. The sensor simply tell you that "something detectable" is, in fact, being detected. That's it.
The important thing for people to realize is that with the MQ135 (and with all the MQ-series), the output of the sensor ONLY verifies that at least one OR MORE of the gases it detects is present at the moment. It does NOT reveal any useful quantative information when 2 or more gases are contributing to it's output. It simply displays one reading, combining all the totals. In fact, manufacturer's data states that the sensor output CANNOT be used to tell you WHICH ONE (or more) are actually present - and most certainly not a PPM breakdown of one gas - as implied in the video regarding C02. To say that the reading is higher at the workstation "due to exhalation of C02" is true but is not the whole truth. Other volatiles in the air sample play a role in the reading as well. This is a critical fact that should be emphasized when using this sensor.
That said, I still use the MQ135 along with a BME-680 sensor, and a Dallas OneWire group with an Arduino MEGA 2560 to drive the electronics in an environmental controller.
It's important for viewers to manage expectations of exactly what they can expect from these sensors.
Refer to the manufacturer's datasheet for the MQ135. It contains specifications for the device's sensitivities to a whole host of other gases (including C02) that contribute to the analog output that one might display.
Now, breathe.... :-)
PS: At 39,000 feet altitude and almost 100% UNcontaminated outside air, the sensor calibration is SWEET !! These may be a product manufactured in CHINA, but in this case, I find them impressive in terms of reliability - as long as expectations don't exceed the product specifications. Enjoy cleaner air. Take care.
Very good comment. In the following, in figure 3, will you find the different gases reaction dependent on the resistor value:
www.olimex.com/Products/Components/Sensors/Gas/SNS-MQ135/resources/SNS-MQ135.pdf
More or less the same, together with a list of other gas sensors, can be found here:
components101.com/sensors/mq135-gas-sensor-for-air-quality
B. GLENN Awesome comment, thanks for your valuable informations. :)
Which sensors would you recommend for CO, CO2, and O2? I'd like a ppm for all three.
@@charlidog2 Here are two
list: www.strawdogs.co/2018/06/MQ-Gas-Sensors-List/
tutorials-raspberrypi.com/configure-and-read-out-the-raspberry-pi-gas-sensor-mq-x/
Examples:
MQ-7 - Carbon Monoxide
MG811 - Carbon Dioxide (CO2)
Use a search engine for the O2 sensor. They have different prices according to quality; from $20 to $200+
All sensors will output a voltage that you have to convert to a value and ppm - if you want it cheap. If you pay a lot of money; then you can find something that spits out ppm on a screen.
@KwizzelKing HD This sensor is not plug n play device. You should add mathematical formula to your code and calibrate with known CO2 meter.
Hi
Thanks for the video, would it be possible to measure CO levels using this setup with a suitable carbon monoxide sensor instead and some editing? Thanks
Hi, what are the steps to i measure nh3 in ppm, using mq-135 ???
Hi. Good day. Thank you for your good work. I would like to know what I should adjust in the code if I want to use a 16X2 LCD?
Hi, I have a few questions.
First off, I installed this program on my arduino and then got the sensor reading without changing the CO2Zero I received 370-400 range in my house.
Later, when I blew air into the sensor, it decreased to 330-350 and then later after few seconds or 10 lines of printing it displayed 410-440-460
May I know is it right or how must I change the CO2Zero value. I didnt understand or am I getting this right or is the PPM reading correct. I am sure the CO2 level must increase after blowing air but is decreasing??Or is it lagging ?? Please help me ASAP!
How exactly are we supposed to calibrate the sensor? Could you please elaborate on that please?
Thanks
the one thing I don't understand is the mapping what is the full range of this sensor? will ir register form zero to 1 million ppm ? is that 0v to 5v ?
or does the sensor only measure form o to 5000ppm ?
Hi , Is it possible to have the sketches link reuploaded again ? can't seem to download it
What is that black wire connected to the screen
What is maximum ppm co2 that can measure with mq 135?
Very cool! Do you know if you could merge this with the FastLED library or Neopixel library? Would be interesting to measure C02 in real time with an effect of invoking addressable LED patterns
hi but is this correct? As the sensor check for conductivity, dont you have to use a library's that takes senor inbuilt activity to be correct?
Here's my comment. Build these made-to-order and sell them. I've just been looking for a cheap device that does this very simple task, but the pricing on CO2 measuring devices is totally arbitrary because of the low demand, relative to CO sensors.
Hellow .. good day.. I want you to know how to calibrate the sensor and is datalogging possible with your setup..
Is the 135 different in that it doesn't require 5v and 1.4v pulses between tests in order to function properly? Like the mq7 for instance requires 5v for a given period, then 1.4v, then test, then repeat. It also requires a 24-48h burn in period before calibration. I think this is incredibly over simplifying how these are supposed to be used, possibly to a fault
Hi there, Any reason why the code keeps bugging in lines 76-82 with the following error - exit status 1
invalid types 'int[int]' for array subscript
? Thanks for any help
Hi Learnelectronics,
Do you have any videos, or can you make a follow up video on how to make a system that has a data logger? So all the 200ms datapoints are being displayed AND logged into say a USB as a .txt file? That would be something really interesting I think.
Thanks!
Good video! Clear and concise!
Why do it registers 2000+ ppm of CO2 in my setup? Is it just because mq135 is not working properly or is it just because in my are there's a poor air quality?
hi, it´s amazing this video.
I have a question, what is the maximum sampling range of the sensor, greetings from Colombia
Have you done any checking of the accuracy? I'm looking to put together a safety device with this CO2 sensor and kick on a ventilation system if CO2 (and other gases) go above a threshold (probably 1,500 PPM). For my purposes, I would need to know for certain the reading I receive is calculating an accurate CO2 level. Doesn't sound like your calibration was all that accurate, I'm just curious how accurate your readings are when compared to known good readings from a commercially calibrated CO2 meter.
Can you use this Sensor to measure Breathing CO2
How about the SO2 in ppm? Thanks
Hi can you calibrate it for NOx???? Thanksss
Can it be done with a mq2 sensor?
Hi
Where can I downlod your code?
Thank you for this editing! One can even consider using the output 9 to drive a relay to control a solenoid valve to release CO2!?, By changing the value of: if (co2ppm>"/" 999"/") {// if co2 ppm> 1000
Thank you Very much it's a amazing concept to measure CO2 in Air. But I have one question in Initial stage how can I calibrate the sensor for first 5 sec. What is the highest and Lowest value of this sensor? and Please help me the code of this sensor calibration...
why does my sensor give out values in the 100's and you get over 400 ?
According to an Amazon question answer: This sensor will not detect carbon dioxide. Some manufacturers report VOC output as eCO2, by correlating VOC to CO2 measured concentration in room air. This is not the same as CO2. NDIR sensors are used for direct measurement of CO2, There are a number of lower cost sensors on the Market,
Please recommend me a cheap sensor for co2 please
What is the principle used?
If anyone has instructions to calibrating this please tell me, i dont understand how co2zero works. Do i need to input a value in the code?
wait that sensor senses gas, how are you isolating co2?
Can any one tell me if you can use your phone as a display? Ty
How to measure o2 or nitrogen?
I kind of doubt the accuracy here. I thought the MQ135 is just a Gas-sensor, not a dedicated Co2 sensor
I think the SenseAir S8-0053 might be better.
Can I do to measure CO level like this..???
First thanks for your video, I share the idea of other comments in this post that it is difficult to really identify that the exact composition is CO2. I'm thinking if we use different sensors of different characteristics, maybe in this way we could identify according to the sensitivity of each of the air composition we are analyzing. It's just an idea. Thanks again.
What kind of screen is that?
Nice project. I like to use it to controll the air in my sleepingroom. +
But first I have to calibrate the sensor to get right values. Can you tell me, how I have to calibrate the sensor to get the right co2Zero value.
Do only the MQ135 detects CO2?
Hi may i know how to adjust the on board load resistor (the small blue box) of the MQ sensor if i want to adjust it to 5k ohm? twist to left or right?
right i think but your better off using 220
I want to add a fan. How can I do.
Nice work dude, you could loose the LED and change the display color to Red when above 999, just a suggestion
hii,
you are super ..
can you share with me the link to the above project ? i meant each parts.. i am in Germany. would like to build one myself. never use an adoino before.. but heck, i have learnt c programming long time ago.
can you also do a air particulate monitoring device such this ? i mean a real usable one..
thanks
andrew
Hi thanks for great ideas , can you add a relay on this project? I need co2 controller codes for greenhouse ,I appreciate if you can help me
i need the codes for MG811 plz help. thanks in advance
I want circuit diagram about this one
hi.thank you for ur video ,mq-135 based datasheet it can measure many type of gases,the question is how i can recognize type of gas and shown on screen .
Can you make the screen shows all kind of gases concentrations at moment? Something like:
CO2
NOx
NH3
etc:.....thank you
No you can not, in fact this device recognize those gases cause its sensor change its resistance when detects them. So if you have a room with different gases this divice will give you a measure that will be the sum of all those gases interactions with the sensor. But the interaction between the sensor with each gas is not the same, so you can manage to make an algorithm to know which gas is the device detecting (if you can control the ppm of that gas for example)
What is a ground ?
I know this is old but what can you do now? Can you send me a co2 detector that I don't even need to mess with if I give you the parameters?
Is there any sensor shield for direct plug in without the bread board eg sensor shield v5.0 ?
Not that I know of.
Hi, i have no experiece with any of this, but would like to give it a try. Can you write a shopping list please. Also, could it hooked up a small solar panel and battery ?
Hi, Nice work but do you have vent controller on this co2 meter?
Il suffit de savoir ce que tu veux faire exactement, puis de modifier le code en conséquence.
Hi can i ask you something. How do i do this but with an 16x2 LCD display monitor?
Hello bro 👋👋
Have you tried this using 16x2 LCB display. Actually I am doing this project,so pls tell me have you tried this and it have worked?
Hello I have a problem with this Diy I have a Chinese UNO card that has the terminals SDA and SCL. If I do the test by blowing the led turns on but my LCD only shows CO2 LEVEL nothing else? I also see that you have to connect the terminal 2 to triger on the program but not on your assembly? You could help me?
Hello thank you very mutch for charing this diy my error is in the program here "display.println(" ");" it's not println for my screen oled because it's 0.96 Inch Blue Yellow IIC I2C OLED it's 2 colors. All is OK. Congratulations.
Would you be able to make one that sends a text message when it exceeds a certain level?
This would be easy with lorawan or something alike. Or push message via Wi-Fi trough a telegram Bot.
Hi sir, could you tell me what the connections are like and what value is the resistance? sorry for my english
Everything is in the video
perfect for the grow tent.
Is there a parts list? I found the program on his Dropbox, but I schematic
yeah, that would be great. and could you maybe make a follow-up video on how to make this use a relay so it can be used with a 120v co2 solenoid for horticulture/aqua culture? hope it's not asking too much but you'd be a legend. thanks.
Thanks a lot for this informative video, I am following the very same code for CO2 monitoring, but I am getting some error in reading. Can you please explain how have you calibrated this sensor?
Simple, the outside reading should be 400.
@@DouglasEKnappMSAOM sorry for the late reply but what do i do if the outside reading isnt 400?
Good video. However this sensor will not detect even 5000 ppm vol of CO2. In more or less clean air (no one farts and there are no dead bodies around) it will react mostly on moisture in the air (absolute humidity). It is quite sensitive to it. In my case sensor resistance varied from 30 k (dry air) down to 6 k (close to saturation).
hi, is the device is accurate ? or just display false reading what is way off when compare to the good brand device ?
i am always in doubt with china made sensors...
thanks
andrew
It's not accurate (according to the thread forum.arduino.cc/index.php?topic=540046.0 )
Commercial CO2 sensors cost $100+ for a reason, I guess.
Try this: www.co2meter.com/products/k-30-co2-sensor-module
I would guess this highly depends on calibration. Relative measurements should be quite okay for such an inexpensive chip.
You can get me code with out export lcd please i need that
the relation for the mq135 is logarithmic... are you sure the function map is the correct one to obtain the ppm value?
and a 9 V battery won't last a long time... the sensor consumes a lot of power... because of the heating... nice OLED
It looks linear because it is on a logarithmic based graph.
An average exhaled breath contains about 40,000ppm of CO2, so the fact that his readings only go to 500ppm shows that it's probably wrong.
@@keeranparthipan2716 Please remember that CO2 and any other gas expands to fill the volume of the container it is placed in.
Great awesome video! I have been out of touch from programming and electronics for over 20 years now. Love the video - I am still bit lost. I have a lot to catch up on. I am looking to make a simple Arduino controller so when CO2 reaches certain level 12v fan kicks in for a mushroom grow box. Is this something that can be done? many thanks Ethan - Australia. Also do you have amazon links for the parts required to build?
Could probably do that with a relay, with simple if code
Nice I didn't realise this sensor would do co2
wonderfull video ,can i have the details of the sensor used
Would you consider making these and selling one?
CIRCUIT DIAGRAM LINK PLZ
This method of ppm calculation will be very unaccurate, look on the sensivity graph in mq135 datasheet, this graph is not in linear scale(map() function in your code works linear) but sensivity chart is in logarithic scale
that $5 sensor isnt going to reliably detect CO2. Breathing on it directly should have made it jump far higher. The MG811 (probably not what yours is) is ok, but NDIR sensors are here and cheaper than ever. They are accurate because they use light to detect the precise wavelength which CO2 blocks. They convert the amount of light blocked into a CO2 ppm output. I saw a demonstration with the style of sensor in which many different models were compared. They all triggered on samples of a variety of chemicals is pretty much the same way. Those can-style sensors are only good for detecting when "something might be wrong with the air." Expose it to natural gas/propane and see what it does.
Any part numbers for what you recommended?
so this is like an r2 board and would it also work on a r3 smd board?
and is there a component list at all?
2012isRonPaul I don't own any R2 boards. This design will work with any Arduino. Components are: Arduino, I2C OLED display, MQ135 gas sensor.
ok thx, but would the code also work on any esp8266 board?
2012isRonPaul Yes it would, but you would have to change the pin numbers.
ok thx, but can the breadboard run at 5 volts and the d1 board at 3volts at the same time? and how long are the jumper cables in the video and which baseplate is it? :w
AnupPlays
2 seconds ago
arduino uno, breadboard, wires, 220 resistors, led, MQ-135 sensor, arduino screen (on amazon 1st thing)
thank you so much !
May i know when i breath on it the ppm will decrease or increase?
It should increase significantly
btw, do you have a diy CH2O meter as well ?
thanks
It is exactly the same, just swap the sensor out.
Hi there, Being a newbie to Arduino, will this project work with a UNO
R3 Board ATmega328P CH340 Development Kit? Cheers!
Stephen Gareau hi, it will work with any Arduino
Thanks! Cheers!
yes it does you just need the mq-135 sensor
Hi;)
Great Video!
i build that like you described but i didn't see that graph on my screen... maybe someone here can help me?
Can you please give me the links to all the items you need to buy for this project?
arduino uno, breadboard, wires, 220 resistors, led, MQ-135 sensor, arduino screen (on amazon 1st thing) i dont have a link
Hi could you give all list of equipments used?
arduino uno, breadboard, wires, 220 resistors, led, MQ-135 sensor, arduino screen (on amazon 1st thing).
should i do a calibration for sensor before using? And also thank you so much for video and codes.
Following your instructions I have build the project and it works well as long it is connected with the USB, when I use a 9V battery it works well in the beginning but after about 8 hours the battery is empty, does it consume so much power?
There is a heater in the sensor
@@learnelectronics I realize that, so it's normal the unit can not be used as a standalone sensor operating on small batteries.It's a battery eater
was wondering why you would switch to a nano, is it for memory i'm a newbie thanks in advance
I just like the size. Electronically it's the same as the Uno.
@@learnelectronics thanks for reply i am going to build this and test it against my carbon monoxide unit just as how close it can get to the bought unit
muy buen video claro y sencillo gracias
Can you help me with calibrating the sensor?
what is the maximum ppm of co2 that can measure?
5000
How to set the calibration and button ?
dont have to
Hi there, Being new to the Arduino world, can you please provide instructions for listing and connecting the various components on the board and the Arduino unit? Cheers!
arduino uno, breadboard, wires, 220 resistors, led, MQ-135 sensor, arduino screen (on amazon 1st thing)
How would you connect the wires if you were not using an OLED screen?
+Rahul Ravi Connect the wires to what?
Would it be the same connections to the breadboard (can you also list all the materials needed for this project?)? Also, is the MQ-135 gas sensor connected to the arduino board through any wire from the breadboard to A0 on the arduino board? Thanks for any response!
Hii. I want circuit diagram how the connection is
As I am a newbie to arduino can anyone tell me what kind of arduino board it is.
Probably arduino UNO. If you use an Arduino UNO board it should work.
xpost from Reddit:
Thanks for this tutorial.
Could you please why do you map sensor's readings from 400 (I get that) to 5000?
5000 seems too high and if you lower this number the readings would change drastically.
googhalava 5000 was the maximum reading on the CO2 sensor I modeled this on.
Do you mean MQ135 can read as high as 5000 ppm CO2? I couldn't find it anywhere in the specs.
Hi sir ..i want to ask that is there any need to calibrate this sensor?
no there isn't
yes you must.
btw.... is this a CO or CO2 sensor ?
2012isRonPaul Co2
even after removing of Mq-135, it is displaying Co2, will not the reading comes to zero.
What is the complete list of materials necessary?
arduino uno, breadboard, wires, 220 resistors, led, MQ-135 sensor, arduino screen (on amazon 1st thing)
Hi there,I keep getting the following error when compiling the code that you make available:
"exit status 1
Error compiling for board Arduino/Genuino Uno."Any suggestions anyone on how I might be able to fix this error?
Well, without seeing the entire error message, my best guess is that it is a library throwing out that error. When I did that video I used a Windows7 PC, Arduino IDE 1.6.something. So if you are using a different version of the IDE that could be it.
Hi there,Yes, sorry...the full error message is as follows:
#include //grafix library for OLED ^compilation terminated.exit status 1
Error compiling for board Arduino/Genuino Uno.I guess the Adafruit_GFX.h library is not included with my IDE?Might I be able to install that library in my existing IDE? Would it be available from Adafruit?Any suggestions for overcoming this challenge are most appreciated!Cheers! Steve
Stephen Gareau ah ha! Now we know what the problem is. Easy fix my friend, download the library and install it. Here's a link: github.com/adafruit/Adafruit-GFX-Library
If you have any trouble, just give me a shout!
Thanks! I found the two missing Adafruit libraries (GFX + SSD1306) and installed them into the Arduino IDE. The compile of your code went through okay. I hooked up the circuit board and uploaded the code. The LED goes on, but nothing displays on the OLED display...Hmmm...the plot thickens! The OLED I have has a small 4-post connector that is not soldered to the OLED display (perhaps for easier shipping). But I should be getting something on it because the posts can be manually connected to the display. Perhaps there is something wrong with my circuit design??? Not sure... Any suggestions, doctor?
Stephen Gareau Well it could be the I2C address. Look for my video on find any i2c address. If yours is not 0x3c you will have to change the code.