last day (19 days later) » 

7:16 AM
1
Q: How to connect Rpi to MQ9 Gas Sensor?

PostarLakogSnaI 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 Is connection straight forward like the bmp180? Second question is how to wire mq9 to rpi with already connected bmp180?

 
Do you maybe know how high/low outputs are differentiated?
 
@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! :)
@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! :)
@PostarLakogSna, You might also like to let me know if you wish to measure (1) Digital, (2) Analog, (3) PPM, (4) All above three together. To do analog or ppm, you need an ADC。 For, analog measurement, you can do early warning risk analysis before the red alarm alert trigger level is reached. For ppm, you can also recognize which type of gas is present, and send messages to you android smart phone, indicating level of risk etc. Below is my engineering experimentation log entry: penzu.com/p/93aaa16e This linked engineering experimentation report keeps updating, so stay "tuned" :)
@PostarLakogSna, PPM measurement is interesting. The circuit is not that complicated. You can use the very popular Rpi friendly MCP3008 10 bit SPI ADC (Google AdaFruit or SparkFun for newbie friendly tutorials): Connect MQ9 Load resistor analog output to MCP3008, which in turn is connected to Rpi SPI. You can use colourful LEDs connected Rpi GPIO pins to indicate which type of gas is detected, or LED bars to indicate gas intensity etc . The ppm measurement tutorial: "How to Choose GAS sensor?" - theorycircuit.com. theorycircuit.com/choose-gas-sensor, Happy reading. Cheers! :)
@PostarLakogSna, Now I have skimmed a Gas Detector Hnadbook and got a rough idea of all the detectors work. Now I am coming back the MQ9, a MOS detector. Next step is doing a Rp MQ9 PPM Circuit Analysis and Design. See update of my log book for more details.
 
@tlfong01 sensor is identical to one in the link. What I want to measure is the limit above which I want to trigger some signal. How can I configure this? I mean, having exact value would be nice but I am looking for minimum effort here with minimum additional components needed. I have already connected my temp/press/hum sensor to 5V pin, so there will be some double use. Generally, I would be grateful if you could answer me what I need in order to trigger signal when CO exceeds limit, and what if I measure exact values
 
@PostarLakogSna, This tutorial might help: "MQ2 for Rpi" tutorials-raspberrypi.com/…. I have updated my development notes to V0.3 with this tutorial reference. You can read the tutorial and let me know anything you are confused, and I can explain it as an appendix in my develop notes. Tutorial + comments has example code for MCP3008 and ADS1115, also level shifting to 5V. If you are not familiar with them, you might search "MCP3008", in this forum. I could not find updated refs for Rpi + MQ9. Let me know if you find any.
@PostarLakogSna, Yes, if what you want is a High or Low signal, then you don't need any ADC. You only need to calibrate the sensor, using the adj pot so that it trigger alarm HIgh level signal when the gas. CO, say, reaches a certain level. MQ9 is for CO, Coal, and Liquefied Gas. I don't feel like to experiment with coal or liquid gas. What I can try is CO. Let me see, I can place the MQ9 in a gas jar, and light a candle to see if O2 decreases, CO increases, MQ9 shows anything. I know plenty of physics, but too little chemistry to do such experiments. Perhaps you can suggest anything.
 
@tlfong01 thanks, what do you mean by adj pot? so in this case I don't need any resistors? My intention is to monitor CO only, so no problem about it. I will check all this later and let you know what bothers me
 
7:16 AM
@PostarLakogSna, Ah, "adj pot" means "adjusting potentiometer" (the blue square pot which you can adjust with a small screw driver). For MQ9, it the the variable resistor Rp to adjust the reference voltage of the operational amplifier (OP AMP) comparator producing the digital output. The sensor resistor Rl is another thing. You need to read this tutorial to clarify things: "MQ137 Ammonia Gas Sensor Measuring PPM using Arduino - Aswinth Raj 2018feb09" circuitdigest.com/microcontroller-projects/….
MQ9 schematic: imgur.com/gallery/YLEo8tq. For digital output, what you need to do are: (1) Set the gas (CO) density level to trigger alarm, (2) Turn 10k trim pot CW and CCW to find the trig point. Blue square trim pot sets the reference voltage for the comparator. But you don't need to understand the details, if you are like me, a huge fan of Oliver Heavyside who says: "Should I refuse a good dinner simply because I do not understand the process of digestion?" (Criticized for using formal mathematical manipulations, without understanding how they worked). Bed time. See you tomorrow.
 
One additional question, we are talking here about pure electrical sensor, don't we? Do you know some (electrochemical) sensors suitable for rpi?
 
Well, Rpi only talks electrical, though you can use "transducers" to convert electrical to optical, audio, mechanical, etc. But I don't know nothing much about chemical, ... :)
@PostarLakogSna I googled but could not find any other cheap hobbyist grade CO gas sensor for Rpi. So I will carry on my experiments on MQ9. I looked at the sensor spec penzu.com/p/93aaa16e Appendix E, and found two potential problems (1) the sensor resistance (Rs/R0) vs ppm is log scale rather than linear. This means that slight variation in concentration might mean big variation is resistance.
(2) sensor resistance varies with temperature. So now I am going to calibrate and see if it is a serious problem.
 
 
5 hours later…
12:31 PM
I have more or less finished learning the MQ9 gas sensor. It is more complicated than I thought. I have compiled a learning notes: V0.9 penzu.com/p/93aaa16e
Next step is calibration and testing. The first step is to find R0, the initial sensor resistance in clean air. The second step is to measure the CO gas concentration. Both steps are complicated. Therefore I do not recommend you to spend much time to try to understand my learning notes, because they are now unstructured. I need to tidy up before submitting it to the forum as part of my answer to your question.
Now I am going to do the calibration and measurement. Again do not try to understand everything I am doing. It is enough just to get a rough picture. Again, I will tidy up my calibration and measurement procedure before submitting to the forum. This part might take me a couple of days. Cheers.
 

  last day (19 days later) »