NederlandsKlik deze knop voor de Nederlandstalige website

Arduino breathalyzer: DIY alcohol tester with MQ-3 gas sensor and OLED display

One of the fun things about Arduino is the availability of many types of sensors. With those sensors you are able to measure and detect about anything. Most of them are cheap and easy to use. Usually only a couple of wires and a few lines of code are required to incorporate them into your project. One of those sensors is the MQ-3 gas sensor, which detects alcohol. I got my sensor from VNG Systems. Together with some LEDs and the OLED display featured in the previous blog post you can build your own Arduino breathalyzer.

Arduino breathalyzer: the MQ-3 gas sensor

The MQ-3 gas sensor uses a small heater inside with an electro-chemical sensor. It is used indoors at room temperature. It can be calibrated more or less but a know concentration of the measured gas or gasses is needed for that. The output is an analog signal and can be read with an analog input of the Arduino. In this tutorial I use the “MQ-3 Alcohol Ethanol Sensor Breath Gas Detection Module For Arduino” on a breadboard-friendly breakout board.

MQ-3 gas sensor on breakout board for Arduino
MQ-3 gas sensor on breakout board for Arduino

The sensor will become more accurate after some use. Some datasheets use the term “preheat”, but it is the time to burn-in the sensor. This is meant to make the sensor readings more consistent. A time of 12 or 24 hours is usually used for the burn-in time. The Burn-in is achieved by applying normal power to the sensor. Hook up the sensor as follows:

MQ-3Arduino
ADA0
DD(not connected)
GNDGND
VCC5V

Arduino breathalyzer: the OLED display

In this tutorial we will use a 6-pin SPI version of the 128×64 OLED display together with the Adafruit SSD1306 library. For details, see the previous post “Adding a 128×64 pixels white OLED display to your Arduino project“. Hook up the display as stated below:

OLEDArduino
GNDGND
VCC5V
SCLD10
SDAD9
RESD13
DCD11

Arduino breathalyzer: the LEDs

Hook up the LEDs to the Arduino’s digital pins D2 to D6. Do not forget the current limiting resistors. I used 470 Ohm resistors, but you can also use 220 Ohm ones.

LEDArduino
1 GreenD6
2 GreenD5
3 YellowD4
4 YellowD3
5 RedD2
Arduino breathalizer alcohol tester MQ-3 sensor with OLED and leds, breadboard view
Arduino breathalizer alcohol tester MQ-3 sensor with OLED and leds, breadboard view

Arduino breathalyzer: the code

This is the sketch, you should adapt it to your own needs. TIME_UNTIL_WARMUP is set to 15 minutes. You might want to lower this value to around 3 minutes after some use. The thresholds for ‘value’ are just an indication, you should experiment with your sensor to find the values you need.

 

Arduino breathalizer, alcohol tester with MQ-3 sensor, OLED display and leds, detail.
Arduino breathalizer, alcohol tester with MQ-3 sensor, OLED display and leds, detail.

0.96 Inch White SPI OLED Display Module 12864 LED For Arduino
Tested and recommended by OneGuyOneBlog.com:

0.96 Inch White SPI OLED Display Module 12864 LED For Arduino
Geekcreit® UNO R3 ATmega328P Development Board For Arduino
Tested and recommended by OneGuyOneBlog.com:

Geekcreit® UNO R3 ATmega328P Development Board For Arduino

This post is also available in Dutch.

Add a Comment

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