To come in
Sewerage and drainpipes portal
  • Famous types of mustache in men: all about manhood
  • "Mix, but do not stir"
  • Do you need to be an erudite to become successful
  • 100 best snipers in history
  • Daily Fat Rate Animal Products
  • Symbols of Satanism (12 photos)
  • Alcohol vapor sensor mq 3 application schemes. Alcohol concentration tester for AVR

    Alcohol vapor sensor mq 3 application schemes. Alcohol concentration tester for AVR

    A breathalyzer or breathalyzer is an electronic device used to measure the alcohol concentration in a sample of exhaled air from a person. From these data, the amount of alcohol in the subject's blood is determined. This device is commonly used by traffic police and medical personnel. However, it can also be useful for motorists to adequately assess their own condition.



    Breathalyzer can be bought, although not everywhere, and they are not cheap. Therefore, it makes sense to make a breathalyzer yourself based on the Arduino board, which is popular among radio amateurs.


    A homemade breathalyzer is quite easy to assemble. It mainly consists of Arduino board and MQ-3 alcohol sensor. To indicate the concentration of alcohol in the air exhaled by a person, ten LEDs are used. They are connected in series with 220 Ohm resistors to limit the current. These LEDs with resistors are connected to the digital port of the Arduino (lines D0-D9). The connection diagram of the components of a homemade breathalyzer is shown in the figure below.



    A few words here should be devoted to the MQ-3 sensor. The MQ-3 is the alcohol sensor shown in the image below. It is used to estimate the amount of alcohol present in exhaled breath. This sensor is specifically designed to detect alcohol, therefore it is very sensitive in this regard and reacts quickly to alcohol. This sensor can also detect gasoline, but its sensitivity to benzene is very low. The MQ-3 has 6 contacts, of which two are used to activate the heater, and 4 contacts provide power and signal transmission. The heater provides the required operating condition.



    The AD0 pin of the MQ-3 sensor module connects to the analog input A0 from which we are going to read the alcohol concentration information. The sensor sensitivity is adjusted using a variable resistor installed on the MQ-3 sensor module board.


    Below is the code (sketch) for the operation of a homemade breathalyzer based on Arduino.


    const int analogPin \u003d 0; // to read data from the MQ-3 sensor const int totalLed \u003d 10; // number of LEDs for indication int ledPins \u003d (11,10,9,8,7,6,5,4,3,2); // pins connected to LEDs void setup () (for (int currentLed \u003d 0; currentLed< totalLed; currentLed++) { pinMode(ledPins, OUTPUT); // линии для светодиодов работают на выход }} void loop() { int sensorReading = analogRead(analogPin); // считывание данных с датчика int ledLevel = map(sensorReading, 500, 1023, 0, totalLed); for (int currentLed = 0; currentLed < totalLed; currentLed++) { if (currentLed < ledLevel) { digitalWrite(ledPins, HIGH); } else { digitalWrite(ledPins, LOW); } } }

    Many people know that traffic police officers, in cases of suspicion of alcohol use, use a certain unit, about which they say "blow into a tube." Today we will try to make an analogue of such a device based on the MQ-3 sensor, only it is not worth using it as a reference in such a situation, since not only alcohol vapors, but also vapors of gasoline, methane and hexane, are in the region of its sensitivity. he has less sensitivity to gases, the maximum response is only to alcohol. In addition, there is one more rake - the sensor readings are also dependent on external factors, such as temperature, humidity. In the case of a serious approach to the use of an alcohol tester, it is worth compensating for these factors. In general, the scope of the control of the degree of alcoholic intoxication is not limited, I do not know why this MQ-3 sensor was developed at all, but they can be used in places where it is necessary to control the concentration of such a gas in the air, for example, when transporting alcoholic beverages, such a sensor will give a signal and damage to the batch of products (if the bottle breaks, the alcohol will begin to evaporate and fill the space with vapors, as soon as the limit is reached, the sensor will work and give an alarm to the driver or someone else), or in a production that requires alcohol consumption, if the consumption is exceeded, the concentration in air will rise and the sensor will work, giving a signal and a decrease in consumption, and so on, so alcohol is needed in the production of perfumery. As usual, the application is limited only by the imagination of the engineer.

    So the sensor itself looks like this:

    The sensor has 6 terminals: the H terminals are the filament (made of Ni-Cr), the A and B pairs are the sensor signal output.

    The sensitive layer for alcohol vapor in this sensor is tin oxide, and the electrodes are made of gold and platinum. Speaking of the price of the sensor, this parameter significantly depends on the materials required for the manufacture of the sensor.

    MQ-3 sensor parameters:

    • heating coil supply voltage - 5 volts
    • sensor supply voltage - 5 volts
    • heating coil power - up to 750 mW
    • heating coil resistance 33 Ohm + -5%
    • vapor detection area by sensor - 0.05 mg / l - 10 mg / l
    • current consumption - about 150 mA

    Before fully using the sensor in the circuit, it must be warmed up for 24 hours by connecting 5 volts to the heating coil. This is necessary to stabilize the sensor readings (apparently, chemical processes are stabilized after the manufacturing process). And thus, before using the sensor, it needs to be slightly warmed up. The subsequent warm-up cycle after the 24 hour period can be shortened to one minute. In the process of work just for a reason heating element the sensor may be warm or slightly hot - this is normal.

    The design of the sensor is a kind of housing with leads on the bottom and a mesh on top. Through the mesh, alcohol vapors enter the sensitive element, where a chemical reaction takes place, converting a physical quantity into an electrical one. In fact, the sensitive element is shielded only by a mesh from the outside world, therefore the sensor as a whole is also sensitive to physical contamination by dirt, dust, and so on (apparently, this is why devices a la "blow into a tube" are equipped with just a tube to interact only with the subject's breath, excluding external pollution, including gas).

    The MQ-3 sensor can be purchased either separately, only one sensor, or as a module equipped with a comparator. The cost of such a thing can vary from $ 3 and more, depending on the mood of the seller. The sensors can be found on the aliexpress and ebay online marketplaces.

    In addition to the MQ-3 sensor, the module is equipped with a comparator, a trimming resistor for adjusting the threshold of the comparator and an LED at the output of the comparator chip to indicate that the threshold has been reached. The module has power leads, a comparator output lead, and a lead directly connected to the sensor output.

    Before starting to consider the circuit of the concentration detector, it is necessary to note the fact that the sensor readings must be calibrated before use. Why? When connected to a power supply, the sensor will give a proportional signal level at the output depending on the alcohol content in the air. So in order to determine how this proportion is balanced (how many volts are there per concentration, say in 1 mg / l), it is necessary to give the sensor exactly such a concentration (or another) and determine the ratio. Then use this factor to convert the sensor readings to numbers. Without calibration, accurate data can be obtained only at random or to take character readings there are alcohol vapors, there are none, there are many of them, there are few of them, that is, to determine "by eye".

    So, let's get down to the scheme of the alcohol vapor tester:

    The circuit is based on an Atmega8 microcontroller. This microcontroller can be used both in the DIP-28 package and in the SMD version in the TQFP-32 package. Resistor R4 is necessary to prevent the microcontroller from restarting spontaneously in the event of random noise at the PC6 pin. Resistor R4 pulls up the plus of the power supply to this pin, reliably creating a potential across it. A liquid crystal (LCD or LCD) display is used for indication. I used a large 2004 display (4 lines of 20 characters), but all the information will fit on the 1602 display (2 lines of 16 characters), with this calculation the firmware was written.The variable resistor R2 is needed to adjust the contrast of the characters on the display. By rotating the slider of this resistor, we achieve the clearest readings for us on the screen. The LCD backlight is organized through the "A" and "K" pins on the display board. The backlight is switched on through a current limiting resistor - R1. The higher the denomination, the dimmer the display will be backlit. However, this resistor should not be neglected in order to avoid damage to the backlight. The operation of the circuit provides for the operation of the ADC module of the microcontroller, therefore, to power it, an inductor L1 and a capacitor C4 are needed to ensure the stable operation of the module - filtering power noise. Resistor R6 is needed to limit the current passing through the LED. By the way, the LED can be replaced with another device or an electrical circuit that is triggered when the concentration limit for alcohol vapors is exceeded, set using the S3 and S5 buttons. The adjustment interval for this parameter is plus or minus 0.05 mg / l per button press. Resistor R8 also limits the current through the heating coil of the MQ-3. This slightly reduces the maximum current through this coil and increases the reliability of the circuit. The signal from the alcohol sensor goes to the ADC input of the microcontroller, which continuously monitors the potential at this pin. Further, in the microcontroller, the ADC value is converted into voltage and alcohol concentration, taking into account the calibration coefficients (they can be set using the S2 and S4 buttons).

    The manufacturer promises a more or less linear characteristic of the MQ-3 sensor readings. This simplifies calibration, you only need to enter two factors to correct the readings. For this, we will use a simple school formula y \u003d k * x + b, where y is alcohol concentration, x is the voltage from the sensor, b is the shift of the operating range (at zero concentration, the voltage will always be greater than 0), k is the voltage-to-concentration conversion factor. The k-factor is the biggest problem, because it can be set either out of your head, or by a sensor signal from a reference concentration source. Both factors can be set using the buttons on the device. Calibration for b should be performed at a concentration of completely zero at rest, when pressed, the coefficient b will be saved and subtracted from the current value, so at zero concentration the screen will display a value of zero, and not any small value (or not very small). The coefficient k sets the ratio of voltage to alcohol concentration, that is, how many volts the concentration of 1 mg / l will have. It is at this value that the device should be calibrated (of course, it is possible to calibrate at a different concentration, but then this must be provided for in the microcontroller firmware).

    1. current ADC value of the microcontroller
    2. voltage calculated taking into account the factor b (initially when switched on b \u003d 0, must be calibrated before each use)
    3. concentration limit value set by device buttons
    4. alcohol concentration value in mg / l recalculated through stress taking into account the coefficient k

    The whole circuit will consume about 200 mA or more, therefore, in order not to heat the air, it is proposed to use a switching voltage regulator on the MC34063 microcircuit. However, any other stabilizer or stabilizer microcircuit can be used in accordance with its connection to the circuit.

    All resistors in the circuit can use a power of 0.25 W or standard size 1206 in SMD version.

    The circuit was assembled on a breadboard for an Atmega8 microcontroller:

    On the breadboard, the MQ-3 sensor is connected to a separate 5 volt power supply from another USB port on the computer.

    Although the alcohol vapor sensor module is used as a module, only the pin connected directly to the MQ-3 sensor itself is used. Nothing but him is no longer used in the module.

    To program the microcontroller, you need to know the fuse bit configuration:

    The article is accompanied by firmware for the microcontroller, documentation for the MQ-3 sensor, a draft (version 8) (the sensor is replaced with a potentiometer to change the readings and track them), as well as a short video demonstrating the operation of the device (when a bottle of alcohol is brought to the sensor, the readings begin to change and when the limit is reached, the LED lights up, then the bottle is removed and the readings begin to decrease, however, due to the inertia of the sensor, the readings decrease rather slowly, especially approaching zero).

    List of radioelements

    Designation A type Denomination amount NoteScoreMy notebook
    IC1 MK AVR 8-bit

    ATmega8

    1 Into notepad
    IC2 DC / DC pulse converter

    MC34063A

    1 Into notepad
    VD1 Schottky diode

    1N5819

    1 Into notepad
    U1 Gas sensorMQ-31 Into notepad
    C1, C4, C5 Capacitor0.1 uF3 Into notepad
    C2 100 uF1 Into notepad
    C3 Capacitor220 pF1 Into notepad
    C6 Electrolytic capacitor1000 uF1 Into notepad
    R1 Resistor

    22 ohm

    1 Into notepad
    R2 Trimmer resistor10 kΩ1 Into notepad
    R3 Resistor

    0.3 ohm

    1 Or somewhat in parallel Into notepad
    R4 Resistor

    10 kΩ

    1 Into notepad
    R5 Resistor
    Answer

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry "s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five http://jquery2dotnet.com/ centuries , but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.



    The MQ-3 alcohol content sensor is used in this project. Thanks to the sensor board, you can connect the MQ-3 to an Arduino microcontroller to determine the ppm level from your breath.

    The sensor outputs an analog signal (usually interpreted as numerical values \u200b\u200bfrom 150 to 1023, depending on the duration of the sensor heating), which is processed and interpreted by the Arduino software code, with the possibility of calibration.

    Assembling the device
    When connecting the MQ-3 to the board, take into account that the polarity of the MQ-3 does not matter. Both terminals A are the same as terminals B. The center terminals on both sides are heating element terminals. The sensor circuit operates from a + 5V DC voltage source.


    Note: The MQ-3 may become hot and even give off an odor when first used. It's quite normal.

    Calibration: If you take your time, you can find out which numbers correspond to percentages and even to the concentration of alcohol in the blood in the case of an alcohol-breathing tube.

    Of course, you need to calibrate the MQ-3 sensor based on the sensor readings calculated by the Arduino programming code, as these can change. For calibration, you can use an isopropyl alcohol bottle to obtain different percentages during testing. Do not immerse the sensor in alcohol! Just let the alcohol vapor onto the sensor and take a reading.

    When I had an Arduino kit, in search of an object for automation, I somehow thought of myself that it would be nice to receive information about whether the CO (carbon monoxide) level is dangerous in the winter in the boiler room of a country house. On cold winter days and especially nights, gas equipment works intensively and burns natural gas to keep the house warm. What if my ventilation is poor? Or is a felt boot stuck in the pipe? And every time I enter the boiler room and stay there for some time, I put my precious life in danger. And no one is insured against natural gas leaks either. Here, in general, you can blow up half a house by simply turning on the light. It would be good to control them too and somehow track them.

    Therefore, it was decided to assemble a system for monitoring the level of CO and methane in the air of a boiler room based on an Arduino or a compatible board. In addition to simple signaling, I would also like to collect statistics, for example, on how the concentrations of hazardous gases are related to the operation of gas equipment. In principle, the task is implemented at the modern level of culture and technology, and for very little money. As a source of natural gas consumption, I used pulses from the built-in gas meter sensor, and for air analysis I used two sensors MQ-4 and MQ-7, which are extremely popular among Arduino developers. The MQ4 sniffs the air for methane and the MQ7 measures CO.

    But in order to go further, it turned out that it was necessary to delve into the details. Since few Arduino users and analogs understand what kind of sensors they are MQ-4 and MQ-7, and how to use them in general. Well, let's slowly start a fascinating story.

    What is ppm

    In order to properly operate with the values \u200b\u200bthat I will give below, you need to understand the units of measurement for yourself. In our country, on the territory of the former Soviet Union, it is customary to measure indicators in percent (%) or directly in weight to volume (mg / m 3). But in some foreign countries, it uses such an indicator as ppm.

    The abbreviation ppm stands for parts per million or loosely translated "parts per million" (it's good that pounds per gallons and imperials for fathoms are not used here). In principle, the indicator does not differ much from the percentage, or rather, only the dimension differs. 1 ppm \u003d 0.0001%, respectively 3% \u003d 30.000 ppm.

    Conversion from percent or ppm to mg / m 3 is already more difficult, here you need to take into account the molar mass of the gas, pressure and temperature. In general, the conversion formula is as follows: P x V M \u003d R x T, where P is the pressure, V M is the molar volume, R is the universal gas constant, and T is the absolute temperature in Kelvin (not Celsius or Fahrenheit). But in order not to torment the reader with a school chemistry course, I will immediately give several meanings. And the most experienced Internet drillers can find online calculators for self-calculation in the vastness of the great web.

    CO: 3% \u003d 30.000 ppm \u003d 34695.52 mg / m 3
    CO 2: 3% \u003d 30.000 ppm \u003d 54513.22 mg / m 3

    Data are based on normal atmospheric pressure and room temperature. Note that CO 2 at a comparable percentage is almost twice as heavy as CO. Let me remind you that the CO 2 molecule contains one more atom, hence the difference. And precisely because of this difference, CO 2 accumulates in the lowlands, and CO at the ceiling.

    The difference between CO and CO 2

    First, you need to figure out what CO is and how it differs from CO 2. First, CO is carbon monoxide, also called carbon monoxide, carbon monoxide or carbon (II) monoxide. CO gas is very insidious. It is extremely poisonous, but it has neither color nor smell. Once in a room with carbon monoxide, you will only by indirect symptoms understand that you are being exposed to poison. First a headache, dizziness, shortness of breath, palpitations, then a blue corpse. Carbon monoxide combines with blood hemoglobin, which makes the latter stop carrying oxygen to the tissues of your body, and the brain and nervous system are the first to suffer.

    Secondly, carbon monoxide is an excellent fuel and can burn just like other combustible gases. At certain concentrations, it forms an explosive mixture, which is ready to smash into chips any volume where gas has accumulated mixed with oxygen. Yes, carbon monoxide is lighter than air, so it actively penetrates the second, third and subsequent floors of buildings.

    The main source of CO emission, oddly enough, is the combustion of carbon fuel with insufficient oxygen. Carbon "does not burn out" and instead of carbon dioxide CO 2, carbon monoxide CO is emitted into the atmosphere. In the everyday sense, wood-burning stoves, gas burners, gas boilers and other heating equipment operating on carbon fuel can be an excellent source of CO, if used improperly. Do not forget about cars, in the exhaust of a gasoline engine CO can be up to 3%, and according to hygiene standards, it should be no more than 20 mg / m³ (about 0.0017%).

    In general, carbon monoxide is an insidious thing and easily obtained. It is enough to clog the chimney and you can safely go to the forefathers, having melted the stove for the night.

    CO 2, also known as carbon dioxide, carbon dioxide, carbon dioxide, carbon monoxide (IV) or simply carbonic anhydride, is no less interesting gas. We meet carbon dioxide much more often in everyday lifethan with carbon monoxide. We drink carbonated water in which carbon dioxide is dissolved. We use dry ice to preserve ice cream in the park on a hot summer afternoon, and finally we breathe out crazy amounts of carbon dioxide. Natural objects such as volcanoes, swamps or landfills are also capable of generating a fair amount of carbon dioxide.

    But do not think that CO 2 gas is softer and safer than CO gas. High concentrations of CO 2 lead to equally serious consequences, up to and including death. And you can raise your concentration easily and naturally just by closing the window in the bedroom at night. Moreover, unlike CO, carbonic anhydride is heavier than air and accumulates dangerously in lowlands, basements, subfloors and other unexpected places. Cases of death of people accidentally falling into hollows full of carbon dioxide, leaked from a neighboring volcano, have been documented. The bus engine stalls, air starts to run out and that's it. CO 2 gas is also colorless, odorless and tasteless, therefore, its presence is almost impossible to determine organoleptically, except to control the onset of pronounced suffocation.

    Both gases consist of only two types of elements. From oxygen (O) and carbon (C), the only question is the number of oxygen atoms. The knowledgeable reader might guess that one gas can be transformed into another with extraordinary ease. Yes, it can, but not quite with ease and not quite ordinary. You have to make an effort. So, for example, in catalytic converters of modern gasoline cars, the process of afterburning (converting) CO into CO 2 takes place. The process takes place at high temperatures and in the presence of catalysts (eg platinum). The reverse process is also possible, but again not easy.

    By the way, there is a website CO2.Earth on the Internet that displays the dynamics and the current concentration of carbon dioxide in the Earth's atmosphere. Yes, the concentration is not that low. Indeed, with the accumulation of carbon dioxide in the region of 2-4%, a person loses his ability to work, feels drowsiness and weakness. And at concentrations of about 10%, suffocation begins to be felt.

    We deviated a little from the topic, but the conclusion here is this: you should not confuse two different gases, as well as the consequences from them, but it is definitely worth controlling their presence in the atmosphere of the premises.

    Design of electrochemical sensors

    The most common type of MQ sensors. And it is widespread only due to its low cost. I did a little research to try to understand the issue of electrochemical sensors a little more than most hobbyists assemble any device on their own.

    An electrochemical sensor is built on the principle of changing the resistance of a certain element when interacting with another element. In other words, a chemical reaction occurs between these two elements, as a result of which the resistance of the substrate changes. Everything seems to be simple. But in order for the reaction to proceed normally, and the sensor was not disposable, the sensitive part of the sensor must be kept warm.

    So the electrochemical sensor consists of a certain substrate with a sensitive material, a substrate heater and the actual output contacts. A metal mesh is stretched on top of the sensor, nevertheless, the substrate is noticeably heated, and all kinds of combustible gases can be around the sensor, the same CO. For this, the grid is required. Safety comes first. By the way, a certain Humphry Davy came up with the idea of \u200b\u200bpulling the mesh over hazardous elements when used in explosive environments for miners at the beginning of the 9th century.

    There are a couple of dozen manufacturers of boards with electrochemical sensors of the MQ series on the network. But the manufacturer for all sensors (not boards) is the same - the Chinese company HANWEI. The company produces a significant range of various devices for detecting gases and everything related to them. But there are no sensors of the MQ series among the nomenclature, it is possible that the products are too small to be posted on the site.

    Curious by nature, I dug into the HANWEI specs and compiled all the available MQ series sensors, substrate material and detection type into a single table.

    Sensor

    Gas

    Substrate

    MQ-2 LPG SnO 2
    MQ-3 Alcohol SnO 2
    MQ-4 CH 4 SnO 2
    MQ-5 LPG, natural gas SnO 2
    MQ-6 LPG, propane SnO 2
    MQ-7 CO SnO 2
    MQ-9 CH 4, LPG SnO 2
    MQ-131 O 3 SnO 2
    MQ-135 Air Quality SnO 2
    MQ-136 Air Quality SnO 2
    MQ-137 Air Quality SnO 2
    MQ-138 Multi-purpose SnO 2
    MQ-303A Alcohol ???
    MQ-306 LPG, LNG ???

    With the exception of the MQ 300 Series, they all use the same substrate material. It is for the very substrate that determines the concentration of gas in the atmosphere, precisely for the substrate that changes its resistance. It is the same for all sensors. The 300 series has modestly omitted sensitive material information.

    Despite the common design and the used sensing element, it cannot be said that all sensors from the manufacturer are the same. They differ in shape and parameters such as the supply voltage of the heater. You can take readings from such sensors using an ohmmeter, measuring the resistance, which varies depending on the concentration of the measured gas. Or by adding a load resistor to measure the voltage (how to add a resistor is indicated directly in the specifications for the sensors).

    Please note that all sensors have a certain and very short lifespan, which is about 5 years. Moreover, 5 years is not only direct work, but also storage. And if your sensor is stored without proper packaging, then its shelf life is even shorter. The fact is that a sensitive chemical element, without heating, will be saturated with carbon, which will gradually destroy it all. It is for this reason that new sensors are recommended to be "baked" while keeping them in working order for a day, or even better than two. The carbon that has managed to eat into the tin (IV) oxide will “burn out” and the sensor will be able to determine the readings with higher accuracy.

    If you look closely at the list of measured gases or the purpose of the sensors, you can see that all of them, in one way or another, are tied to carbon (methane, natural gas, propane, carbon monoxide, liquefied gas, alcohol, and even air quality sensors measure the presence of carbon in compounds in air). And only the ozone sensor (MQ-131) stands apart, although it uses the same sensor with SnO 2. The fact is that all sensors of the MQ series are designed to work in an atmosphere with a stable oxygen level. The specification tells us that the oxygen content should be 21%, which is a certain average rate. And if there is less or more oxygen, then the readings will float, up to the complete inability of the sensor to give intelligible results when the oxygen content is 2% and below. Still, in this case, carbon will not burn out on the substrate at all, the oxidizer is not enough. Apparently, this effect is used to calculate the ozone measurement by an electrochemical sensor.

    But the accuracy of the MQ Series sensors isn't just dependent on oxygen. The readings change well depending on the humidity of the air and on its temperature. Calculated values \u200b\u200bare given for a humidity of 65% and a temperature of 20 degrees Celsius. And with humidity above 95%, the sensor will no longer provide adequate readings. It's a pity that the specification does not indicate which humidity is used: relative or absolute. Intuition suggests that it is still relative.

    In addition to environmental indicators, the service life of the sensors themselves also affects the accuracy of the MQ sensors as well as other parameters. Over time, their readings float. The sensitive layer becomes clogged with measurement products, the characteristics of the heater change and the resistance changes at the reference values. It is not clear in which direction it changes, but the manufacturer recommends, firstly, to calibrate the sensor after purchase and initial "annealing", and then to carry out regular recalibration throughout the entire service life of the sensor. And the only normal way to calibrate is to compare the readings from the sensor with an already calibrated instrument. It is clear that neither the end consumer-private trader (and the pros will use several other sensors, more expensive), nor many board manufacturers have such a device. Some manufacturers declare this honestly right on their website:

    "So how do I know the concentration of a particular gas using the MQ sensor?" - an impatient reader will ask? Since in most cases the consumer uses a voltage meter, however, everything is the same with resistance, but one step less, then the consumer has a need for how the volts or quanta of the Arduino DAC can be converted into the cherished ppm or at least b percent. This operation can be done only with the help of indistinct graphs from the specification for the sensor.

    Looking at the graph from the specification, you can see that, firstly, it has at least one logarithmic region. And, secondly, in addition to the main gas, the sensor calmly captures all the other similar ones (carbon-containing). Dealing with the graph and understanding which ppm corresponds to which sensor resistance is an exercise for practicing samurai, since a straight line crossing several different logarithmic zones will clearly not be straight in reality.

    On this I would like to summarize. So, the pluses of the MQ series sensors can be attributed to their extremely and categorically democratic price. But there are many more disadvantages:

    • Virtually identical sensors using the same sensing element and differing in the used trimming resistors.
    • The dependence of the measurement results on many factors: temperature, humidity, oxygen concentration.
    • The lack of the claimed selectivity for measured gases, reacts to everything with carbon (and, quite possibly, to other elements reacting with the substrate).
    • High energy consumption (heater).
    • The need for the primary "annealing" of the sensor.
    • Instability of readings over time.
    • The need for initial and repeated calibration.
    • Practical impossibility of obtaining meaningful values \u200b\u200bin the form of ppm or%.

    Digital or analog?

    The market knows its business and if there is a demand for a product, this demand will be satisfied. Sooner or later, but it will be necessary. And with the use of nimble Chinese comrades, demand is met sooner rather than later. So a great many manufacturers from China appeared, producing ready-made boards with electrochemical sensors of the MQ series. Let's consider, in ascending order, what delivery options there might be.

    Clean sensor

    The easiest and cheapest option. The delivery contains only the electrochemical sensor itself and nothing else. It must be connected to a voltage sensing system (for example, to the analog port of the Arduino) through a pull-up resistor. The resistor is best used with an adjustable calibration. The resistor values \u200b\u200bare indicated in the data sheet for the sensor.

    With an alternative measurement method, you can use an ohmmeter and measure the resistance of the sensor outputs, and then convert it into the desired results according to the same specification.

    Here the user receives not just the sensor itself, but a sensor installed on the board with a resistor installed. It is already possible (and necessary) to connect it to the voltage meter directly, without any intermediate resistors. In this case, only voltage measurement is available, since, together with a resistor, the entire circuit works like an ordinary voltage divider.

    The use of an analog sensor on the board is convenient because the manufacturer has already installed the required resistor on the board and may even have performed some kind of calibration of the entire structure. Some analog sensors use a trimming resistor and the user is free to calibrate himself, and some do not have this option. It is clear that it is better to take the version with the possibility of adjustment.

    Digital gauge

    It would seem that if the sensor is digital, then it should provide information in digital form. However, all digital sensors with MQ sensors that I came across did not have this opportunity. "Digital" in their name only means that the sensor has a digital output that switches to HIGH mode when a certain threshold of the concentration of the measured gas is exceeded. And the user carries out the basic reading of values \u200b\u200bin the same analog way as with an ordinary analog sensor.

    It is clear that all the resistors are already wired on the digital sensor boards. And good sensors also have trimming resistors available for adjusting the sensor. One is used to tune the sensor and the other to set the threshold for the digital output. And the best ones also have some kind of signal amplifier, useful in the case when the sensor is removed from the measuring device and there is a risk of catching interference on a long cable.

    Digital sensor with digital bus

    Perhaps this is the most Hi End among such sensors. Connection and data transmission is carried out through the digital bus I 2 C. And to one device for reading information (for example, Arduino), you can connect as many as a hundred such sensors. Just keep in mind that the sensors consume a lot of current and must be supplied separately. The tuning resistor is, of course, present.

    Judging by the code of the example offered by the sensor manufacturer, the sensor itself sends data in raw form and they are already programmatically converted to ppm values. In general, the sensor differs from the analog version only in the presence of a digital bus.

    Nutrition

    I have already mentioned above that for the MQ sensor heater to work, it is required to supply it with high-quality power and in sufficient volume. According to specification, the sensors consume about 150 mA. In reality, consumption can float in a very wide range. In principle, 150 mA is not such a big current until a device (or several) with such a consumption is tried to be crossed with something like an Arduino. By connecting even one such sensor to the power supply on the board, you already run the risk of getting an inoperative device, which will not have enough voltage for normal operation. During operation, the sensors themselves heat up, not significantly, but up to forty degrees they may well heat up. If we compare this temperature with 60-70 degrees on the stabilizer feeding these sensors, then the temperature of the sensors can be considered tolerable.

    To ensure the normal operation of the heater and, as a consequence, the sensor itself, it is necessary to supply power separately for these sensors. For example, use an independent 1 or 2 A and 5V power supply to power the sensors (not all sensors consume 5V). Or use a special board that converts the 9-12V voltage to the one required to power the sensors.

    In any case, you will have to tinker with a current source with the required power. Although it is possible that the sensor is connected directly to the board (for example, Arduino). But in this case, it is not recommended to connect anything else to it.

    Option to calibrate the sensor and convert readings to ppm

    While surfing the net looking for a calibration solution and getting reliable results from the sensor, I came across a very curious post from a certain Davide Gironi, who faced exactly the same problem as I did. Davide tried to figure out how to get ppm readings from his MQ-135 (Air Quality) sensor.

    According to the research carried out by the blogger for calibration, it is enough to have an idea of \u200b\u200bthe concentration of some gas in the atmosphere and, based on this data, try to select a resistor to get into the desired sector according to the graph. Davide used an MQ-135 sensor, which is designed to determine air quality, among which CO 2 is monitored. And it was carbon dioxide that most interested the blogger. Using information from co2now.org, he was able to calculate the required resistor value. Agree that the method is far from ideal, but still better than nothing.

    Then, after calibrating, he jotted down a little code to get the desired ppm from the data obtained from the calibration. I will not give the code here, those who wish can familiarize themselves with it on their own, but it boils down to something like this:

    float ppm \u003d ((10000.0 / 4096.0) * raw_adc) + 200;

    The above code is, by the way, from the example for an MQ-4 sensor with a digital I 2 C interface. Note that this is better than nothing. After all, many are simply not able to reach such a transformation and are limited only to certain threshold values. For example, with a value of 750 (there is no unit of measurement, this is a quantum), you need to turn on the red LED, in the range 350-750, yellow is enough, and when below 350, let the green LED light up.

    Alternatives?

    If MQ sensors are so bad, is there any alternative to use in home projects? Actually there is. Even a lot. There are not one or two methods for measuring gas concentration. Only sensors with high accuracy cost a lot of money. And sometimes from such a cost comes amphibiotropic asphyxia. The difference in cost can reach thousands and tens of thousands of times. Then you involuntarily become thoughtful.

    However, quite recently, infrared detectors appeared on the market, thanks to the efforts of the same hardworking comrades. Yes, they are far from being for all gases, but at least CO 2 is captured without significant energy costs and with high selectivity. These sensors use a non-dispersive infrared method to determine the gas concentration.

    If the detection of other gases is required, but using inexpensive devices, then there are not so many options available at the moment (summer 2016), if not to say frankly that there are very few of them. An alternative can be considered the use of the MQ series, although you will have to manage only with thresholds of values \u200b\u200b(I have already spoken about the accuracy of the translation in ppm above).

    Many will immediately object, they say, I personally used such a sensor, and it works. Experiments are cited as examples, akin to "breathing on a sensor", holding a hand around it, blowing out a cloud of cigarette smoke. Yes, the sensor readings will immediately change, the values \u200b\u200bwill creep up. Yes, the sensor will reflect that it has warmed up, that the humidity has increased, that there is more carbon and less oxygen in the atmosphere. But how much more, how much of the investigated gas is currently in the atmosphere and, most importantly, which gas? It is no longer possible to answer this question with the help of MQ series sensors. It is better to purchase an ordinary household hazardous gas alarm, the same CO. For quite comparable money, you get a factory-made device with a loud alarm and low power consumption.

    Twin sensors

    And in conclusion, I want to summarize. I am upset that such affordable sensors cannot in any way be used in any more or less serious project. Yes, you can practice programming and connecting sensors, but the required reliable values \u200b\u200bcannot be obtained with their help. And the value of the sensors will very soon go to zero.

    Moreover, I am personally convinced that all MQ sensors do not have a sufficient level of selectivity, differ only in their external design and recommendations for the selection of resistors. The sensors react to anything containing carbon and the more they react, the more active the carbon in the compound and the more easily it reacts with the substrate. I do not believe that the manufacturer adds additional elements to the substrate that increase selectivity and does not write anything into the specification. But I suppose that one sensor can be turned into another, by using different resistors and looking at the graphs of resistance and concentration.

    But it all started when I connected two sensors (MQ-4 and MQ-7) to one device and started uploading the results of their work to ThingSpeak. One of the sensors should measure the level of toxic CO, and the second should show how much methane is in the air. I was very interested in graphs that repeated each other more than almost completely. Yes, one sensor gave readings at the level of 100-150 units, and the second at the level of 350-400. Peaks and plateaus coincided in time from different sensors, and the bursts only set off an inevitable pattern.

    I combined the readings of both sensors into a single correlation graph and realized that they show the same results, albeit in different ranges. And I wondered - why do I need a methane sensor that reacts to everything? From carbon monoxide to alcohol. Why do I need a CO sensor, which, in addition to CO itself, reacts even more to LPG and hydrogen? Exactly - there is no need.

    Update... Before throwing unnecessary sensors into the trash, I decided to disassemble a couple of them and see what they have inside. So:

    The insides of the MQ-4 sensor

    As you can see, the sensor has six legs. From two of them, a heating coil passes through the center of the silvery tube. The other four legs each hold two thin wires, obviously for analyzing the changing resistance.

    The insides of the MQ-7 sensor

    Despite the other appearance, the insides of the MQ-7 are identical to those of the MQ-4. And the heated lump of a grayish color is nothing more than the desired tin oxide, which, when heated and in the presence of carbon or hydrogen (just the same gases), is partially reduced, tending to become metallic tin, and accordingly changes its resistance.