Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Rucksikaa Raajkumar
Published © CC BY

MQ-2 Gas Sensor : A friendly introduction

A short and simple introduction about the MQ-2 Gas/ Smoke sensor module.

IntermediateFull instructions provided1 hour3,052
MQ-2 Gas Sensor : A friendly introduction

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Grove - Gas Sensor(MQ2)
Seeed Studio Grove - Gas Sensor(MQ2)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×3

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver
For calibration

Story

Read more

Code

Sample code

Arduino
You can use this code to obtain the analogue readings from the MQ type sensor module
int sensor = A0;
int reading;
void setup(){
  Serial.begin(9600);
}
void loop(){
  reading = analogRead(sensor);
  Serial.println("Reading: ");
  Serial.print(reading);
}

Credits

Rucksikaa Raajkumar
43 projects • 94 followers
Amateur Arduino Developer. Undergraduate. YouTuber (https://www.youtube.com/c/RucksikaaRaajkumar/videos) and Blogger (Arduino Projects by R)

Comments