Getting Started with ANAVI Gas Detector Starter Kit and Home Assistant

ANAVI Gas Detector is an ESP8266 based board designed for MQ gas sensors supported by Arduino. This allows you to easily monitor air quality, or more accurately air conductivity using MQ-135 sensor as part of the starter kit either visually on the OLED display, or through your smartphone or computer using MQTT via automation platform such as Home Assistant.

Leon Anavi sent me an ANAVI Gas Detector Starter Kit to have a look, and I’ll report my experience with the kit using it standalone, and through Home Assistant.

Starter Kit Unboxing

Anavi Gas Detector Starter Kit
The kit contains the open-source hardware, ESP8266 based ANAVI Gas Detector board, a plastic stand, an OLED display, a USB to serial adapter, a gas sensor, and a few KiCad and ANAVI stickers.

Anavi Gas Detector Starter Kit Unboxing
Click to Enlarge

The board itself comes with an ESP8266MOD module, features a micro USB port for power, a reset button, four LEDs, a UART console, a 4-pin GPIO header, three I2C headers for sensors, a 4-pin connector for the OLED display, and finally a 4-pin analog header for MQ gas sensors.

ANAVI ESP8266 Gas Detector Board
Click to Enlarge

The “Flying-Fish” sensor module includes the sensor itself, a potentiometer to set the threshold value, and a 4-pin header to connect to the host board.

Flying FIsh MQ Sensor

There’s no indication of the sensor model on those views, so we need to look at the sensor from the side, and that’s MQ135 air quality sensor we’ve got here.

MQ135 Gas Sensor

It is sensitive to benzene, alcohol, and smoke. It can also be used to estimate CO2 concentration. ANAVI Gas Detector can support other MQ sensor as well including:

  • MQ2 for methane, butane, LPG, smoke
  • MQ-3 for alcohol, ethanol, smoke
  • MQ-7 for carbon monoxide
  • MQ-9 for carbon monoxide and flammable gasses

You’ll find more details about each on Arduino Playground.

ANAVI Gas Detector Assembly

The starter kit assembly instructions are straightforward and very similar to ANAVI Thermometer assembly steps.

ANAVI Gas Detector Assembly
Click to Enlarge

All I need was a precision screwdriver and a pair of tweezers to handle the nuts when installing the display. The first step is to remove the protective films from the plastic stand, install the display, install the mainboard, and wire the display to the display header. Finally, insert the MQ sensor and you’re done.

ANAVI Gas Detector Wiring
Click to Enlarge

If you have the feeling you’ve seen this before because ANAVI Thermometer and ANAVI Gas Detector starter kits are indeed very similar.

ANAVI Thermometer vs ANAVI Gas Detector
ANAVI Thermometer (left) vs ANAVI Gas Detector (right)

Configuration

The board comes pre-loaded with a default firmware, so we can use it straightaway. You just need to power the board via the micro USB port either via a computer port, or another power source.I started with the former, and the kit starts in access point mode.

Gas Detector Access Point

The display shows the AP ID. Take your phone or another device that can connect to WiFi, select “ANAVI Gas Detector <AP ID>, and you should be asked to sign-in. This will bring you to the user interface.

ANAVI Gas Detector WiFi Access Point
Click to Enlarge

The Info section is shown on the right above for reference. But we do not really need to care about this. Most people will just tap on Configure WiFi to connect it to their WiFi router.

ANAVI Gas Detector WiFi Configuration
Click to Enlarge

Select your access point, and enter the password. We can ignore MQTT settings for now, but we’ll use those later on. We will not use the Machine ID in this review as it’s not needed. Just tap and save, and the board should reboot with its new IP address freshly acquired from your router over DHCP.

IP Address

Air Quality Measurements

Just wait a few seconds and the OLED display with start showing the sensor conductivity, and an estimation of the air quality either Poor, Moderate or Good.

ANAVI ESP8266 Gas Detector Display

In my office air conductivity was 27% corresponding to moderate air quality. I’m now using an oversized battery bank since I want to move it around in different locations around the house.

ANAVI Gas Leak Detector
Click to Enlarge

Let’s go to the kitchen. I placed the device on the gas stove, and turn on one of the burners, and as the gas escaped it quickly went to 100% before starting to fall down as ignition occurred, and gas was burned. Note that MQ-135 is not specifically designed to detect this type of gas leaks, but it seems to serve the purpose. We’ll see it in more details below, including in a video.

ESP8266 Gas Detector-vs AirVisual Air Quality
Click to Enlarge

I went outdoors for some fresh air and got 22% conductivity, that’s still classified as moderate air quality. I’m showing AirVisual app’s air quality for reference only. MQ-135 sensor apparently picks a bit of everything, while AFAIK AirVisual monitor targets PM2.5 and PM10 particles only. It would still be interesting to find out if there could be a correlation.

Next morning I went back inside and connected the board over the serial console to check out the output:


