Skip to main content

Command Palette

Search for a command to run...

How to connect MQ135 to other sensors?

Updated
2 min read
How to connect MQ135 to other sensors?

To connect an MQ135 gas sensor with other sensors to your microcontroller (e.g., STM32, Arduino, ESP32), you essentially build a multi-sensor system where each sensor's signal is read through different GPIO or ADC channels. The MQ135 is an analog gas sensor (sometimes with a digital threshold output), so it's easy to integrate with others.


1. Understand the MQ135 Sensor

PinDescription
VCCPower supply (typically 5V)
GNDGround
AOUTAnalog output (gas level)
DOUTDigital output (threshold set via onboard potentiometer)

2. Basic Wiring with Other Sensors

Example: MQ135 + DHT11 (temperature) + Hall Sensor

SensorSignal TypeConnect To
MQ135AnalogADC pin (e.g., A0)
DHT11DigitalGPIO with pull-up
HallDigitalGPIO (interrupt or poll)

Wiring Example:

plaintext

[ MQ135 ]    --> A0 (analog input)
[ DHT11 ]    --> D2 (digital GPIO)
[ Hall ]     --> D3 (digital GPIO or interrupt)
[ GNDs ]     --> Common ground
[ VCCs ]     --> 5V (if all support it) or use level shifters

Important: If you're using a 3.3V microcontroller (e.g., ESP32, STM32), and the MQ135 is 5V-only, use a voltage divider or level shifter on the analog line.


3. Power Considerations

  • MQ135 consumes ~150 mA during warm-up – don’t power it from a weak GPIO pin.

  • Ensure your 5V rail (e.g., from USB or regulator) can handle total current for all sensors.


4. Reading Sensor Data in Code

Example in Arduino-like pseudocode:

cpp

int mq135_value = analogRead(A0);
int hall_value = digitalRead(D3);
float temperature = dht.readTemperature();

5. Timing & Sampling

  • MQ135 needs a few minutes warm-up for stable readings.

  • Avoid reading all sensors at once—use timers or delays to balance CPU load.


Summary

SensorOutput TypeConnect To
MQ135AnalogADC pin
MQ135DigitalGPIO (optional)
OthersAnalog/DigitalADC or GPIO
  • Use shared GND and 5V (or 3.3V) rails

  • Don’t overload ADC channels — 1 analog sensor per ADC pin

  • Use voltage dividers if interfacing 5V sensor with 3.3V MCU

More from this blog

A

Ampheo Electronic Blog-Chip and component knowledge sharing

181 posts

Original and Genuine Electronic Components Distributor