Youtube subtitles download by mo.dbxdb.com
Hi, these little guys are MQ-2 and MQ-5 gas sensors.
They look identical and you can probably tell them apart only by the labels.
Both require exactly the same connections, but they detect different gases.
In this tutorial I'll show you how to use one of them with Arduino.
We'll be reading values from the sensor
and make the Arduino light an LED when gas concentration rises above certain level.
To build this project you'll need a few things:
a 5V DC power supply that can deliver at least 0.3A,
an MQ-2 or MQ-5 gas sensor,
an Arduino board,
a breadboard,
a few wires,
an LED,
a 120 ohm resistor,
a resistor close to 20k,
a piece of heat shrink tubing
and a gas lighter or torch.
Let's start playing with the sensor.
A gas sensor has 6 pins.
These 2 middle legs are heater coil pins.
Don't worry about polarity, it's not important in this sensor.
The next 2 legs are A pins and they should be connected to each other.
The last pair is named B and these 2 pins should also be connected to each other.
I'll connect my wires to the sensor using heat shrink tubing.
Now, let's connect the sensor to the breadboard.
One of the heater coil wires goes to the positive rail and the other one to ground.
Connect both A wires to the positive rail on the breadboard.
Hook up the B wires to the same row and to ground through a 20k resistor.
A jumper wire goes between the B pins and A0 pin on your Arduino board.
Connect your breadboard ground rail with the Arduino ground pin.
Hook up your LED's negative lead to ground and the positive lead to one of empty rows on the breadboard.
Connect a 120ohm resistor to the positive lead of your LED
and the other end of the resistor
through a jumper wire to your Adruino's pin number 8.
Connect a jumper wire to the positive rail on you breadboard
and another one to the ground rail.
Hook up your power supply to these jumper wires and the Arduino to your computer.
Download the code from my website and upload it to your Arduino.
You'll find a link in the description below.
Now, go to Arduino IDE,
select 'Tools' -> 'Serial monitor'
and you should see a value between 0 and 1023.
If your sensor detects gas, the value goes higher.
Readings from the sensor are reliable after about 2-3 minutes after powering up.
After about 3 minutes you'll notice the readings will go lower and stabilize at a certain base value.
Now, I'll try to give my sensor some gas from a mini torch.
As you can see the value increases instantly.
When it reaches 500 the LED lights up.
You can adjust sensitivity by changing the 'sensorValue' in the code to match your needs.
Now you know how to use a gas sensor with the Arduino.
If you have any questions or want to add something, feel free to write a comment below.
If you like this video or find it useful,
you can support me by sharing this tutorial with your friends, giving me thumbs up
or subscribing to my channel.
Knowing that you appreciate my work really helps me make more videos.
Thanks for watching and see you next time. Subtitles End: mo.dbxdb.com