# Breathalyzer Sensor

366

1

1

While there are already ignition interlock systems available for cars, they are extremely expensive and and difficult to install on vehicles, due to the lack of universality in their design. Our project will address these issues, providing the user with a solution under 75 dollars and being able to install the design in any car, truck, van, or other motor vehicle. Not only will this provide a service to the driver of the vehicle, by preventing them from driving drunk and getting a DUI, but it also makes the road safer for the rest of us.

To achieve our goal, we have certain constraints we must follow. We must provide feedback to the user after he/she blows into the device, in the form of an LCD, displaying their BrAC, and prevent them from accessing their car key over a certain threshold. If the person is under the BrAC threshold, they will have access to their keys and will be able to drive. This device must also be able to fit into, and be powered by, any motor vehicle. After all of this, our device must cost under a certain cost to construct, which we have determined to be 75 dollars. All in all, the project will have to prevent the user from accessing their keys when their BrAC percentage is too high. This will make the roads safer not only for the driver, but also for everyone else around them. We will construct it to be affordable for the average person, and hopefully it will be able to be sold for widespread use, making our roads much safer.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Materials

Arduino Board

10x 5mm LEDs (Green, Yellow and Red)

10x ≈ 220Ω Resistor (anything between 220Ω and 470Ω is OK)

MQ-3 Sensor from Sparkfun

Napkin

## Step 2: Making the LEDs Work

To make the LEDs work, connect them in sequence using the Digital Pins 2 to 11 (ten LEDs total). Remember to use a resistor between 220Ω and 470Ω for each LED as shown

## Step 3: Connecting the Sensor

Connect one of the H pin to +5V Supply (use an external power supply for that, it may be too much current for the arduino) and the other one to Ground.

Pin B connect to Ground.

Pin A connects to the 100KΩ potentiometer. In the same pin where connecting pin A, connect a wire to the Analog/Digital Converter in Arduino in order to read the alcohol information.

## Step 4: Sample Code

@ Code for interfacing Alcohol Gas Sensor MQ-3 with Arduino

@ Code by Daniel Spillere Andrade and Daniel Amato Zabotti

const int analogPin = 0;
const int ledCount = 10;

int ledPins[ ] = { 10,9,8,7,6,5,4,3,2,1 };

void setup() {

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

pinMode(ledPins[thisLed], OUTPUT);

}}

void loop() {

int ledLevel = map(sensorReading, 500, 1023, 0, ledCount);

for (int thisLed = 0; thisLed < ledCount; thisLed++) {

if (thisLed < ledLevel) {

digitalWrite(ledPins[thisLed], HIGH);

}

else {

digitalWrite(ledPins[thisLed], LOW);

}

}

}

## Step 5: Our Code

int mq3_digitalPin = 13; // connected to the output pin of MQ3

const int led1 = 2; //this is the led placements

const int led2 = 3;

const int led3 = 4;

const int led4 = 5;

const int led5 = 6;

const int led6 = 7;

const int led7 = 8;

const int led8 = 9;

const int led9 = 10;

const int led10 = 11;

void setup(){

Serial.begin(9600); // open serial at 9600 bps

pinMode(mq3_digitalPin, INPUT);

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(led4, OUTPUT);

pinMode(led5, OUTPUT);

pinMode(led6, OUTPUT);

pinMode(led7, OUTPUT);

pinMode(led8, OUTPUT);

pinMode(led9, OUTPUT);

pinMode(led10, OUTPUT);

}

void loop()

{

Serial.println(mq3_value);

delay(100); //slow down the output

if (mq3_value>=0){ //lighting leds for alcohol reading

digitalWrite(led1, HIGH);

}

if (mq3_value>=1){

digitalWrite(led2, HIGH);

}

if (mq3_value>=3){

digitalWrite(led3, HIGH);

}

if (mq3_value>=6){

digitalWrite(led4, HIGH);

}

if (mq3_value>=9){

digitalWrite(led5, HIGH);

}

if (mq3_value>=12){

digitalWrite(led6, HIGH);

}

if (mq3_value>=15){

digitalWrite(led7, HIGH);

}

if (mq3_value>=18){

digitalWrite(led8, HIGH);

}

if (mq3_value>=21){

digitalWrite(led9, HIGH);

}

if (mq3_value>=24){

digitalWrite(led10, HIGH);

}

}

## Step 7: Procedures

1.) Wire up Arduinio Nano as shown in schematics

2.) Code the Arduino

3.) Using alcohol, wet a napkin or paper towel and waft in front of sensor

4.) Record number of LEDs that light up

## Step 8: Data

Unfortunately, the sensor in the device is broken and unable to collect proper data. however, the code used has been looked over and approved by the instructor as correct.

The experiment is easily repeatable, and able to be done in under two hours. However, during the entire experiment, the user should keep alcohol away from their eyes, and rinse for 5-10 minutes in running water id contact occurs. Keep away from bare skin to avoid irritation. In case of consumption, the user should drink large amounts of water to dilute.

With the code used, the sensor is able to display variable outputs of inebriation in 10 different levels. Each LED corresponds to a BrAC of 0.01, increasing in increments of 0.01. With this, if over 6 LEDs are lit, the user is over the legal limit, and should not drive. Anything over 2 LEDs means the user should not drive at all.

In order to maintain the accuracy of the device, the user should wait 30 minutes since last having alcohol in the mouth. this is to prevent a higher reading by displaying improper values. Once 30 minutes have passed, blow on the MQ-3 sensor about 6 inches away from the device.

## Step 9: Results

When alcohol is wafted in front of the device, the MQ-3 sensor will give off a reading of (#) LED's. This means that the device is able to properly determine the amount of alcohol in BrAC, and can determine that the user is under the influence or not. This device can then be used in everyday situations, providing the user with valuable information on their state of soberness. This will alert the driver that they are under the influence, and unable to drive.

The sensor was determined to be broken because it is constantly displaying a Digital Output when none is there. However, the device with the wiring provided and the code provided will work.

## Recommendations

• ### Internet of Things Class

22,867 Enrolled