Connecting the MQ3 with the Raspberry Pi 3B+

Thread Starter

cloner7

Joined Dec 5, 2019
3
Hello experts!

I do not know if my problem fits into the category, I am sorry if it doen't.

I am totally new to electronics and I need help with connecting the MQ135 Gas sensor with my raspberry pi 3B+ and with interpreting the data that the sensor provides. My main problem is that the sensor provides analog signals and the RPi 3B+ does not have a pin for analog signals.

Therefore I bought an ADC (ADS1115) with 16bit precision. I followed the following guide to read the data from the ADS1115 via python libraries on the RPi:

https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/ads1015-slash-ads1115

This way I can monitor the provided values from the analog inputs (AIN0 - AIN4). I do not understand what I am actually reading. The values fluctuate and with the GAIN parameter in the python script set to1 I get values in the range of 3000-5000 (but nothing is connected to the analog inputs of the ADC - so why do I see values at all?).

When I connect the AOUT pin of the MQ135 with AIN0 of the ADC the values from every analog input (AIN0 - AIN4) change - shouldn't only the value from AIN0 change?

The scheme of the breadboard is attached.

In the scheme it says that it is the MQ9 - but I am using MQ135. The brown cable connects the analog out pin of the MQ135 with the AIN0 of the ADS1115.
The yellow calbe of the MQ135 is VCC and the orange cable is GND.

My questions:

1. Should I change something on the breadboard?
2. How should I interpret the data that the ADS1115 is providing?
3. Why is the ADS1115 reading signals when nothing is connected to AIN0 - AIN4?

I would also be very thankful if someone could maybe show me some sources which would help me to make further research.

Thank you!
 

Attachments

Reloadron

Joined Jan 15, 2015
7,501
Starting with the MQ135 Gas Sensor take a look at Figure 2 of the first page. The heater in the sensor will draw different current depending on the atmosphere it is in. The idea of Rl (R Load) is to develop an analog voltage somewhat proportional to the concentration of certain gasses in the atmosphere. While I have not worked with the Pi or the ADC you are using I would think you need a Rl resistance to create a voltage at the input A0 of the ADC you are using. My experience with "sniffers" like this were to detect explosive gasses and we calibrated them using known explosive gas samples (standards). The charts in the linked data sheet show what should be expected for a given Rl and gas concentrations.

Ron
 

Thread Starter

cloner7

Joined Dec 5, 2019
3
Thank you for your quick response!
I found out why the other unconnected AIN Pins of the ADC are providing values. This is seemingly noise that I got rid of after connecting those pins to GND of the Pi.
Could you please explain why I need a resistor to create a voltage at A0 of the ADC?
As soon as I connect the MQ3, the value of the AIN0 pin changes - so something is happenig :D

What bugs me is that the value that the Pi reads from the ADC is fluctuating extremely. It goes from 100 to 13.000 and back, without me doing anything. Is it possible that the sensor is broken or that my circuit is somehow wrongly created?
 

Reloadron

Joined Jan 15, 2015
7,501
I should have mentioned that with any A/D conversion that any unused inputs should be tied to ground as they pick up noise but you got that taken care of.

As to the MQ 135 and the entire family of MQ sensors. The following is taken from the data sheet.
"SENSITVITY ADJUSTMENT Resistance value of MQ-135 is difference to various kinds and various concentration gases. So,When using this components, sensitivity adjustment is very necessary. we recommend that you calibrate the detector for 100ppm NH3 or 50ppm Alcohol concentration in air and use value of Load resistance that( RL) about 20 KΩ(10KΩ to 47 KΩ). When accurately measuring, the proper alarm point for the gas detector should be determined after considering the temperature and humidity influence".
They want a load out there. The MQ family of sensors are not quite accurate precision devices. They output a small current if I recall correctly. The gas sensor module consists of a steel exoskeleton under which a sensing element is housed. This sensing element is subjected to current through connecting leads. This current is known as heating current through it, the gases coming close to the sensing element get ionized and are absorbed by the sensing element. This changes the resistance of the sensing element which alters the value of the current going out of it. So the sensor is a current type device, the AI (Analog In)of your A/D converter uses a voltage input. The voltage input is developed across Rl (Resistance of Load). Personally I would use a 50K Ohm 10 turn trimmer pot and then using a known gas or alcohol vapor sample measure the pot Vout to calibrate things. The data sheet for the sensor provides some basic curves to work from. Give the sensor a load as in the data sheet and then measure the voltage drop across the load, in ambient air it should be stable and make sure the 5 Volt sensor power excitation (heater voltage) is stable.

Ron
 

Thread Starter

cloner7

Joined Dec 5, 2019
3
You do really help me.
I would use a 50K Ohm 10 turn trimmer pot and then using a known gas or alcohol vapor sample measure the pot Vout to calibrate things
This trimmer pot is a adjustable resistor right? Does it matter where I put it? Sorry for these basic questions... :D
And I wrote about the high fluctuations. I am testing this circuit in an usual room. Could a missing calibration be the cause for these fluctuations?
 

Reloadron

Joined Jan 15, 2015
7,501
Yes, the trimmer pot is an adjustable resistor, I suggest 50K configured just like in Figure 2 of the data sheet.

Again, ambient air really will not show much and again these are not exactly high lab grade sensors. The only way to actually get usable data is to calibrate the sensor as they mention in the data sheet using a known gas mixture. Calibrated gas mixtures are expensive and generally available from chemical or industrial supply houses.

Ron
 
Top