Gas detector based on MQ-2 without microcontroller

 Posted by:   Posted on:    No comments

Nowadays people are using microcontrollers even for blinking an LED. And that is no problem, since they are cheap enough, have low power consumption and are easy to program. But there was a time when microcontrollers were expensive and hard to find. And even then, engineers were building working devices, just smart enough to do the job they were designed for. Let's try to build a "microcontroller-less" gas detector using one of the MQ sensors.

Gas sensors from MQ family are analog tin dioxide detectors which change their resistance in the presence of volatile compounds like gases or smoke. Except MQ-7 and MQ-9 which are designed for carbon monoxide detection and require alternating heater voltage, with analog output being read at the end of each heater voltage cycle, every other sensor may be used in the following circuit.

Gas detector based on MQ-2 without microcontroller
Gas detector with MQ-2 module on breadboard

I/O voltage level shifting: passive down-converters

 Posted by:   Posted on:    No comments

When interfacing various devices to a microcontroller, some kind of voltage conversion is often needed. The most common voltage levels of development boards and modules are 3.3 V and 5 V, yet it is not out of the ordinary to find devices using 2.5 V or even 1.8 V I/O levels. This post will explore some of the available methods of converting I/O voltage levels to ensure compatibility between electronic modules and ICs. When I say compatibility I mean the devices connected together through a level shifter should work as expected and not cause damage to each other.

I began searching information about level shifting after a failed attempt to interface an ESP8266 board (3.3 V I/O) to an array of 74HC595-74HC165 shift registers which were required to be powered at 5 V (therefore they expect 5 V I/O). Without documenting too much, I considered 74HC would recognize high 3.3 V output from microcontroller. But that was not the case as I would soon discover. The next step was to add a MOSFET bidirectional level shifter (the ones which are commonly used for I2C), however strange behavior occurred.

I/O voltage level shifting: passive down-converters

CO and LPG gas sensor with Arduino and LCD

 Posted by:   Posted on:    No comments

In a previous post I looked at a MQ-9 sensor module. Unfortunately, although the sensor can detect CO and LPG, it cannot be used as it is wired in the module. After analyzing the datasheet I figured the best thing to do is remove it from existing PCB and build my own. In short, like other sensors from MQ family, MQ-9 has a heater resistor inside. In order to get any useful reading from it, this resistor must be heated at 5 V for 60 seconds, then cooled at 1.4 V for 90 seconds. The same is true for MQ-7. The issue with modules is that all sensors from MQ family are fitted on the same PCB design.

In this post, I'll share two other methods of powering the heater resistor and I will design a PCB. Sensor readings will be displayed on an alphanumeric LCD powered by Arduino. Since real ppm is temperature and humidity dependent, I will provide a PCB header for DHT sensor. I already tested the sensor with the LM317 power supply I built in the previous post, and I did some measurements.

CO and LPG gas sensor with Arduino and LCD

Influence of temperature and humidity on MQ gas sensors

 Posted by:   Posted on:    No comments

I dedicated some of my previous posts to MQ gas sensors. These devices are cheap and can be bought on PCB modules, which implement a simple comparator circuit in order to provide a digital output. However, the usability of these modules is rather limited, knowing that some of the sensors from MQ family require variable heater voltage. More than this, at power-up the resistance of the sensor is low until the heater reaches working temperature, therefore the comparator output of a sensor module will trigger a false alarm.

Although this is not an important limitation, the modules do not take into account the variation of sensor resistance based on environment temperature and humidity. To do this, a microcontroller must sample the sensor resistance through an ADC and estimate gas concentration. This post continues a previous one in which I estimated gas ppm after extracting sensitivity data from datasheet graphs. However...

Influence of temperature and humidity on MQ gas sensors

Interface MQ gas sensor modules to 3.3V development boards

 Posted by:   Posted on:    No comments

Sensors from MQ family are tin dioxide smoke and gas detectors with analog output. Tin dioxide changes its resistance when exposed to gases, but it has to be heated. This is why these sensors have a heater resistor made of nichrome wire. MQ sensors are not suitable for battery powered devices since the heater requires a lot of current. In a previous post I took an MQ-2 module, changed some resistors on its PCB and interfaced it to Arduino.

Let's explore the possibilities of interfacing such modules to 3.3 V development boards. There are advantages like possibility of IoT integration, higher ADC resolution and more computing power on 32-bit architecture. There is however an... analog issue. When exposed to high concentrations of gas, the voltage across load resistor (RL) will go higher than 3.3 V. This could damage the ADC. We'll see in this post methods of scaling down the output voltage on load resistor.

MQ-2 readings with Raspberry Pi Pico

Compute ppm of MQ sensors from datasheet graphs

 Posted by:   Posted on:    No comments

I tried to connect some of the gas sensor modules I have bought over time to Arduino. Unfortunately, I discovered these modules were not designed properly and require some modifications in order to power sensors according to datasheet specifications. I am using an MQ-2 type sensor for this test and all of the following estimations will be specific for this type of sensor. You can use the same approach to read and process analog input of any of the other sensors from MQ family.

You won't find in any of the available datasheets a direct, clear formula to approximate ppm of a gas based on the sensor resistance. But there are some sensitivity graphs which we can use to find a correlation. To make things even more complicated, for MQ-2 there are two datasheets available, from different manufacturers, with different sensitivity data.

Compute ppm of MQ sensors from datasheet graphs