Combining TCS3200, MQ-9, and MQ-135 Sensors on ESP32 for Water & Air Quality Monitoring

Hello Arduino Forum :waving_hand:,

I’m currently working on a water and air quality monitoring system using an ESP32. In this project, I want to combine a TCS3200 color sensor with MQ-9 and MQ-135 gas sensors.

  • TCS3200 → to read water color (e.g., clear, cloudy, brown, or black).
  • MQ-9 → to detect CO/flammable gases.
  • MQ-135 → to detect air quality (harmful gases like NH₃, CO₂, smoke, etc.).

My goal is to build a simple monitoring system that can:

  1. Read water color values from the TCS3200.
  2. Read gas values from MQ-9 and MQ-135 simultaneously.
  3. Combine all readings into a single output (for example, displayed on the serial monitor or LCD).
  4. (Future plan) Send the data to a database/website for further processing.

Hardware I’m using:

  • ESP32 DevKit v1
  • TCS3200 color sensor
  • MQ-9 and MQ-135 gas sensors
  • Breadboard + jumper wires
  • Arduino IDE

My questions are:

  1. Has anyone here ever tried combining the TCS3200 with MQ gas sensors?
  2. Are there any specific issues to consider, such as possible interference (since MQ sensors heat up, while TCS3200 is light-sensitive)?
  3. For MQ-9 and MQ-135 readings, should I mainly focus on relative changes rather than absolute PPM values?
  4. Does anyone have a simple example code for reading these three sensors simultaneously with an ESP32?

Thanks in advance :folded_hands:. I hope this discussion can also help others who are trying to integrate color and gas sensors in one system.

I have not seen a color sensor used this way but reading these few sensors will be no problem. I would recommend reading the tutorials in the forum re 'How to do multiple things at the same time', and state machines.
If you read the sensor's absolute value, then your code can convert to anything you want. If you only capture relative, then you can not.
Normally, a library for reading the sensors will have example code.

1 Like

Powering the sensors will be your first challenge.
You might need an external 5volt/1A supply.
The gas sensors draw about 150mA each and need a stable supply.
Leo..

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.