In this project, we will show how to use Arduino and MQ5 gas sensor to detect smoke and gas.

2)Parts and devices:

1 x ardunio UNO(or Arduino mega2560)

1 x USB cable

1 x MQ-5 Gas sensor

1 x LED

Jump wires

3)Circuit Graph:


4) Sample code download link as following:

MQ_5 Arduino test code download here

Unzip the downloaded file and upload it into Arduino.


When you put a gas lighter close to sensor,the LED will flash, serial window in Arduino IDE will show “dangerous”;If you remove gas lighter from sensor,LED will turn off and serial window will show “NO dangerous”. See following pictures:

dangerous no dangerous