meta data for this page
LamaPLC: MQ Winsen Gas-sensors
Winsen's MQ series gas sensors are low-cost, semiconductor-type (chemiresistive) sensors designed to detect a wide range of gases, including flammable gases, alcohol, and smoke. Each model is tailored to detect specific gases or a range of gases.
- Operating Principle: The sensors use a sensitive material (typically SnO2 semiconductor) and a heating element. The sensor's conductivity varies with air-gas concentration, enabling measurement using a simple voltage divider.
- Voltage: They operate on a standard 5-volt DC power supply.
- Low Cost: A major advantage is their affordability, making them popular for a wide variety of civil and industrial applications, including smart homes and IoT projects.
- “Burn-in” Time: A “burn-in” period of 12 to 24 hours is often recommended to improve measurement accuracy.
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.
Arduino
Interfacing the MQ-135 air quality sensor with an Arduino can be done either by reading raw analog signals or by using a dedicated library to obtain calibrated PPM (parts per million) readings.
Arduino wiring
| MQ-135 | Pin | Arduino Pin | Description |
|---|---|---|---|
| VCC | 5V | Power supply (the sensor has a built-in heater) | |
| GND | GND | Ground | |
| AOUT / AO | A0 | Analog output (voltage level based on gas concentration) | |
| DOUT / DO | D2 (Optional) | Digital output (goes high/low based on threshold) |
Arduino code
This code provides a raw reading from 0 to 1023, which is useful for basic threshold detection (e.g., triggering a fan or an alarm).
int sensorPin = A0; // Select the input pin for MQ-135 void setup() { Serial.begin(9600); // Initialize serial communication } void loop() { int sensorValue = analogRead(sensorPin); // Read analog value (0-1023) Serial.print("Raw Air Quality Value: "); Serial.println(sensorValue); delay(1000); // Wait 1 second for next reading }
This page has been accessed for: Today: 1, Until now: 23









