
Arduino UNO R3 with Cable
Microcontrollers

The MQ2 Gas Sensor is a versatile and widely used sensor for detecting flammable and combustible gases. It is capable of detecting gases like LPG, methane, propane, hydrogen, alcohol, smoke, and carbon monoxide, making it ideal for gas leakage detection systems and air quality monitoring.
The MQ2 Gas Sensor is a versatile and widely used sensor for detecting flammable and combustible gases. It is capable of detecting gases like LPG, methane, propane, hydrogen, alcohol, smoke, and carbon monoxide, making it ideal for gas leakage detection systems and air quality monitoring.
The MQ2 sensor uses a SnO₂ (tin dioxide) sensing layer. In clean air, the layer has low conductivity. When exposed to flammable gases, the conductivity increases, and this change is measured to determine the concentration of gas.
const int analogPin = A0; // Analog output pin
const int digitalPin = 2; // Digital output pin
int analogValue = 0;
void setup() {
Serial.begin(9600);
pinMode(digitalPin, INPUT);
}
void loop() {
// Read analog value
analogValue = analogRead(analogPin);
// Print analog value (gas concentration)
Serial.print("Analog Value: ");
Serial.println(analogValue);
// Check digital output
if (digitalRead(digitalPin) == HIGH) {
Serial.println("Gas concentration exceeded threshold!");
}
delay(1000);
}
Shop more
Products from the same category or commonly paired with this item.
Shop more
Customer favorites that are getting the most attention.
Shop more
Freshly added items from the shop.