Gas Sensor HS-S11P

Gas Sensor HS-S11P

1. Introduction

The gas-sensitive material used in the MQ-4 gas sensor probe is tin dioxide (SnO2) with a low electrical conductivity in clean air.When the sensor is in an environment with flammable gases, the conductivity of the sensor increases with the increase of the concentration of flammable gases in the air.Using a simple circuit, the change in conductivity can be converted into an output signal corresponding to the gas concentration.The gas sensor has high sensitivity to liquefied gas, propane, and hydrogen, and the detection of natural gas and other flammable vapors is also ideal.This sensor can detect a variety of flammable gases and is a low-cost sensor suitable for a variety of applications.

2. Schematic

Gas Detection Sensor-HS-S11P SchematicClick to view

Module Parameters

Pin Name

description

G

GND (Negative Power Input)

V

VCC (Positive Power Input)

S

Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection method: PH2.0 3P terminal

  • Installation Method: Double Screw Fixed

4, Circuit Board Size

5 of Arduino IDE example program

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Arduino IDE Library Download and Import Tutorial:
Click to view

Example program (UNO development board):

void setup(){
  pinMode(11, OUTPUT);
  Serial.begin(9600);
  digitalWrite(11,LOW);
  pinMode(A2, INPUT);
}

void loop(){
  //烟雾报警器:有源蜂鸣器接D11,
  //烟雾传感器接A2;
  //注意烟雾传感器与扩展版接口线序,不要正负极接反。
  //当烟雾传感器检测气体或者烟雾时输出低电平(0),
  //蜂鸣器有频率的响起。

  //打开串口监视器,查看串口烟雾传感器输出值,调节电位器,没有烟雾或者气体,模块指示灯熄灭。
  if (digitalRead(A2) == 0) {
    //检测到烟雾输出低电平(0),电机工作,led灯与蜂鸣器响
    for (int i = 0; i <= 3; i = i + (1)) {
      digitalWrite(11,HIGH);
      delay(200);
      digitalWrite(11,LOW);
      delay(200);
    }

  } else {
    digitalWrite(11,LOW);

  }
  Serial.print("烟雾输出值:");
  Serial.println(digitalRead(A2));
  delay(10);

}

6, ESP32 Python Example (for Mixly IDE/Misashi)

Choose the development board Python ESP32 [ESP32 Generic(4MB)] and upload in code mode

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Example program (ESP32-Python):

import machine
import music
import time


pin2 = machine.Pin(2, machine.Pin.IN)
midi = music.MIDI(4)
while True:
    if pin2.value() == 0:
        for i in range(0, 3, 1):
            midi.pitch_time(440, 1000)
            time.sleep(1)
    time.sleep_ms(10)

7, Mixly example program (graphical language)

Example program (UNO development board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial of Mixly IDE Arduino library:Click to view

Example Program (ESP32 Development Board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

8. Setting up the Test Environment

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 DEVELOPMENT BOARD *1

  • HELLO STEM UNO R3 P EXPANSION BOARD *1

  • USB TYPE-C DATA CABLE *1

  • Gas sensor module (HS-S11P) *1

  • Active buzzer (HS-F07L) * 1

  • PH2.0 3P dual-head terminal line *2

Circuit wiring diagram:

ESP32 Test Environment Setup

Prepare Components:Pending update...

Circuit wiring diagram:Pending update...

9, Video tutorial

Video tutorial:Click to view

10, Test results

Arduino UNO test results:

Adjust the threshold of the potentiometer on the back of the module, with the gas sensor module powered on, adjust the potentiometer of the sensor module with a small screwdriver, until the sensor signal indicates the blue light is off when there is no gas or smoke interference, and the signal of the gas sensor module indicates the blue light is on when there is gas or smoke.

After the device is connected to the wire, upload the above program to the Arduino UNO development board, open the Mxily serial port monitor, and when the smoke sensor detects gas or smoke, it outputs a low level (0), and the buzzer sounds at a frequency; when no smoke is detected, it outputs a high level (1), and the buzzer does not sound.

ESP32 Test Results:

Pending update...