How to interface MQ-2 Gas Sensor with Arduino Uno (with Code and Library)

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 เม.ย. 2021
  • #Arduino​ #Smoke​ #Detector​
    What is a Gas Sensor?
    They are electronic devices that detect and identify different types of gasses. They are commonly used to detect toxic or explosive gasses and measure gas concentration.
    In this project, I have interfaced a Gas Sensor with Arduino that displays the contents of various gases in the atmosphere. The MQ-2 Gas Sensor can detect a list of Gases along with Smoke.
    So incase you are looking out for a smoke detector, you can modify the same program for smoke detection.
    Components List:
    Arduino Uno : amzn.to/3eAvyJl
    MQ-2 Gas Sensor : amzn.to/3nbnKl8
    LCD 16x2 with I2C Module : amzn.to/3sByuKE
    Jumper Cables : amzn.to/3v3juGM
    MQ-2 Sensor Code and Libraries :
    github.com/rolan37/MQ-2-Senso...
    Library
    www.electronicssimplified.in/...
    Code : www.electronicssimplified.in/...
    LCD tutorial : • LCD 16x2 interfaced wi...
    Read the Post at : www.electronicssimplified.in
    Background Music
    - Lichu - Island
    - • Lichu - Island
    Please show some love.
    Like | Share | Subscribe
    #GasSensor​​ #Arduino​#SmokeDetector​#Gases​
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 175

  • @shramiksalgaonkar8635
    @shramiksalgaonkar8635 3 ปีที่แล้ว +13

    One of the most detailed video on youtube. Great work sir...

  • @kagisopilane4088
    @kagisopilane4088 8 หลายเดือนก่อน

    Hi, this is great. My LCd displays lpg: 0 CO:0 Smoke: 0%. Is the problem with the calibration maybe

  • @denzilpillay7986
    @denzilpillay7986 2 ปีที่แล้ว +3

    I am using this video as part of my project and when you listed all the materials I bought them , you mentioned that we should but Male to Female but went on to use Male to Male.

    • @rolanpereira7643
      @rolanpereira7643 2 ปีที่แล้ว

      Female to male is preferably. But a jumper cable set is what is mentioned in the video.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว

      Jumper cable set is listed in the components.
      Please use the links below.
      If you have existing jumper cables then male to female are preferred as they would replace the use of even a breadboard.

  • @satishmohitsatish1730
    @satishmohitsatish1730 ปีที่แล้ว +4

    Sir how to connect alarm in this project if lpg or another harmful gas leakage happened

  • @ayushtiwari46
    @ayushtiwari46 2 ปีที่แล้ว +3

    Bro I want to add gsm module in it also how may I do that
    ????????........plz reply

  • @ujjwalsinha7385
    @ujjwalsinha7385 8 หลายเดือนก่อน

    the output is not displayed on the LCD
    what to do?

  • @muhammadnawzad1680
    @muhammadnawzad1680 3 หลายเดือนก่อน

    Hi i have some question
    1- for the measurement how to calibrate it ?
    2- what is the range that read for LPG in PPM ? Maximum & Minimum?

  • @trinican2
    @trinican2 3 ปีที่แล้ว +5

    I enjoyed your tutorial but I have two questions. 1. Does the MQ2 library automatically includes the calibration in gas type and ppm ? 2. I would like to do the same with an MQ9 to measure natural gas in ppm. Is there an equivalent MQ9 library and would the command syntax be the same ? Thanks very much.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  3 ปีที่แล้ว

      1.The library of MQ2 includes the calibration for all the gases MQ2 sensor can detect.
      2. github.com/mdsiraj1992/Gassensors visit this link and access all the libraries for MQ gas sensors.
      Thank you!

  • @erasaniswaroopkumar9124
    @erasaniswaroopkumar9124 6 หลายเดือนก่อน

    can u explain the mq7,and mq8 gas sensors interface with arduino uno output data displays in 20*4 display with code

  • @akshaypatil8467
    @akshaypatil8467 ปีที่แล้ว +2

    Can we used multiple gas detector sensor

  • @AnshumanAtrey
    @AnshumanAtrey ปีที่แล้ว +1

    will it work directly with a laptop and no battery?
    my LCD only shows blue light
    I am using 400 point breadboard
    The I2C module is already connected to LCD
    please help sir

  • @2JSinc
    @2JSinc ปีที่แล้ว +2

    Thanks for this, would it be possible for you to add a LPG tank weight monitoring with low level alert, thanks

  • @rampagegaming5645
    @rampagegaming5645 ปีที่แล้ว +2

    Is this working by using MQ135 sensor?

  • @Cdswjp
    @Cdswjp ปีที่แล้ว +1

    Great work bro

  • @khessclarksereno6327
    @khessclarksereno6327 4 หลายเดือนก่อน

    Is it possible to measure the level of methane gas only in the mq2 library?

  • @nsagrawal5444
    @nsagrawal5444 ปีที่แล้ว +1

    Can you siplyfy the wire connection

  • @shashanktg08
    @shashanktg08 ปีที่แล้ว +1

    i did the same way as shown it turned on as it was to be but there is no reading on the lcd what is the problem

  • @bhaskarg8438
    @bhaskarg8438 2 ปีที่แล้ว +16

    Better if you also explain the code logic with respective to the components assembled to Arduino, Thank you

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว +1

      I have started doing this in my newer videos. Considering your suggestion.

  • @carson5702
    @carson5702 2 ปีที่แล้ว +1

    loved the vid but where can you find the MQ2 sensor library normally because I can't find it.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว

      www.amazon.com/Butane-Hydrogen-Sensor-Detector-Module/dp/B0786DH3BW/ref=mp_s_a_1_2?keywords=mq2%2Bsensor&qid=1638064300&sr=8-2&th=1&psc=1

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว

      github.com/rolan37/MQ-2-Sensor-Interfaced-with-Arduino

  • @johnpatrickabsalon2221
    @johnpatrickabsalon2221 ปีที่แล้ว +1

    what type of Arduino is this? can i use arduino uno r3 DIP?

  • @prashadnaik1208
    @prashadnaik1208 3 ปีที่แล้ว +4

    Well explained Sir

  • @joycechong8907
    @joycechong8907 2 ปีที่แล้ว +1

    Well explanation!! Nice!
    I have a little question. Since most of the tutorials are used to test for smoke and gas, is that possible to test the human breathing? Thanks!

  • @MuhammadSyamil-me8vw
    @MuhammadSyamil-me8vw หลายเดือนก่อน

    bro in the library there is only lpg,co,and smoke, how do i detect the ch4 then?

  • @Crazy_22119
    @Crazy_22119 8 หลายเดือนก่อน

    lcd.begin();//Defining 16 columns and 2 rows of lcd display . Bro in this line i am getting error. Pls help me .its an emergency pls . I have school project

  • @RedDragonXD515
    @RedDragonXD515 6 หลายเดือนก่อน +1

    can you please give me the vision of liquidi2c library please

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  6 หลายเดือนก่อน

      www.electronicssimplified.in/wp-content/uploads/2023/06/LiquidCrystal_I2C.zip

  • @Drxxx
    @Drxxx 3 ปีที่แล้ว +2

    Great channel!!

  • @RitheshMoolya
    @RitheshMoolya ปีที่แล้ว +1

    I need ammonia sensor with display...

  • @dr.mithilfaldesai3561
    @dr.mithilfaldesai3561 2 ปีที่แล้ว +2

    What is the output unit from A0? resistance in milliohms? current in mA?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว +1

      It's neither. It will always be voltage levels. That would be ranging from 0V to Vcc (in this case its 0V to 5V)

  • @boraicho6276
    @boraicho6276 ปีที่แล้ว

    Does this sensor (MQ-2) detect Carbon Dioxide concentration ? I only see Carbon Monoxide reading in the video.

  • @manmangy
    @manmangy ปีที่แล้ว

    Can we use this to test Chlorine

  • @kushals2538
    @kushals2538 2 หลายเดือนก่อน

    i have given the correct commands and connections but the lcd is not powering up

  • @AmanKumar-es4wp
    @AmanKumar-es4wp 2 ปีที่แล้ว +1

    Sir I have urgent need of this program

  • @user-ku3rs5yx5i
    @user-ku3rs5yx5i 8 หลายเดือนก่อน

    How i code into the laptop

  • @sriyakanuri4453
    @sriyakanuri4453 3 หลายเดือนก่อน +1

    Hi, i've the lcd but do not have the i2c coverter, so how do i interface it?

    • @sriyakanuri4453
      @sriyakanuri4453 3 หลายเดือนก่อน

      Can I still use an lcd shield instead?

  • @user-tc9dv7hi2y
    @user-tc9dv7hi2y 2 หลายเดือนก่อน

    bro can we use c2h4 gas sensor fof same steps behalf of using gas sensor

  • @AmanKumar-es4wp
    @AmanKumar-es4wp 2 ปีที่แล้ว +1

    If any one u have and you know how to program them plzz help

  • @ShiwonPrecious
    @ShiwonPrecious 23 วันที่ผ่านมา

    Sir please which code did you use for the gas detector

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  13 วันที่ผ่านมา

      Code : www.electronicssimplified.in/feed/code-for-gas-sensor/

  • @nandagustiawan6237
    @nandagustiawan6237 ปีที่แล้ว +1

    please library MQ4

  • @ShiwonPrecious
    @ShiwonPrecious 23 วันที่ผ่านมา

    Is it possible to detect the gas and actually direct it in a particular place

  • @the_hyper_here3236
    @the_hyper_here3236 ปีที่แล้ว +1

    sir can you send me working of block diagram

  • @manojmodapalli1635
    @manojmodapalli1635 9 หลายเดือนก่อน +1

    sir i did the same connection shown in the viedo , lcd display was working but it didnt show the detection percentage as shown in the viedo how can i fix this problem , thank you

  • @Amazon_offers2
    @Amazon_offers2 ปีที่แล้ว

    bro can you make this without i2c

  • @user-ot3er7ph7q
    @user-ot3er7ph7q 11 หลายเดือนก่อน

    Sir i am getting the output displayed on serial monitor but not on lcd .There are no errors and connections are also proper

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  11 หลายเดือนก่อน

      Why is the LCD working with other programs? Just check if the LCD can receive data and display some data on it. You might have to adjust your potentiometer at the back of your I2C module.

  • @karthik3889
    @karthik3889 ปีที่แล้ว +1

    Please give mq 4 library

  • @NotGreig
    @NotGreig 5 หลายเดือนก่อน

    hello sir, i am receiving a compiling error with my lcd screen. It say's no matching function

  • @NBAK-jx5ud
    @NBAK-jx5ud 2 ปีที่แล้ว +1

    where's the link for the LCD not display.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว

      th-cam.com/video/UezoCbBSavQ/w-d-xo.html

    • @NBAK-jx5ud
      @NBAK-jx5ud 2 ปีที่แล้ว +1

      oh wow! very responsive thank you!. hoping you gain million of subscribers! ❤️

  • @user-be3jx1xd1w
    @user-be3jx1xd1w 2 ปีที่แล้ว +2

    Broh! At 3:25 uh said to connect A0 to Analog Pin 0 on Arduino, but uh connected GND to A0 .Can uh plzz tell me which is correct??

    • @rolanpereira7643
      @rolanpereira7643 2 ปีที่แล้ว +1

      Connect A0 to Analog Pin 0 on Arduino, that's correct.

    • @rolanpereira7643
      @rolanpereira7643 2 ปีที่แล้ว +1

      Don't go by the wire colors. They are a little similar. And i see why you are confused.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  2 ปีที่แล้ว +2

      Please see that A0 on the MQ will be connected to A0 pin on the Arduino. Don't refer the wire colors. See the circuit diagrams. Bingo.

    • @user-be3jx1xd1w
      @user-be3jx1xd1w 2 ปีที่แล้ว +1

      @@ElectronicsSimplified7 Ok broh.. Thanks for helping. Im confused by colours.

    • @user-be3jx1xd1w
      @user-be3jx1xd1w 2 ปีที่แล้ว +1

      @@rolanpereira7643 Thanks broh!

  • @157vaibhavibhalerao5
    @157vaibhavibhalerao5 ปีที่แล้ว +1

    overall price ?

  • @sakshisuvarna3902
    @sakshisuvarna3902 ปีที่แล้ว

    hello, is it okay to add MQ9 sensor instead of MQ2 and how about library ?
    thanks in advance

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      No it's not okay ...
      They are two different sensors. They do almost the same job but have been built different over the years.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว +1

      You could download the MQ9 Sensor library from the internet

  • @imransaeed5536
    @imransaeed5536 2 ปีที่แล้ว +1

    I am looking to someone to make me whole unit with my logo on it, with packing and detail instructions, how to install it . I need big production of it. Thanks

  • @gourabhaldar6627
    @gourabhaldar6627 11 หลายเดือนก่อน +1

    If I use MQ135 instead of MQ2 will the code change?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  11 หลายเดือนก่อน

      Yes it will change

    • @gourabhaldar6627
      @gourabhaldar6627 11 หลายเดือนก่อน

      @@ElectronicsSimplified7 ok sir, thanks for the reply. Actually I'm doing this with MQ135 sensor. So can you please tell what changes I need to do in order to run this successfully.
      Thanks in advance.

  • @mariyamansari5526
    @mariyamansari5526 11 หลายเดือนก่อน +1

    Sir i am getting the output on serial monitor but not on LCD

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  11 หลายเดือนก่อน

      Can you check your connections?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  11 หลายเดือนก่อน

      Make sure your libraries for LCD are added correctly.
      Please add the libraries from the description.

  • @edscelavancena2133
    @edscelavancena2133 ปีที่แล้ว

    how to connect alarm in this project if lpg or another harmful gas leakage happened

  • @user-be3jx1xd1w
    @user-be3jx1xd1w 2 ปีที่แล้ว +1

    Broh! Can uh plzz give MQ5 library

  • @flemyjose4036
    @flemyjose4036 ปีที่แล้ว

    why the analog output of sensor is being used instead of digital output

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Digital will just tell us if any particle is sensed or not sensed (0 and 1 - digital).

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      We need to figure out what particle is sensed so we take the analog reading to decided what type of particle is being sensed.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Particle ----> Gas (Thats the simplification).
      Thank you for your question!

  • @hritwikraj966
    @hritwikraj966 2 ปีที่แล้ว

    I have 4 digit 7 segment lcd .... can I use the same code ?? Help me ...

  • @wanfiq3191
    @wanfiq3191 ปีที่แล้ว +1

    can i get example the coding?

  • @diabolsensei
    @diabolsensei ปีที่แล้ว +1

    hi can i get ckt diagram for this project.

  • @rafaelbendigo6270
    @rafaelbendigo6270 ปีที่แล้ว +1

    is it necessary to solder his 16pins to work?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว +1

      Necessary... If you do not want to solder... Then use a breadboard

    • @rafaelbendigo6270
      @rafaelbendigo6270 ปีที่แล้ว +1

      @@ElectronicsSimplified7 can i pm you ? my lcd doesn't work like yours. the wires are the same how it is in the video.

    • @rafaelbendigo6270
      @rafaelbendigo6270 ปีที่แล้ว +1

      @@ElectronicsSimplified7 i like your video and explanation but the only is not working is my LCD
      pls help .

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Visit electronicssimplified.in and contact me

  • @razzheenshyrickadelacruz5233
    @razzheenshyrickadelacruz5233 2 ปีที่แล้ว +4

    I tried doing this project. However, the smoke cannot be detected. The value displayed for smoke is at 0% only. Only the values of LPG and CO are read. How can I fix this?

    • @thatwasparticia6671
      @thatwasparticia6671 ปีที่แล้ว

      Help, what did you do

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      You probably have changed the code and failed to display it.

    • @bryanlanchimba4740
      @bryanlanchimba4740 5 หลายเดือนก่อน

      ​@@thatwasparticia6671 I think it is because we transformed the smoke reading into a percentage. The value is very small and could not be read. I removed this 100/1000000 part and started reading the smoke.

  • @venkateshakula7373
    @venkateshakula7373 2 ปีที่แล้ว +1

    Bro can I have algorithm of this project tonight same project I have doing in my clg.if u interest to help comment your any social media accounts

  • @fakegamer8336
    @fakegamer8336 ปีที่แล้ว +1

    does mq-2 measure co2 or co?

  • @user-rv8vg1dq7k
    @user-rv8vg1dq7k ปีที่แล้ว +1

    Why it is taking too long to upload the program into Arduino Uno?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Sometimes the compilation can take longer than expected. It's completely normal.

  • @advance-maths
    @advance-maths ปีที่แล้ว +2

    Yesir

  • @awiawi117
    @awiawi117 ปีที่แล้ว

    i didn t understand the last step in in 9:18 how do it?

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      You can just upload the code. By selecting your board.

    • @awiawi117
      @awiawi117 ปีที่แล้ว

      @@ElectronicsSimplified7 what board sorry i am a beginner can you explain a bit more i did everything like the vid i am just stuck at the last part and i need it for tomrow

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      You can check some basic videos on how to upload code to Arduino Uno.

  • @deadlyvenom5804
    @deadlyvenom5804 6 หลายเดือนก่อน +1

    Dude smoke ppml is not calculating any solution??

    • @dilj1439
      @dilj1439 4 หลายเดือนก่อน

      Where is the code .?.???

  • @nagakowshik578
    @nagakowshik578 2 ปีที่แล้ว

    sir can u plz help me connection of mu project sir
    my project is fire and gas detection system with IOT sir

  • @loveislikedream
    @loveislikedream 2 ปีที่แล้ว +1

    bro i we do this project without 12 c module

  • @lydianandaputri1582
    @lydianandaputri1582 ปีที่แล้ว +1

    mq-6??

  • @nirajkalamkar3107
    @nirajkalamkar3107 23 วันที่ผ่านมา

    I did the same process which you did but it didn't work the code failed in uploading i didn't changed the code even but still it failed i asked my uncle who is engineer he said this cannot be worked i tried for 4-5 times but it failed

  • @rsiinvestor450
    @rsiinvestor450 3 ปีที่แล้ว +2

    *Recomemd by Emanul Perreira*

  • @kaushikmistry3438
    @kaushikmistry3438 ปีที่แล้ว +1

    Bro mq2 library is not installing

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      You have to remove it from your Arduino/library folder
      And then reinstall it.

  • @karthik-gz3oz
    @karthik-gz3oz 4 หลายเดือนก่อน +1

    bro i want zip files

  • @DavidDavis-se8ns
    @DavidDavis-se8ns ปีที่แล้ว +2

    His "MQ-2" sensor looks like an MQ-135. I know because I bought the same. Only in the Fritzing schematic, an MQ-2 is depicted. MQ-2 is not even suited for carbon dioxide but MQ-135, which he handles at the beginning (I quit watching) does.

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว +2

      As an example, a methane (molecular) concentration of 2% means that 2 out of every 100 air molecules is methane. Similarly, a methane concentration of 2 ppm means that 2 out of every 1 million air molecules is methane. Can MQ-2 detect CO2? A short and simple answer to this question is yes, it can detect CO2.
      You can refer to how smoke is mostly a combination of carbon monoxide and carbon dioxide. Mq-2 sensor has the ability to detect. But the measurements are derived from other gas concentration values.

    • @DavidDavis-se8ns
      @DavidDavis-se8ns ปีที่แล้ว

      @@ElectronicsSimplified7 You are quite right that there is a mathematical correlation between the two. It's just that we do not exhale methane. I believe cows do produce a lot of methane. So there could be one useful application for it 🙂. If you don't want to spend some 30 bucks on a real CO2 sensor you could get the SGP30 from Ali.... for a few dollars. It does a pretty good job in indirectly calculating the CO2 value in the air. Some smart folks on TH-cam already found out. I probably will get one too, later on. ...

  • @shamilsalman9175
    @shamilsalman9175 ปีที่แล้ว +1

    add buzzer and gsm module to it

  • @vidhyakoranga9067
    @vidhyakoranga9067 13 วันที่ผ่านมา

    Sir please provide the ges sensor code.

  • @novestkuvimba1469
    @novestkuvimba1469 ปีที่แล้ว +1

    Hie sir, can you sent us the code for the Arduino.

  • @AmanKumar-es4wp
    @AmanKumar-es4wp 2 ปีที่แล้ว +1

    Sir I am new student I don't know how to program so plzzz help

  • @patiencemtonhodza2477
    @patiencemtonhodza2477 ปีที่แล้ว +1

    can l get the code for this project bro

  • @venkateshakula7373
    @venkateshakula7373 2 ปีที่แล้ว

    Vision of arduino pls bro it's an urgent

  • @dextrond.5557
    @dextrond.5557 6 วันที่ผ่านมา

    Mq2 sensor can’t differentiate gasses,

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  6 วันที่ผ่านมา

      It can detect all those gases. But it can't find out which gas was detected particularly. But by concentration. It can be predicted.
      So in a LPG prone leakage zone. You can set the value. That's the whole purpose.

  • @satishmohitsatish1730
    @satishmohitsatish1730 ปีที่แล้ว

    Led have no lights

  • @Crazy_22119
    @Crazy_22119 ปีที่แล้ว +1

    Not working bro 😭

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Please explain what is not working in detail. Happy New Year!

    • @Crazy_22119
      @Crazy_22119 ปีที่แล้ว

      @@ElectronicsSimplified7 i have given all connections everything as per u said when uploading code i uploaded library and i have upload that time problem occurs "16 columns and 2 rows of lcd display" this code is wrong showing i removed that code and uploaded lcd display not show reading

    • @Crazy_22119
      @Crazy_22119 ปีที่แล้ว

      Pls tell bro very urgent project bro pls 🙏🙏🙏

  • @hemanthjami1287
    @hemanthjami1287 ปีที่แล้ว

    bro code

    • @ElectronicsSimplified7
      @ElectronicsSimplified7  ปีที่แล้ว

      Codes are usually in the description and always on github and my website : www.electronissimplified.in

  • @gregbennett2437
    @gregbennett2437 ปีที่แล้ว

    DID NOT WORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!