I have MH-Z14 Carbon Dioxide sensor and have been using it to try and detect when a room may need some fresh air. But, I've also noticed that the sensor reading drastically increases when a human is present in a room and especially if close to the sensor itself.

I am wondering if anyone tried to use the current CO2 value in a room to detect an approximate number of people in a room and how possible and accurate could it be?


2 Answers 2


@jsotola's comment (Something like: "Sounds like something machine learning could do") is probably the right answer, but I'll expand on it a little.

It's going to depend on at least the following factors:

  • Size of the room
  • Number of people
  • Type of activity the people are doing
  • Amount of ventilation the room has (windows/ac/...)
  • Accuracy and response time of the sensor used
  • Number and position of sensors

I have used data from a CO2 sensor to roughly estimate room occupancy in the past for a single room, I didn't end up going down the machine learning route at the time, rather using things like the rate of change CO2 to give an indicator (more people the quicker the value went up). But if I was doing it again I probably would start gathering data to use as training material.

It might also be worth fusing the data with another sensor, e.g. a relative humidity sensor as this is also likely to increase at the same time.


It appears some research has been done on this already – Sensing by Proxy: Occupancy Detection Based on Indoor CO2 Concentration describes a model developed at the University of California, Berkeley to detect occupancy based on CO2 concentration.

We propose a link model that relates the proxy measurements with unknown human emission rates based on a data-driven model which consists of a coupled Partial Differential Equation (PDE) – Ordinary Differential Equation (ODE) system.

Their model is apparently more accurate than other machine learning models they tested:

The inference of the number of occupants in the room based on CO2 measurements at the air return and air supply vents by sensing by proxy outperforms a range of machine learning algorithms, and achieves an overall mean squared error of 0.6569 (fractional person), while the best alternative by Bayes net is 1.2061 (fractional person).

Algorithm 1 (p. 3) in the paper may give some direction on how to implement a similar system to theirs, which seems to be surprisingly reliable given the simplistic nature of the CO2 sensor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.