Does Smoke sensor MQ-135 need to be connected to ADC if it has separate pin for analog and digital outputs? I'm about to interface it in raspberry pi.

  • What does your research so far suggest? In particular what does the analogue pin tell you and what does the digital pin tell you? – joan Dec 10 '16 at 10:42

The analog pin will give a level reading depending on 'how much' smoke is surrounding the sensor. Analog cannot be read directly by the Raspberry Pi so, yes, to get that kind of reading, you will need an analog-to-digital converter chip such as the MCP3008. There are several tutorials online for using it. I recommend either http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/ if you want to get really low-level or alternatively, take a look at http://raspi.tv/2016/using-mcp3008-to-measure-temperature-with-gpio-zero-and-raspio-pro-hat if you want a higher-level 'easier' way to read the MCP.

The digital pin will be a 'threshold' indicator. i.e. A certain amount of smoke will change the digital output from 0 to 1. There's probably a little trimming potentiometer onboard to control the threshold.

| improve this answer | |

MQ135 gives analog Output, raspberry pi doesn't have any analog input so you will need an external ADC. get an external ADC with inbuilt amplifier. I will say look into ADS1115. the other option is to go with an MQ135 sensor which comes with an on board Analog chip. So this will be the best way to go. you can look into this MQ135 gas sensor this one comes with I2C, so its easy to use and no need to use an external amp. IF you are looking for sample code and wiring diagram then you can check this article on github. MQ Gas Sensor code

| improve this answer | |
  • I just wanted to detect if smoke is present by determining its rising edge. Here is the nearest reference I've found so far with code, knight-of-pi.org/…. But after I execute the code, it prints 'alive' but could not detect smoke at all. I've already adjusted the trimmer resistor. Here is the smoke sensor I'be bought circuit.rocks/gas-sensor-mq135?search=mq135 – eMM Dec 20 '16 at 8:11

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.