Introduction: Breathalyzer With Arduino

The objective of this project is to build a functional breathalyzer using an Arduino.

Step 1: Materials and Tools

  • LCD screen 16x2
  • MQ-3 alcohol sensor
  • Arduino UNO
  • 5V passive buzzer
  • 10kOhm resistor
  • Solderless Breadboard
  • Soldered breadboard
  • PVC tube (2 cm of diameter)
  • 20 male/male jumper wires
  • 20 female/male jumper wires
  • 6 batteries AA
  • 6 battery holders
  • Tactil Switch
  • Button
  • Welding kit
    • Soldering iron 30W
  • Hot glue
  • Cutter
  • Potentiometer 5K
  • Carton box (20x6x13)
  • Insulating tape
  • Tights

Step 2: Welding the LCD Screen.

Once you have all your materials and tools, you will realize that your LCD screen does not have pins. In order to fix this, you will need to weld the necessary pins to the respective holes in the screen. You can find on the internet how to weld a pin as it is a simple process. The final result should look like the image above. Once you finish building the circuit, there will be the second part of welding, as you will proceed to build the circuit without a breadboard.

Step 3: Building the Circuit

Using the protoboard and jumpers, make the connections according to the Diagram.

Step 4: Welding the Circuit

Once the circuit is functioning using the protoboard, you need to replicate it but without the protoboard. In order to do this, you will need to weld the following things:

- 2 male/male jumper to a female pin line (one to + and other to -)

- Replicate the button system in a soldered breadboard, and weld it to it.

- Weld the battery holders in series, connect the final 5V wire to the switch by welding it.

- Weld the Ground end wire to a male/male jumper, and then connect it to ground.

Step 5: Coding

// The program for the breathalyzer is below:

// Libraries
#include #include

// Warmup


unsigned long time;

// Measurement


unsigned long measurement_start;

// Sensor readings

int analogPin = A0;

int val = 0;

// Buzzer

const int buzzerPin = 3;

// Button

const int buttonPin = 2;

// Modes

bool measurement_mode;

bool measurement_done;

// LCD

// jm_LiquidCrystal_I2C.h lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display

const int rsPin = 9;

const int enablePin = 8;

const int d4Pin = 4;

const int d5Pin = 5;

const int d6Pin = 6;

const int d7Pin = 7;

LiquidCrystal lcd(rsPin, enablePin, d4Pin, d5Pin, d6Pin, d7Pin);

void setup() {

// Serial


// Init LCD





void loop() {

// Read button state

int button_state = digitalRead(buttonPin);

if (button_state && !measurement_mode) {


measurement_mode = true;

measurement_start = millis()/1000;

measurement_done = false;


if(button_state && measurement_done){ delay(500);


if (measurement_mode) {


} else {



// Wait


// Get time

time = millis()/1000;

// Warmup



int progress_time = map(time, 0, TIME_UNTIL_WARMUP, 0, 100);





if (measurement_mode == false && !measurement_done) {

// Instruction



if (measurement_mode && !measurement_done) {

// Instruction


// Sound

tone(buzzerPin, 1000);

// Read alcohol level

val = readAlcohol();


if (measurement_mode && !measurement_done && ((time - measurement_start)> TIME_UNTIL_MEASURE)){


measurement_mode = false;

measurement_done = true;



if(measurement_done) {




//measurement_done = false;




void printWarming(int progress)


Serial.print("Warming up: ");




lcd.print("Warming up: ");


lcd.print(progress, DEC);



void printPress()


Serial.println("Press to start ...");


lcd.print("Press to start ... ");


void printMeasure()


Serial.print("Breathe until the ");

Serial.println("sound stops...");


lcd.print("Breathe until the");


lcd.print("sound stops...");


void printAlcohol(int value)


Serial.print("Sensor reading: ");






void printAlcoholLevel(int value)





Serial.println("You are sober");

lcd.print("You are sober");


if (value>=200 && value<280)


Serial.println("One beer.");

lcd.print("Una chela.");


if (value>=280 && value<350)


lcd.print("two or more beers");

Serial.println("two or more beers");


if (value>=350 && value <450)


lcd.print("Too much...");

Serial.println("Too much...




lcd.print("You're drunk");

Serial.println("You're drunk");



int readAlcohol()


// Number measurements

int nb_measurements = 5;

int measurements;

// Measure

for (int i = 0; i < nb_measurements; i++) {

measurements = measurements + analogRead(analogPin);


measurements = measurements/nb_measurements;

return measurements;


Upload this program to the arduino

Step 6: Designing the Container

Once the circuit is complete and functional, it has to fit into a container/box (preferably a carton box). The model used was: link .

Using the cutter, cut a rectangle on the A side of the box (see image) for the LCD screen. Cut another one for the switch and a square for the button.

On side B cut 2 circles, one in the centre ( 2 cm of diameter) for the sensor and another one on the lower left part (2 cm of diameter) for the buzzer.

Cut a section of the PVC tube, one of 3cm and the other of 6cm. These sections will protect the sensor and buzzer and place them in their respective holes.

**If you want you can print your own stickers to show the ranges of each category and to label the buttons.

Step 7: Assemble

Hot glue the arduino and the batteryholders to the inside of the box. Hot glue the button, switch and LCD screen to their respective holes.

Cut a small square (3x3cm) of the tights and cover one of the ends of the 6cm PVC tube, place the buzzer and hot glue it in its hole.

Hot glue the 3cm PVC tube with the sensor to its hole.

**Cut the stickers and put them wherever you want!