Introduction: Portable Fine Particle Measurement (Extension)

About: I spent my career in computer networks. Now retired I am interested in topics that work my neurons. I am passionate about home automation and site administration that I host at home. I acquired skills in the f…


  • Addition of a CO2 sensor
  • Improved readability of the program
  • Opening of the program to other types of sensors.
  • This project follows another one already published. It answers questions asked by readers.
  • An additional sensor has been added.

The MQ135 is a sensor for measuring air quality. The MQ135 is sensitive to the main pollutants present in the atmosphere. This sensor is sensitive to CO2, alcohol, Benzene, nitrogen oxide (NOx) and ammonia (NH3).

This sensor was also selected in the context of the Coronavirus outbreak. Indeed, the measurement of the CO2 level in a room can be indicative of poor ventilation. In this place, particles in suspension, carrying the virus, remain trapped. The propagation of the virus is thus facilitated. Measurements carried out in the school environment have revealed the need to ventilate classrooms more often.

This portable model allows you to take it with you and carry out measurements as needed.

In addition, the program has been improved and made more readable.


The original schematic has been modified to add the sensor. A switch has also been added to toggle the display mode (see program description).

The sensor consists of a heating element whose electrical resistance varies according to the presence of CO2 in the atmosphere. The voltage supplied (pin A0 of the sensor) allows the concentration to be recovered.

The value provided is not linear in relation to the CO2 concentration rate. The resulting value must be adjusted (by the program). I will not go into more details, many articles published on the web give more details.


The program has been revised to make it more readable. All the project files are available for download here.

The Arduino library used is the MQUnifiedsensor.h. It is in my opinion the most elaborate.

The "setup" part initializes the SDS011 and MQ135 sensors. For the MA135 a calibration is performed.

Note on the operation of the sensor. To make the measurements reliable a warm-up time is necessary. When the sensor is switched on, the sensor is cold, and the calibration is wrong. To perform an efficient calibration, the sensor should be switched "off" and "on" after a few minutes.

The images above show two types of display. The first one is the one already described in the previous article and dedicated to the SDS011 sensor. The second display is obtained by toggling the switch. The lower part of the display is now dedicated to the MQ135 sensor with visibility of the CO2 measurement history.

The normal value is around 400PPM. The display shows values between 400 and 500PPM to highlight the concentration of confined spaces.

For measurements above 500PPM the display scale can be adjusted in the routine "aff03".


Other sensors are available. These sensors operate on the same principle as the MQ135 sensor.

The scheme can be adapted for the use of several sensors at the same time.

However, the power consumption of the housing must be monitored. The current power consumption is 230mA. With the 800mAh battery the system can operate for up to 3 hours. Battery types 18650 with a capacity of 2000mAh can last much longer.

List of sensors:

  • MQ-3 Alcohol, Ethanol, and fumes
  • MQ-4 Methane (CH4). From 300 to 10000 ppm
  • MQ-5 Natural gas, LPG. From 300 to 50000 ppm
  • MQ-6 LPG, butane. From 200 to 10000 ppm 48
  • MQ-7 Carbon monoxide (CO). From 20 to 2000 ppm
  • MQ-8 Hydrogen. From 100 to 10000 ppm
  • MQ-9 Carbon monoxide, methane (CH4)
  • MQ131 Ozone
  • MQ136 Hydrogen sulfide gas (H2S
  • MQ137 Ammonia. From 5 to 500ppm
  • MQ138 Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde, Hydrogen.
  • MQ214 Methane (from 3000ppm to 20000ppm), LPG and Propane (500ppm to 10000ppm), Butane (500ppm to 10000ppm)
  • MQ216 Natural Gas, Coal Gas, Propane, CH4
  • MQ303A Alcohol, Ethanol, Fumes
  • MQ306A LPG, butane
  • MQ307A Carbon Monoxide (CO)
  • MQ309A Carbon monoxide, flammable gases