5V
5V
150mA
100-1000ppm (H2), 200-2000ppm (LPG), 300-3000ppm (CH4), 10-100ppm (CO)
Analog (0-5V) and Digital (TTL)
<10 seconds
| Warm-up Time | <1 minute |
44mm x 22mm x 17mm
Applications
| The MQ-5 Gas Sensor Module is suitable for use in various IoT applications, including |
Conclusion
The MQ-5 Gas Sensor Module is a highly reliable and sensitive gas detection module that provides accurate and real-time monitoring of four types of gases. Its compact design, low power consumption, and ease of integration make it an ideal component for various IoT applications.
MQ-5 Gas Sensor Module DocumentationOverviewThe MQ-5 Gas Sensor Module is a highly sensitive and reliable sensor designed to detect the presence of various gases, including Hydrogen (H2), Liquefied Petroleum Gas (LPG), Methane (CH4), and Carbon Monoxide (CO). This module is suitable for a wide range of applications, including industrial automation, air quality monitoring, and safety systems.Technical SpecificationsOperating Voltage: 5V
Operating Current: 150mA
Sensing Range:
+ Hydrogen (H2): 100-1000 ppm
+ Liquefied Petroleum Gas (LPG): 100-1000 ppm
+ Methane (CH4): 100-1000 ppm
+ Carbon Monoxide (CO): 10-1000 ppm
Output Signal: Analog Voltage (0-5V)
Response Time: <10 seconds
Dimensions: 32mm x 22mm x 15mmPinoutVCC: Power supply pin (5V)
GND: Ground pin
OUT: Analog output pin
DOUT: Digital output pin (optional)Code Examples### Example 1: Basic Analog Readings with ArduinoThis example demonstrates how to read analog voltage output from the MQ-5 sensor using an Arduino board.
```c++
const int sensorPin = A0; // MQ-5 sensor output pin connected to Arduino's analog input A0void setup() {
Serial.begin(9600);
}void loop() {
int sensorValue = analogRead(sensorPin);
float voltage = sensorValue (5.0 / 1023.0);
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
Serial.print(" Voltage: ");
Serial.print(voltage);
Serial.println(" V");
delay(500);
}
```
### Example 2: Digital Output with Raspberry Pi (Python)This example demonstrates how to use the digital output pin of the MQ-5 sensor with a Raspberry Pi board.
```python
import RPi.GPIO as GPIO
import time# Set up GPIO pins
GPIO.setmode(GPIO.BCM)
MQ5_PIN = 17 # Digital output pin of MQ-5 sensor connected to GPIO 17GPIO.setup(MQ5_PIN, GPIO.IN)while True:
if GPIO.input(MQ5_PIN):
print("Gas detected!")
else:
print("No gas detected.")
time.sleep(1)
```
### Example 3: Interfacing with an ESP32 Board (MicroPython)This example demonstrates how to read analog voltage output from the MQ-5 sensor using an ESP32 board with MicroPython.
```python
import machine# Initialize ADC pin for MQ-5 sensor output
adc = machine.ADC(machine.Pin(32)) # ESP32's ADC pin connected to MQ-5 sensor outputwhile True:
sensor_value = adc.read_u16()
voltage = sensor_value 3.3 / 65535
print("Sensor Value: {}, Voltage: {:.2f} V".format(sensor_value, voltage))
time.sleep_ms(500)
```
Note: These examples are for demonstration purposes only. In real-world applications, you should add proper calibration, noise filtering, and error handling to ensure accurate and reliable gas detection.