0
\$\begingroup\$

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?

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

I understand that it needs 48 hours to burn in before a first use, and 10 minutes after re-use, during which time the device would be and remain in that room.

Wouldn't it be possible to use a digitalRead() on Arduino to establish the average base value after those 10 minutes, during for instance 20 minutes, and then alerting if the current value is, say, 10% higher? The percentage could be empirically established.

Being right most of the time would be good enough.

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

Is it not precise enough? If the value would fluctuate between 100 and 150 if the room is empty, it might not be possible to adequately compare with somebody actually being in the room.

Any other fundamental issues?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Not quite sure this is really what you need to do (draw a schematic!) There's a schematic in the datasheet. But OP could of course show that in the question. \$\endgroup\$
    – Huisman
    Commented Jan 2, 2020 at 12:57
0
\$\begingroup\$

CO2 is denser than air so would sink but most occupancy sensors are located in the ceiling to get the best view of the room. (It's also easier to hide the cables in dropped ceilings than to have to channel out walls, and is closer to the lighting being controlled, if that's the application).

But I would say the main disadvantage is response time to trigger (off to on) even if draughts were not a problem. This will vary enormously for different sized rooms. Most occupancy sensor applications require response times no more than a very few seconds.

\$\endgroup\$

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.