If you want to find out what the code does, you can check out the Arduino sketch. The code specific to conductivity measurement and air quality calculation is in detectGas function:

ANAVI Gas Detector and Home Assistant

Reading the values on the OLED display or in the serial console is all well and good, but we’ve got a WiFi-connected node so it would be so much better if we could store the data on our own server and see some nice charts, possibly triggering alerts as well. One way to do so is to use Home Assistant.

I did try to setup Home Assistant with ANAVI Thermometer last March, but gave up due to lack of time fixing all the issues I encountered. I did try again with his Gas Detector, and this time everything was very easy thanks to video posted by Leon Anavi explaining how to do so with ANAVI Thermometer.

First, instead of just installing Home Assistant, I went with Hass.io that includes Home Assistant as well as common tools that make it easier to use. I could install it in two lines in Ubuntu 18.04 adapting some instructions found on Github:


You should now able to access the dashboard by going to http://<computer_ip_address>:8123 in your web browser and go through the first setup wizard that’s pretty much self-explanatory. At some point, you can add MQTT services. You can do this now or later (Integrations part. I did this at this stage, by setting the broker IP address (e.g. my computer IP address), a username and password of my choice, and – very important – ticked Enable discovery.

Home Assistant MQTTClick on Submit. This should bring you to the overview page of Home Assistant. Go to Hass.io in the left menu, and add-on store in order to install Mosquitto broker.

Hass.io Add-on Store

You’ll need to configure it as shown below.

Hass.io MQTT Broker Configuration
Click to Enlarge

MQTT broker configuration:


Click Save and Start. We need to configure our gas detector to connect to our MQTT broker with the provided credentials. Press the reset button on the board for 10 seconds in order to restore factor settings and enter access point mode again.

ESP8266 MQTT Configuration

After sign-in, we can input the access point password as previously, as well as fill fields relevant to MQTT namely IP address, username, password, and device’s name for Home Assistant (“ANAVI Gas Detector”). Click Save.

Now we can go to Configuration->Integrations in Home Assistant dashboard. If you have not yet configured your MQTT broker you may be asked to do so here, but in our case, we did this already, so we can see MQTT: 192.168.1.6.

Home Assistant MQTT Broker Integration
Click to Enlarge

Let’s click on it, and oh surprise! ANAVI Gas Detector is detected, as well as the two values it returns: conductivity in percent and dangerous gas detection (yes or no).

ANAVI Gas Detector Home Assistant
Click to Enlarge

Perfect! No need to mess around with configuration files, except when we set the username password in the MQTT broker above. It’s just that easy.

Home-Assistant ANAVI Gas Detector
Click to Enlarge

The two values are also shown on Home Assistant dashboard. All good. Before we check the chart, let’s go to play with our stove again.

This video below I show how conductivity quickly jumps to 100% when gas flows through the burner without ignition. I turn it off, and conductivity slowly goes down as the gas disperses.

So how does it look in Home Assistant? Here’s how.

Home Assistant Air Conductivity Chart

The second time it drops faster as I moved the kit into another room. We can also check a long term view in the History tab.

Home Assistant History
Click to Enlarge

The Dangerous Gas alert is “clear” most of the time, and “Detected” when a dangerous gas is detected. Somehow it does not exactly match the “gasState” status which is set to ON in the code when conductivity is over 30%. It looks like the bar is shifted left for some reasons. If we would shift it right, it would align with the conductivity chart. Apart from this small rendering issue, everything works pretty well!

If you’re interested you can pledge for ANAVI Gas Detector starter kit on Crowd Supply for $39 as the campaign still has about 10 days to go. Shipping is free to the US, $12 to the rest of the world, and backers should expect their rewards sometimes in November / December 2019.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

6 Replies to “Getting Started with ANAVI Gas Detector Starter Kit and Home Assistant”

  1. I wonder if it drives MQ-7 and MQ-9 properly, those require two different voltages levels for the heater, it should be heated for 60 seconds at 5V, then drop it to 1.4V for 90 seconds then take the measure, so it is a 2.5 minutes cycle. I know they can detect variations in gas concentrations even when constantly driven at 5V, but their sensibility will drop (faster) over the time as they are not supposed to be driven that way.
    If they don’t drive them in that way, I would not advise to use them if you are planning to run them 24/7.

    1. There’s no control for the voltage to module from the board and the generic banggood/taobao sourced driver board for the sensors just seems to have an op-amp to boost the output.

  2. Aren’t you supposed to run the sensor for 24+ hours the first time, some burn-in time (should be mentioned in the datasheet)?

    1. Yes, but that is a one time process, the datasheet also mentions that afterwards both the MQ-7 and MQ-9 are supposed to be driven as I mentioned. But anyway, this kit was not intended for accuracy.

  3. Any way to set the frequency of updates? Mine updates (I think) every second, so I’d like it just to take a measurement say, every 5 seconds

    1. I think changing the following const in Arduino sketch should do the job:

      Just set it to 5000

Leave a Reply

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

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...