0

I'm new here and wondering if anyone has set up an MQ-2 Gas Senson with a Raspberry Pi? I was following this article.

I was able to get the SPI module loaded/working, but when I go to run the Python script I'm only getting:

Current smoke level is 2047

Over and over again, with and without smoke.

I'm starting to think the analog signal into the Pi is necessary even though the MQ-sensor I bought seems to have the digital out already with the MCP chip on-board already. I purchased this one.

So, I connected DO from the sensor directly to GPIO9(MISO) which is what the MCP chips DOUT goes to.

Is there something I'm missing here? Any input would be appreciated.

1

You need an ADC to use the module to its full potential.

All the digital output provides is a high or low signal. The signal will be high if the gas concentration is higher than that selected by the on-board pot position, low otherwise. I.e. you use the pot to set a gas concentration threshold for the digital output line to go high.

  • Ok, so the digital out on the sensor I've purchased is not going to give me the data voltage I need? It seems if it has a DO line, then it has an ADC on board. – jimj May 6 '17 at 18:06
  • It has a comparator circuit which trips the digital output at a level you set with the pot. You can call that an ADC - it's just not very useful unless you are prepared to mark and calibrate the pot positions and sit there twiddling to get the current reading. – joan May 6 '17 at 18:47
  • Thanks Joan for the response.. So, I did try tweaking the pot all the way one direction, and the also the other but still the integer returned is "2047" with and without smoke... Maybe that comparator circuit is not sufficient for the job. – jimj May 6 '17 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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