sensor-experiments

Introduction

This experiment uses the MQ-4 gas sensor to detect gasoline fumes in the air.

Components Needed

No Ads Available.

Circuit Setup

  1. Connect the VCC pin of the MQ-4 sensor to 5V on the Arduino.
  2. Connect the sensor’s output to an analog input pin (e.g., A0) on the Arduino.

The sensor will output a signal proportional to the concentration of gasoline fumes detected.

MQ-4 Circuit Setup

Code for Gasoline Fume Detection

Upload the following code to your Arduino to detect gasoline fumes:


const int mq4Pin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int gasValue = analogRead(mq4Pin);
  Serial.print("Gasoline Fumes Level: ");
  Serial.println(gasValue);
  delay(1000);
}
            

Explanation

The MQ-4 sensor detects the concentration of gases such as methane and gasoline in the air and converts it into an analog voltage signal.

Troubleshooting

Contact Us

If you have any questions or inquiries, feel free to reach out to us at Microautomation.no@icloud.com .

Follow our Socials for the newest updates!