How to calibrate an MQ-2 gas sensor || Arduino tutorial

  Рет қаралды 112,810

ElectronFun.com

ElectronFun.com

8 жыл бұрын

In this short tutorial I'm demonstrating how to calibrate an MQ-2 gas sensor and get your readings in ppm units. I'm assuming you don't want to spend hundreds of dollars for a calibration kit. The method shown in this video is based on a piece of Arduino code created and shared for free by a company called Sandbox Electronics.
See the original video - How to use gas sensors with Arduino:
• How to use gas sensors...
Subscribe to get notified about my new videos:
/ subscription_c. .
----------------------------------------------------------------------------------------------
KZbin channel: / electron. .
Google+: plus.google.com/+Electronfuncom
Facebook: / electronfunpage
Twitter: / electronfun
Website: ElectronFun.com
----------------------------------------------------------------------------------------------
Video, edit, voice by Chris Lorkowski
Music by RataxesUK - Everything [No Samples Edit]
/ rataxes-everything-no-...

Пікірлер: 142
@adailyllama4786
@adailyllama4786 3 жыл бұрын
Many Thanks! Exactly what I needed for my air monitoring project.
@ShiroiAkumaSama
@ShiroiAkumaSama Ай бұрын
Finally someone mentioning that heating is a one time process. I was looking for this answer for a while now.
@rahatkataria1755
@rahatkataria1755 4 жыл бұрын
Dude, That was superb. Thanks for sharing it!
@refrion_robotica_automacao
@refrion_robotica_automacao 4 жыл бұрын
CONGRATULATIONS. YOUR VIDEO WAS VERY USEFULL AND THANK YOU VERY MUCH FOR SHARING THIS INFORMATION. I WAS FACING SOME PROBLEMS WITH FALSE ALARMS , NOW WITH THIS CALIBRATION IT IS WORKING PERFECTELLY.
@rmus6085
@rmus6085 3 жыл бұрын
hi thanks for the video its really helps me a lot. But i have one question. For mq-6 how do i set the RL value since mq-6 using the potentiometer?
@amvip5929
@amvip5929 7 жыл бұрын
Hi There, Thanks for the code, I tried the code with my MQ sensor and edison board, it gives me values as 0 only. How do I get it to read different values?
@onjianye9491
@onjianye9491 6 жыл бұрын
Hi may i know does this example included the adjustment of temperature and humidity around the environment?
@madanmohanraok3649
@madanmohanraok3649 5 жыл бұрын
Hi, Great video, We are looking for calibration of PMS-5003 Particulate matter sensor. Any suggestions?
@mouaddibi4491
@mouaddibi4491 6 жыл бұрын
HI! thank you for the big job , can you help me for why separated the smoke and an other gaz and thanks .
@matcha5831
@matcha5831 6 жыл бұрын
Hi i wonder know how to you get this value LPGCurve[3] = {2.3,0.21,-0.47}; and i confused how u can get point2: (lg10000, -0.59) --0.59 from the datasheet given?
@rolandberendonck3900
@rolandberendonck3900 3 жыл бұрын
Do you or anybody know what is a sensative sensor for detecting secondhand smoke (cigarette smoke). I still cannot find such a sensor and a dust laser sensor does not fit because it doesn't distingquish cigarette smoke from any other smoke. Please help.
@TobiasDettinger
@TobiasDettinger 3 жыл бұрын
I have the arduino ads1015, how to write the code for my board properly?
@anitakenchannavar6493
@anitakenchannavar6493 4 жыл бұрын
how to detect only the oxygen levels in the air, which sensor i shld use
@najeebkhan7336
@najeebkhan7336 7 жыл бұрын
Hello Sir. I am Using this calibration code for MQ-7 CO sensor, its work good. But Why sensor does not give any value with out giving smoke?? Please Suggest any Help
@charanr3387
@charanr3387 6 жыл бұрын
bro In case we are having different ranges of Air flow sensor(i mean 100 sensors) in a textile industry in which I want to get the exact value by calibrating in it????????????
@vibhor6685
@vibhor6685 3 жыл бұрын
Thanks for sharing dude. Can you please guide how can i get same results with MQ2 sensor with I2C module.
@electronic7979
@electronic7979 6 жыл бұрын
Excellent
@rudygabrielsichahuaman321
@rudygabrielsichahuaman321 3 жыл бұрын
the 10K resistor is the same for the MQ131 ?
@____________________________.x
@____________________________.x 8 жыл бұрын
This was useful, thanks
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
Thanks.
@jumbo999614
@jumbo999614 2 жыл бұрын
What is difference between sensor ( 6 pin ) and sensor module (4 pin)? Do you have diagram for wiring 6 pin?
@hilman9032
@hilman9032 4 жыл бұрын
can someone tell me please, where did i can get code for mq 135 is?
@MrLiohemanth
@MrLiohemanth 4 жыл бұрын
Hi there nice video btw can we use same code for mq4 sensor
@clip8327
@clip8327 8 жыл бұрын
When hook up MQ-2 with 5V onboard pin, the voltage drop to 4.86V Is it better to use the external very smooth 5V regulator ?
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
It's better to use an external power supply, because the MQ-2 consumes up to 160mA, while Arduino Uno can deliver 200mA maximum. If you connect something more than just the sensor, you can burn out your Arduino.
@vunnammaniprashanth5604
@vunnammaniprashanth5604 5 жыл бұрын
there is no link found for coding can you please provide that
@primevigilante7259
@primevigilante7259 3 жыл бұрын
does it work with MQ 6 sensor too?
@DhirubhaisNayak
@DhirubhaisNayak 6 жыл бұрын
How did u connect those 6 wires to mq2 sensor
@warkopproduction9510
@warkopproduction9510 5 жыл бұрын
can i use the code with MQ135?
@idhamidris3481
@idhamidris3481 7 жыл бұрын
Hi ElectronFun, I'm currently working on an MQ-3B sensor to detect ethanol. I'm wondering if that sandbox electronics would work for MQ-3 too. If not, have you seen other sites that provide arduino code for that? Love your videos. Keep up your good work.
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Hi Idham, Unfortunately the code was written specifically for the MQ-2 and I'm not aware of any equivalent for the MQ-3. Thank you so much for your kind words :)
@robotic1413
@robotic1413 7 жыл бұрын
How do i select the RL value if the sensor i have is already fixed with a potentiometer?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
I guess you don't have to, because the resistor is probably already there :)
@gopikabg5403
@gopikabg5403 7 жыл бұрын
Any caliberation tips for TGS822(acetone sensor)
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
I haven't tested anything similar, sorry.
@2012isRonPaul
@2012isRonPaul 7 жыл бұрын
why do i get a reading with 10-digit number (2643534534ppm etc) and the resistance varies after every reboot of the board? (from 3.26 to 15.7kOhms etc) ....
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
To tell you the truth, I have no idea. Which code have you been using? Have you tried pre-heating your sensor?
@alexpiaro9449
@alexpiaro9449 7 жыл бұрын
Hey thanks for the video , can you help with circuit diagram for MQ7 co detector and its block diagram thanks
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
What would you like to know?
@vanshgupta24
@vanshgupta24 8 жыл бұрын
Sir what can i do for mq2 Sensor with 3 Pins for connection on arduino and breadboard
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
You can simplify your circuit. Just connect 5V and GND to your sensor. Next connect the remaining pin to your Arduino's analog input. You don't have to worry about additional resistors.
@peacecheap
@peacecheap 8 жыл бұрын
In datasheet, mq-2 only can detect LPG in 200-5000 ppm, but in demo it can detect lower than 200 ppm. Is it really accurate for measurement of LPG concentration?
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+Agsen Setyo You are an attentive observer and you are right - the datasheet says 200-5000ppm for LPG. The Sandbox Electronics guys didn't take this into account. This method of calibration will never be as accurate as the "proper" way, but it's free.
@syamilfuad5098
@syamilfuad5098 6 жыл бұрын
may i know how do u get LPG, carbon monoxide and smoke tested at the same time??
@calirific3503
@calirific3503 3 жыл бұрын
you can't, they're combined. So it is all approximates
@fannym.ninalaura4160
@fannym.ninalaura4160 7 жыл бұрын
a query how can I calibrate the MQ-8 sensor, I can use the same code that you used to calibrate MQ-2
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Unfortunately you can't use the same code, it is sensor specific. I haven't found an equivalent for the MQ-8.
@andreaspapadakis8097
@andreaspapadakis8097 7 жыл бұрын
Hey, I am using an mq4 and mq7 to detect CO and Methane Concetrations. Do u think the sanbox electronics code will work for those mq sensors when I input the Load resistance i have put for them?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
The code will not work properly with your configuration. It was created specifically for the MQ-2.
@andreaspapadakis8097
@andreaspapadakis8097 7 жыл бұрын
Thanks for replying so soon, do you have any tips for how to find the correct Load Resistance for the MQ7 which has an adjustable one, and how to calibrate it afterwards?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
No problem :) I haven't experimented with the MQ7. I'm afraid the only way to have reliable readings could be the proper calibration.
@deepaksubhedar5737
@deepaksubhedar5737 6 жыл бұрын
Do you get any solution of this problem. Plz help me if you get ???
@parthpatel4101
@parthpatel4101 8 жыл бұрын
How did you determine that Rl=5.1 works for you?
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+Parth Patel The sensitivity seemed the most reasonable with about 5kohms. However, each individual sensor may react a little bit differently, so there's no specific recipe.
@muhammedakbas9004
@muhammedakbas9004 7 жыл бұрын
thx for help :)
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
No problem :)
@gurpreetkourkamthekar8630
@gurpreetkourkamthekar8630 6 жыл бұрын
Can u tell me how much area this mq2 sensor can cover???
@ElectronFunCom
@ElectronFunCom 6 жыл бұрын
There is no such info in the datasheet as far as I remember, but I can tell you it's not a large area. I'd say a couple of centimeters/inches.
@walkindream3908
@walkindream3908 7 жыл бұрын
hi! i'm using mq-2. Why the output value is zero?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Have you connected everything correctly? If you're using a breadboard I would also check your jumper wires - some of them might be faulty.
@azliluissembanawan4659
@azliluissembanawan4659 8 ай бұрын
I need the mq 131 and the mq135 for our research
@konstantinost3185
@konstantinost3185 7 жыл бұрын
This is free air calibration, after calibration when the code is running, the CO ppm result the serial shows is 0, shouldn't it be 20000 (2%) which is the known atmospheric CO% concentrate?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
As far as I know the sensor omits the atmospheric CO concentration and measures everything above that value. It treats clean air as point 0, but don't cite me on this.
@Mohammadsharifoffical.
@Mohammadsharifoffical. 6 жыл бұрын
How to implement the formula....
@shaikhahmed7929
@shaikhahmed7929 7 жыл бұрын
I am confused how to translate the different levels of different gases from one ADC level as they all are in an air mixture. Any ideas on that? I mean how one ADC level translates into different ppms for different gases?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
It is confusing, I agree. The sensor can detect a range of gasses, but it is not able to differentiate which gas it is exposed to. The MQ gas sensors are good to experiment with, for DIY projects, but I wouldn't trust these if you're working on a professional project.
@syamilfuad5098
@syamilfuad5098 6 жыл бұрын
so do u have a solution on what sensor specifically detect what gas??
@junerilllayna252
@junerilllayna252 6 жыл бұрын
Aside from MQ 2, do you have codes for MQ 136 and MQ 131? waiting for your response.
@ElectronFunCom
@ElectronFunCom 6 жыл бұрын
No, I don't have any other codes, sorry.
@abdulkreemalsultan134
@abdulkreemalsultan134 4 жыл бұрын
Where to find gas mass flow meter? Any one can help me
@jilljill3712
@jilljill3712 7 жыл бұрын
hi thanks for the video,can you help me ,How do I can make it alert through speakers?
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Thanks for your comment :) You could use the tone function, see here: www.arduino.cc/en/Reference/Tone.
@jilljill3712
@jilljill3712 7 жыл бұрын
thank you :)
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
No problem :)
@sikerusipatah
@sikerusipatah 7 жыл бұрын
hello.does this code also same with any sensor such mq4? tq
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
You can use the same code for MQ-4, but it's not for every single sensor.
@edsonpachecojunior6797
@edsonpachecojunior6797 7 жыл бұрын
This calibration is applicapable for all sensors or only for MQ-2? I aks this because I want to calibrate my ozone gas sensor (MQ-131).
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
This is only for the MQ-2.
@behnamghassaban1718
@behnamghassaban1718 3 жыл бұрын
I want to calibrate my ozone gas sensor (MQ131) please help me if you find anything.
@turgayolgay3381
@turgayolgay3381 7 жыл бұрын
can you make this software for CH4, H2S, CO2, H2, O2, and CO ? Thank you
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Unfortunately it's not as easy. The code presented in this video was created by a company called Sandbox Electronics.
@syamilfuad5098
@syamilfuad5098 6 жыл бұрын
have u got the software? if u have may i know where?
@myprojects1991
@myprojects1991 8 жыл бұрын
thanks
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
Thanks for watching :)
@iamnotyou1886
@iamnotyou1886 6 жыл бұрын
Can u post the schematic for this?
@ElectronFunCom
@ElectronFunCom 6 жыл бұрын
Sure, you can find more details on my website: electronfun.com/project_2.php.
@didikwahyu8339
@didikwahyu8339 6 жыл бұрын
hi sir how to get LPGCurve[3] = {2.3,0.21,-0.47} ?
@ExtantFrodo2
@ExtantFrodo2 5 жыл бұрын
LPGCurve[3] = {2.3,0.21,-0.47}; //two points are taken from the curve. //with these two points, a line is formed which is "approximately equivalent" to the original curve. //data format:{ x, y, slope}; point1: (lg200, 0.21), point2: (lg10000, -0.59)
@labspedia1480
@labspedia1480 8 жыл бұрын
Good video! I need a code that allow me calibrate my sensor of alcohol (MQ-3)
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
Thanks! I'm afraid there is no such code for an MQ-3.
@revandyrizky4406
@revandyrizky4406 3 жыл бұрын
How to calibrate mq7
@ghulammehdibhutto1548
@ghulammehdibhutto1548 8 жыл бұрын
It is helpful video dear but sorry to say this not what we call calibration.. we are still unaware that whether these concentrations of gases are correct or not.. to confirm this we must need a expensive device as u shown in your video.. so problem is still there.. Keep this thing aside i want to know that how to adjust its sensitivity using potentiometer on the circuit board.. when i was testing it i just place it over stove then it was showing readings otherwise not LOL even not by burning a paper.. Do you have any solution..??
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
It's true, the software calibration is only a cheap substitute of the proper calibration. To adjust sensitivity just replace the resistor with a potentiometer.
@simplesecomumcidadao7592
@simplesecomumcidadao7592 8 ай бұрын
Thank you friend, I asked including chatGPT, it just says calibrate, thank you for your simple and understandable explanation. Can I do the same operations on MQ-135?
@prestyboy678
@prestyboy678 7 ай бұрын
Did it work? I’m trying to do the same with the MQ-135 just measuring carbon dioxide instead.
@amnieyzulfikri1789
@amnieyzulfikri1789 6 ай бұрын
have you tried on MQ-135? i urgently need it for my project for CO2 detection :(@@prestyboy678
@trixiemagdua4583
@trixiemagdua4583 2 жыл бұрын
Hello sir can i ask how can i improve the range of a sensor?
@user-ru7yp7gd2q
@user-ru7yp7gd2q 7 жыл бұрын
can you write the arduino code
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
The code is available here: sandboxelectronics.com/?p=165.
@Alexelectricalengineering
@Alexelectricalengineering 8 жыл бұрын
Thumbs up :) Alex
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+High Voltage Thanks Alex :)
@Alexelectricalengineering
@Alexelectricalengineering 8 жыл бұрын
ElectronFun.com 👍👍
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+High Voltage I can see from your videos that you like playing with high voltage, nice :)
@Alexelectricalengineering
@Alexelectricalengineering 8 жыл бұрын
ElectronFun.com Yeah I do ;) 👍👍
@ashzz999
@ashzz999 8 жыл бұрын
any calibration tips for h2 gas?
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+ashraf zin Sorry, Sandbox Electronics didn't include H2 in the code, so I guess the only way is to go through the "proper" calibration.
@jeromejones8164
@jeromejones8164 8 жыл бұрын
what is the proper method of calibration?
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
+Jerome Jones There are special kits on the market, thanks to which you are able to get a specific gas concentration in PPM units. You can expose your sensor to the gas and map the value you're getting from your sensor.
@ElectronFunCom
@ElectronFunCom 8 жыл бұрын
You need special equipment for it.
@samunibay9014
@samunibay9014 7 жыл бұрын
Hi would it be possible to post a link to the calibration equipment you found for calibrating the sensors?
@mdtowhidurrahmankha4237
@mdtowhidurrahmankha4237 7 жыл бұрын
bro can i use more then 1 mq 2 in anduino bord???
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Sure you can, just use one individual analog pin for every sensor connected to your Arduino.
@hadjer7998
@hadjer7998 4 жыл бұрын
I nées code of MQ4
@imturki6217
@imturki6217 6 жыл бұрын
programe plesea
@ElectronFunCom
@ElectronFunCom 6 жыл бұрын
You can find the project page and code here: electronfun.com/project_2.php.
@fatihustaoglu1995
@fatihustaoglu1995 4 жыл бұрын
This URL is for those who cannot find the code; sandboxelectronics.com/?p=165
@Chupria
@Chupria 4 жыл бұрын
Thank you...I thought they removed the code for some reason...but it's up and alive.
@scorpion7434
@scorpion7434 7 жыл бұрын
I challenge you to give me explanation of the weird use of the natural logarithm in the final step of the code. Even the maths experts couldn't tell me. COPY_PASTE baby! Added to that, can you provide a clean air -- a real clean air, for detecting CO2 for example, where can ya find an air that doesn't contain any CO2 to be a reference to your R0? Using those sensors are not accurate at all. they're just to detect if gas exists or not. To make them accurate you need a huge knowledge in maths, and that what I'm trying to do in my project (a real work project)!
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
The piece of code is taken from a company called Sandbox Electronics. You can find this information in the video description. These sensors are good for DIY builds, but I wouldn't use them in any commercial project, which I mentioned many times in the comments section. Good luck with your project.
@scorpion7434
@scorpion7434 7 жыл бұрын
Thanks for your reply. FINALLY someone of those who publsih videos responded to me (I just used the word "challenge" trying to make you move as I thought you're like some others who just ain't respond). Indeed it should not be used for commercial purpose, but I am in a research unit, so I will not use them until I make sure that I'm getting enough accurate readings, I'm working around this problem. I will use a certified device to compare my result with it for the particular gases. However, thanks for your wishes :) P.S and BTW SandBox is not responding to any query. I wonder if they also just copy-paste the code ;-)
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
My channel is quite small, so at that point I'm able to reply to pretty much every single comment. Sometimes it takes a few days to a week, because I have a 'regular' job and a life outside of KZbin :) Some KZbin creators receive hundreds of comments a day and more, so they reply to very few of them. I didn't realize research units use KZbin as a source of knowledge/inspiration. You want to compare a commercial sensor with the MQ series - I wonder what results you will get. I haven't contacted SandBox Electronics, but I know this project is quite old. I'm not sure if they still support it. However, it would look much more professional if they replied to your query.
@scorpion7434
@scorpion7434 7 жыл бұрын
Ya assumed they have big channel, believe me, most of who I asked have smaller than yours. I'm a software developer, and I'm doing my internship in IoT Unit (actually it's a research centre), I've been assigned a whole project in a field that I'm not familiar to. That's why I'm looking at every single source I come across. A lot of explanation needed and are not available from the source (a nice looking video with a title of "How to" but with no deep explanation), I now have a full view of the logic behind all of this, but one more left which is the use of this weird and unexpected natural logarithm (ln(y)) in the final step of the calculation. If ya have any query about the code or the logic please don't hesitate. P.S the idea of the project is to DIY from scratch and achieve very impressive and accurate device as a prototype with very low cost.
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
That's a very ambitious project, as cutting cost usually makes the whole thing less accurate and reliable. What kind of software do you develop, if it's not a secret?
@pong301275cmu
@pong301275cmu 7 жыл бұрын
this is not a calibration method.
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
How would you call it?
@pong301275cmu
@pong301275cmu 7 жыл бұрын
copy and paste
@ElectronFunCom
@ElectronFunCom 7 жыл бұрын
Everyone has the right to have their own opinions, this one is yours.
How to use gas sensors with Arduino || Arduino tutorial
7:37
ElectronFun.com
Рет қаралды 410 М.
MQ-135 Gas Sensor Module
8:50
Leon Anavi
Рет қаралды 117 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 11 МЛН
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН
Gym belt !! 😂😂  @kauermotta
00:10
Tibo InShape
Рет қаралды 18 МЛН
How to interface MQ-2 Gas Sensor with Arduino Uno (with Code and Library)
10:14
Electronics Simplified
Рет қаралды 113 М.
Getting right PPM from MQ sensors
10:19
Drone Technologies
Рет қаралды 97 М.
How To Use Gas Sensor MQ-2 With Arduino
5:02
Robokart
Рет қаралды 55 М.
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 141 М.
MQ2 Gas Leakage Smoke Detection System | Email Alert
7:54
Viral Science - The home of Creativity
Рет қаралды 25 М.
Sensors - which one to use
17:06
Electronoobs
Рет қаралды 1,3 МЛН
ESP32 #78: MQ Gas sensors
6:55
pcbreflux
Рет қаралды 35 М.
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН