Gas Detector

Let’s create a simple Gas Detector connectable to WiFi. The gadget would offer:

  • web UI including gauges for LPG, CO, Smoke
  • simple data handler returning values in JSON
  • capable of regularly sending data to ThingSpeak server and
  • obviously triggering laud alarm if threshold of dangerous concentrations exceeded.

We would need following components:

  • NodeMCU with ESP8266
  • MQ2 gas detetor break out
  • 3mm LEDs (green, yellow, red)
  • Piezzo speaker / buzzer
  • 10 cables

Supplies

To complete the whole product we would need a 3D printer and a soldering station.

Step 1: Connect All Together

Let’s prepare our 3mm LEDs by soldering negative electrode together. (negative electrode is indicated by a small flat part of aside of each LED)

Then we will use a NodeMCU as a heart of the device and connect adjacent components based on the attached picture.

  1. MQ2 breakout to NodeMCU
    • use VU (+5V) of NodeMCU connect to VCC of MQ2 breakout
    • Node MCU GND connect to MQ2 breakout GND (btw all GNDs of NodeMCU are bridged, therefore it does not matter which one is used, but a closest one is just bellow the VU)
    • connect A0 of NodeMCU to A0 of MQ2
    • connect D5 of NodeMCU to D0 of MQ2
  2. LEDs to nodeMCU
    • a positive (the longer) electrode of a green LED to D1 of NodeMCU
    • a positive electrode of a yellow LED to D2
    • a red LED to D3
    • and the common negative electrode (previously soldered together) to a GND of NodeMCU
  3. Buzzer to NodeMCU
    • connect a positive buzzer electrode (marked by ‘+’ sign on out Buzzer from its top side) to D6 of NodeMCU
    • a remaining buzzer electrode to a GND of NodeMCU

Step 2: Make the Device Alive

Let’s upload a code sketch to our NodeMCU.

Thru Arduino IDE, we will open a code sketch from https://github.com/radimkeseg/Gas-Detector, compile and upload to NodeMCU by a USB cabel.

After successful upload the device starts as an Wifi Access Point and waits about a minute for configuration. If passed without configuring, it will work an ordinary Gas detector, but not sending any measured values out.

To configure the WiFi, let’s connect to the access point of our NodeMCU (in 60 sec from device has started) and find RKG-GAS-DETETOR… WiFi (obviously connect in without internet at this moment).

Configure your WiFi obviously by selecting a proper WiFi name, set password and save. Our device should restart within 3 secs. If not just click on RST button or unplug and plug power cable in back again. After reset the device connects to your WiFi.

Find the new device IP on your network address, either by reading the IP in console of Arduino, via router IP lease table or e.g. using Fing application from your mobile.

Once you connect to IP address of the device thru a browser e.g. http://192.168.1.ABC (which is a typical IP range for home networks), you would see the setting of:

  • time zone and DST
  • ThingsSpeak to collect the measured values
  • also gauges with measured value

Step 3: Print a Case

To print a simple case, please find a 3D model file here https://github.com/radimkeseg/Gas-Detector/tree/ma… or attached by this paragraph.

Then the placing the components to the case is relatively intuitive:

  • MQ2 break out to the center aperture (fix by 2mm screws)
  • NodeMCU to the longer stands above (fix by 2mm screws)
  • LEDs above NodeMCU to prepared apertures (should fit firmly, no fixing/gluing needed)
  • buzzer to the remining top aperture (should fit firmly, no fixing needed)

Step 4: Finalization

The last step is to use an USB charger/adapter to let the device work standalone and place it to an area where you would like to measure LPG, CO, smoke levels.

The device triggers alarm if 70ppm of CO (or 70ppm LPG or 1000ppm smoke) is reached. A buzzer will produce an annoying noise and a red LED will start blinking.

If half of the threshold has been reached a yellow LED will indicate this status as a warning only.

https://youtu.be/mZzY4G-qINY

Happy tinkering, basteling and creating 😉

Source: Gas Detector


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top