Occupancy detector using the MQ-135 gas sensor
Is it doable to make an occupancy detector using the MQ-135 gas sensor (datasheet) for a small room by checking if the current CO2 value is (significantly) larger than the base value?


Yes, but you'd realize that it takes time for people to produce enough CO2 for this to work reliable, and for their CO2  to diffuse through the whole room to your sensor, whilst simultaneously diffusing out of the room through every opening, getting absorbed by concrete and so on.

Same about the CO2 levels after people leave.


  Any other fundamental issues?


That sounds like a very um, suboptimal occupancy sensor: uncertain, and delayed by several minutes. Oh, and relatively expensive.

Did you think about drafts of fresh air? What if someone leaves the door open a bit?
The sensor seems to be somewhat sensitive to temperature. Did you take into account that the room you need to watch might be heated (or not), and that you might want to add a thermometer into the mix to be able to compensate for that?


  Apart from connecting 5V and GND, you would connect the analog pin to Arduino as input and to GND with a 20kΩ resistor.


Not quite sure this is really what you need to do (draw a schematic!), but what you need to sense here is the resistance between pins A and B – which you'd often do with something like a constant voltage or current source and a difference amplifier.

Could also just use constant voltage at A and connect B to a resistor and measure the voltage at B, but don't forget that your input pin has non-negligible current consumption, too, so that might or might not be a problem. Consult your specific microcontroller's data sheet ("Arduino" doesn't say which microcontroller you're using).


  Being right most of the time would be good enough. 


Define "most of the time" as a percentage and you've got your detection rate or false alarm ratio, by the way. Detection theory ensues!


  I see no such projects online, so I assume I'm clearly missing something. Especially since occupancy detecting is a tricky subject.


There's just so many other approaches that don't suffer uncertainty and delay as much!


People usually move. PIR sensors are cheap and abundant.
People also aren't perfectly silent. Microphones are cheap and abundant.
People also aren't invisible. Cameras and single board computers are cheap and...


In fact, yes, it is a tricky problem, depending on how certain you need to be. These days, you can even buy radar devices that are optimized for looking for things that move in a typical breathing frequency. That's obviously more for search and rescue purposes, or for intensive care units.

I think a very interesting approach would be to use your Arduino to produce ultrasound (say, at 80 kHz), and send out bursts of that, and look for frequency shifts in the reflection of that – Doppler. You should be able to actually recognize large scale movement at once, and you should be able to detect breathing if you average across multiple measurements.