How to Build a Gas Sensor to detect alcohol, ethanol, smoke in the air using a MQ-3 using ESP32, ESP8266 or Raspberry Pi Pico W for Alexa

In this section, we’ll guide you through building an gas sensor using an ESP32, Raspberry Pi Pico W or ESP8266. You’ll then be able to monitor the alcohol concentration in the air through Amazon Alexa and receive push notifications via the Sinric Pro app when the sensor detects a certain level.

Prerequisites :

  1. ESP32, ESP8266 x 1.
  2. MQ-3 x 1.
  3. Jumper Wires.

Sinric Pro MQ135 air quality

Quick introduction to MQ-3

The MQ-3 is a semiconductor gas sensor used in a variety of applications to detect alcohol concentrations in air. It is a low-cost, high-sensitivity sensor that is easy to use. The MQ-3 is based on the principle of tin dioxide (SnO2) semiconductor gas sensing. When alcohol molecules are present in the air, they are adsorbed onto the surface of the SnO2. This adsorption causes the conductivity of the SnO2 to change, which can be measured as an electrical signal. The MQ-3 is sensitive to a wide range of alcohol concentrations, from 0.05 ppm to 5000 ppm. It is also sensitive to other gases, such as ammonia, benzene, and toluene, but it is most sensitive to alcohol.

The MQ3 sensor requires a power supply of 5V and consumes about 800mW of current. The digital output can be connected to a ESP32, ESP8266 or Pico W to measure the alcohol concentration.

How to calibrate the sensor ?

Leave it powered on for 24-48 hours to burn it in and stabilize.

Specification sheet: MQ-3


Sinric Pro esp8266 MQ-3 wiring

MCU A0 Pin VCC Pin
ESP32 34 (Analog ADC1_CH6) 5V
ESP8266 A0 5V/VIN
Pico W GP26 (ADC0) 5V

Note: on ESP32, ADC2 (GPIO04, GPIO02, GPIO15) is unstable when Wi-Fi is being used.

Let’s verify that the sensor is wired correctly and working.

Reading when not exposed to alcohol (around 760):

Sinric Pro MQ3 test reading

When exposed to Jack Daniel’s Single Barrel Tennessee Whiskey (around 850):

Sinric Pro MQ3 test reading

Step 1 : Connect to Sinric Pro

Step 1.1 : Creating a custom device type for Gas Sensor.

Sinric Pro does not have a built-in device type for Gas Sensor so we are going to create a custom device type for Gas Sensor using Device Template feature.

  1. Alcohol Detected/Not Detected.

Note: You can use the device template import feature mentioned below to skip creating the full template.

Sinric Pro gas ensor device template

Here we must select the features of our Gas Sensor. We want to know whether Alcohol is Detected, Not-Detected. So let’s drag a Mode and Push Notification capability.

Sinric Pro custom device type for gas sensor

Click on Configure button and setup the two capabilities like below.

Sinric Pro moisture sensor template mode and range settings

Click on Save to save.

Sinric Pro moisture sensor template mode and range settings

Click on Save to save the template.

Now you can see the template we just created.

Import an existing template?

If you are feeling lazy setup all the Modes values, you can use the import feature.

Sinric Pro gas sensor import template

Paste this Template:

Sinric Pro create device alexa

Sinric Pro copy device id

Sinric Pro copy device id

Step 2 : Connect to Sinric Pro

Step 2.1 Install Sinric Pro Library

Sinric Pro install SinricPro library

2.2 Complete Code

Now you should be able to see the alcholol detected status and water level via Alexa, Sinric Pro App

Alexa, What’s the alcholol (mode name) in Gas Sensor (device name)

Sinric Pro Alexa gas sensor

Sinric Pro Portal gas sensor portal


  1. Google Home or SmartThings are not supproted.

  2. Please refer to our Troubleshooting page for more details.

This document is open source. See a typo? Please create an issue