I already have bmp180 sensor connected to raspberry pi 3b+, now I want to add MQ9 sensor like this https://e-radionica.com/en/mq9-gas-sensor.html

  1. Is connection straight forward like the bmp180?

  2. Second question is how to wire mq9 to rpi with already connected bmp180?

  • "Precision" won't matter much since you will be using the binary HIGH/LOW output as the Pi has no analog input -- but in any case discussions about the precision of specific sensors is more appropriate to our larger sibling site, Electrical Engineering (so I have edited that out).
    – goldilocks
    Commented Oct 30, 2019 at 20:54
  • Do you maybe know how high/low outputs are differentiated? Commented Oct 30, 2019 at 20:56
  • I believe the screw dial (gray circle w/ philips head "X") controls this, but I could be wrong.
    – goldilocks
    Commented Oct 30, 2019 at 20:59
  • @PostarLakogSna, Ah, let me see. Here is my quick and dirty MQ9 Rpi interface summary: (1) MQ9 is a digital guy, can be adjusted by the heating/timing and loading/sensitivity pots/resistors to trigger High logical alarm signal when gas (CO or flammable) leaking, (2) It is not connected to SPI or I2C bus like BMP180 or other sensors, so, no conflict between BMP and MQ work same time, (3) It is easy to connect MQ9 output pin (directly or after logical level shifting, or adding a chip Schmitt trigger chip to prevent false alarm) to Rpi GPIO pin in input mode. In short, - No worries at all! :)
    – tlfong01
    Commented Oct 31, 2019 at 2:09
  • @PostarLakogSna, Please let me know if your MQ9 module is similar to mine: imgur.com/gallery/MqXE3CH. or give me the link of yours (same as in your question?). Perhaps I can try to do some engineering experimentation for. MQ9 is a life critical thing, and I am just a friendly home automation hobbyist, so do ask for a professional opinion! :)
    – tlfong01
    Commented Oct 31, 2019 at 2:33

3 Answers 3



How Can Rpi3B+ Detect MQ9 Gas Sensor's Carbon Monoxide Leakage, Without Using ADC?


  1. Understanding MQ9's Digital and Analog signals

MQ9 has both a Digital and an Analog output signal, as summarized below:

(a) Digital - To detect gas leakage or no leakage, outputting High level 4.8V, or Low, 0.2V, respectively.

(b) Analog - To show gas intensity, outputting voltage in a range of 1.5V to 0.5V.

MQ9 1

  1. Rpi reading MQ9's Digital and Analog Output

(a) Digital - Rpi can use a GPIO pin to read the MQ9 digital output, after converting logical level from 5V to 3V.

(b) Analog - Rpi must first use an ADC (Analog to Digital Converter) to convert MQ9 analog signal to digital, and then read the digital values.

MQ9 2

  1. Calibrating MQ9 to detect Carbon Monoxide CO leakage

Only two simple steps. What you need is only a screw driver. No Rpi or even a multi-meter is needed to calibrate MQ9.

(a) Connect MQ9 to 5V.

(b) Adjust the 10k trim pot (trimming potentiometer), by trial and error, turning screw clockwise and counter clockwise, to locate the threshold triggering point when the alarm red LED turning on and off. Then turn screw a little bit anticlockwise to turn LED off. Now MQ9 is set to clean air.

  1. Testing MQ9's gas leaking alarm function

(a) Place MQ9 and a candle in a glass jar, and light the candle.

(b) After less then 2 minutes, the candle will burn out all the oxygen into carbon monoxide in the jar, and will extinguish, and red status LED will turn on.


  1. Writing a simple python program to read Rpi GPIO connected to MQ9

(a) Use a voltage divider to step down MQ9 5V logical level to 3V

(b) Connect MQ9 3V logical level output pin to any Rpi GPIO pin

(c) Write a simple python read GPIO program to finish off the project.


(1) MQ9 Gas Sensor - CO and Flamable GaSES - eRadionica €6

(2) MQ9 Gas Sensor Learning Notes V1.1 - tlfong01 2019nov04

(3) MQ9 Gas Sensor Testing Notes V1.1 - tlfong01 2019nov04

(4) Fibaro CO Sensor Discussion - StackExchange

(5) Fibaro CO Sensor Features - 100€

(6) ME2-CO Electrochemical Carbon Monoxide Sensor - WinSen Sensor

(7) AliExpress MQx Gas Sensor Catalog


Appendix A - Fibaro CO Sensor Features Summary


Make home safer and prevents danger caused from the ‘silent killer’ carbon monoxide (CO).

The sensor detects reliable carbon monoxide in the air and alarms in case of exceeded limits.

Its high sensitivity allows to detect the presence of the carbon monoxide (CO) gas at the early stage in order to prevent carbon monoxide poisoning.

The device alarms via an integrated siren and blinking LED. Additionally, automatic scenes can be triggered within the Z-Wave gateway and notifications can be sent.

The FIBARO CO Sensor is a life-saving device, therefore tests to conform compliance with the applicable requirements of the standard EN 50291-1:2010 are conducted by the BSI Group accredited testing laboratory. Each sensor is subject to continuous control, which covers routine product testing and the evaluation of manufacturing quality control processes.


CO sensor detects CO concentration in air

Alarm siren,

Alarm signalled with a LED diode

Supports protected mode (Z-Wave network security mode) with AES-128 encryption

May be used as stand-alone carbon monoxide detector

Wireless Technology: Z-Wave Plus

End of answer


The BMP180 is a digital device and connects via the I2C bus.

The MQ9 is an analogue device and produces a variable voltage. It can not be directly connected to the Pi.

You need to connect the MQ9 to an ADC (Analogue to Digital Converter) and connect the ADC to the Pi.

ADCs tend to have an I2C or a SPI interface. The choice is yours.


You can use a Arduino NANO for taking the MQ9 reading. Raspberry pi has no ADC inside so you have to get the value like this. Or use some sort of voltage detector(detects voltage and give us a certain value) that can digitise the values.

  • Ah, I know ADC, but never heard of "volateg detector". What is that?
    – tlfong01
    Commented Oct 31, 2019 at 6:41
  • @tlfong01 sorry my mistake. Read again Commented Oct 31, 2019 at 10:08
  • I see. So your are talking about the "voltage tester", like this: How to Use a Non-Contact Voltage Tester 151,527 views 2015may20 youtube.com/watch?v=IsXu6ukQbZI
    – tlfong01
    Commented Nov 1, 2019 at 2:25
  • 1
    Ah yes, Nano's six 10 bit ADC pins is good a idea to replace ADC MCP3008 or ADS1115. Those Arduino guys should welcome this approach, because no new things need to learn,while MCP3008 is hard to learn. For hobbyist projects, 10 bit resolution, about 1% accuracy should be enough. Other advantages: (1) Arduino shares Rpi's processing and storage loading, (2) Arduino, if using UART TTL serial, can be placed more than 20 metres from Rpi. Moreover, Rpi4B has 5 onboard UARTs and with a USB hub, can setup more USB to serial UART ports, so more flexible and scalable than MCP3008.
    – tlfong01
    Commented Nov 1, 2019 at 6:50

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.