• chevron_right

      CO and LPG gas sensor with Arduino and LCD

      pubsub.slavino.sk / onetransistor · Sunday, 15 January, 2023 - 14:09 edit

    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
    Read more

    Značky: #Gas, #Sensor, #Electronics, #Elektro, #MQ-9, #Arduino

    • chevron_right

      Influence of temperature and humidity on MQ gas sensors

      pubsub.slavino.sk / onetransistor · Saturday, 14 January, 2023 - 17:09 edit

    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

    Read more

    Značky: #Elektro, #MQ-2, #Software, #Sensor, #Arduino

    • chevron_right

      Interface MQ gas sensor modules to 3.3V development boards

      pubsub.slavino.sk / onetransistor · Sunday, 1 January, 2023 - 17:46 edit

    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

    Read more

    Značky: #MQ-2, #Electronics, #Elektro, #Sensor

    • chevron_right

      Compute ppm of MQ sensors from datasheet graphs

      pubsub.slavino.sk / onetransistor · Saturday, 31 December, 2022 - 19:34 edit

    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

    Read more

    Značky: #Sensor, #Software, #MQ-2, #Arduino, #Elektro

    • chevron_right

      Attempts at reading data from MQ-2 gas sensor (2)

      pubsub.slavino.sk / onetransistor · Friday, 30 December, 2022 - 21:16 edit

    MQ-2 is a gas leakage detecting sensor with good sensitivity to a wide range of gases. Since you can get most MQ sensor on ready-made modules, people are interfacing those with development boards. However, the modules are far from perfect. Some of the sensors require variable heater voltages. This is not the case for MQ-2. Since I own a module with this sensor and it can probably be used as is, I decided to make some tests while I'm waiting a PCB for MQ-9 to be manufactured and shipped.

    In the previous post I explained why modules with MQ-7 and MQ-9 are no good. Now, I'm about to discover the same for MQ-2. I thought I could use the module as is, since I am more interested in finding a method of computing useful data from the analog output of the sensor. With an Arduino compatible board and an MQ-2 module I will attempt to get ppm values. But not before some parts swapping.

    MQ-2 test fixture, with sensor exposed to alcohol
    MQ-2 test fixture, with sensor exposed to alcohol

    Read more

    Značky: #Elektro, #Gas, #Sensor, #Electronics, #MQ-2, #Arduino

    • Av chevron_right

      Ignoring pending interrupts in the Linux kernel

      pubsub.slavino.sk / avian_blog · Thursday, 29 December, 2022 - 14:34

    How I made my driver completely ignore the interrupts that happen between disable_irq() and enable_irq().

    Značky: #Elektro, #Code

    • chevron_right

      Useless sensor modules based on MQ-7 and MQ-9 (1)

      pubsub.slavino.sk / onetransistor · Sunday, 11 December, 2022 - 16:51 edit · 1 minute

    When shopping for electronics parts and modules, I oftentimes add to cart things I didn't plan to buy, since most suppliers offer free shipping when total order amount is above a threshold. This was the case with a module I bought recently, a carbon monoxide and LPG detector based on MQ-9 sensor. When I got the time to build a breadboard circuit to test it, I came across a problem. As with most modules and devices, I started with MQ-9 datasheet. And at first I did not quite understand what they were saying about high and low heater voltage.

    And the internet is full of examples regarding such modules interfaced to Arduino. And everybody seems to be powering it from 5 V, while some even developed code with advanced calculations to get real ppm value from the sensor. Throughout reading of the datasheets of both MQ-7 and MQ-9 reveals a "detail" everybody seems to have missed. In this post I will show you the correct way of using MQ carbon monoxide sensors. Keep in mind that CO and LPG are dangerous gases and if you need a detector, you should always buy a professionally manufactured one which is also properly calibrated.

    Useless sensor modules based on MQ-7 and MQ-9
    MQ-9 ready for testing

    Read more

    Značky: #Elektro, #MQ-9, #Sensor, #Gas, #Electronics, #Arduino

    • chevron_right

      8-Channel relay controller with keypad and RS485 interface (2)

      pubsub.slavino.sk / onetransistor · Saturday, 10 December, 2022 - 16:15 edit · 1 minute

    In the previous post I built a front panel with 8 push buttons which will be used to activate a module of 8 relays. Having so many I/O lines I had to come with a solution to be able to read and set each one of them with common microcontrollers. I ended up using 74HC165 for inputs and 74HC595 for outputs. These ICs are shift registers controlled using a serial synchronous protocol similar to SPI.

    In this post you will see the entire outdoor unit. In the end there will be two units, the outdoor one with keypad and relays; the other is the indoor unit with Wi-Fi connectivity and MQTT capabilities. A keypad will be featured on this one too. I went with this approach because I want a robust implementation without Wi-Fi dependency. Nevertheless the keypad on outdoor unit can be remotely disabled to prevent unauthorized use. I decided to use two units after a failed design which implied the use of an ESP8266 board directly as the MCU of outdoor unit. I had problems with voltage levels (shift registers are both 3.3 V and 5 V compatible, however my relay board is 5 V only, while ESP8266 is 3.3 V only; besides that, 3.3 V applied to shift registers powered from 5 V is not recognized as digital HIGH).

    Relay controller inside plastic box
    Relay controller inside plastic box

    Read more

    Značky: #Elektro, #RS485, #PCB, #74HC595, #Arduino, #3D-Print, #74HC165

    • chevron_right

      Exporting your HTML table to CSV

      pubsub.slavino.sk / arduinodiy · Saturday, 1 October, 2022 - 13:46 edit

    The WebApp showing the measuring points in the Firebase database database that I presented in a previous article and which was in fact built on a project by randomnerdtutorials, includes a table of the collected datapoints that can be shown, hidden and also deleted. Printing (just roughly)In case you want to keep this data, there … Continue reading "Exporting your HTML table to CSV"

    Značky: #Arduino, #Elektro