Engineer Jagat

IT & Engineering Stuff

How to Code Gas Sensor using Arduino?

January 10, 2021
How to Code Gas Sensor using Arduino?

Gas Sensor is capable of sensing different types of Gases like LPG, Smoke, Alcohol, Propane, Hydrogen, Methane, etc.

In the case of Arduino MQ-2 and MQ-3 Gas sensors are the most popular and used sensors.

MQ-2 and MQ-3 have capabilities to sense these gases and most used Series of MQ to develop Arduino Gas Sensor related projects.

With the help of MQ-2 and MQ-3 Gas Sensor, we could make a system like Gas Detector, Leakage Alert System, Gas Alarm System, etc.

It is very easy to use Arduino Gas Sensor and Coding is simplified by Arduino IDE.

So,let’s look a sample code to operate or test your Gas sensor

int led_pin = 13;
int sensor_pin = A0;
int value;
void setup() {
Serial.begin(9600);
pinMode(led_pin, OUTPUT);
pinMode(sensor_pin, INPUT);
}
void loop() {
 int value  = analogRead(sensor_pin);
Serial.println(value);
delay(1000);
}

Circuit Design

Share with Friends
Copyright © 2020-2021 Engineer Jagat All rights reserved. Developed by Ravindra Rana