Google+ Facebook Twitter Pin It Reddit

My Story logo

My Story: iPhone Breathalyzer

By Omar Arriaga

Just-for-Fun Arduino-Based Alcohol Sensor App

You never know what your next big source of inspiration will be. My inspiration came with beer – lots of it. I was at the bar with some of my friends and we started discussing how great it would be if there was a breathalyzer application for the iPhone. Some of my friends thought creating a breathalyzer app for the iPhone was impossible. I wanted to prove them wrong.

Note: This project is just for fun, it is not accurate enough to use as a reliable BAC detector. DUI laws vary by state.

iPhone Breathalyzer App I was already familiar with the Arduino microcontrollers, so I researched to see if there was a way to connect an Arduino to an Redpark serial cable and started playing around to see if this would serve my purpose.

The Redpark cable connects any iOS device to RS-232 serial. I then used a converter to convert serial RS-232 to TTL (transistor-transistor logic) so that the Arduino was able to process the signal.

The Arduino with an alchohol sensor would be used to read the alcohol level. The reading would then be displayed on the iPhone, like a serial display. The display is the real fun in this project. I decided to use a traffic light image, so that when the BAC (Blood Alcohol Content) was below 0.08% (the legal limit in California) a green light would turn on. A yellow light would turn on when the BAC is between .08% and 0.25%. And for my over-achieving friends a red light would signal a BAC level of 0.25% or higher. It's not clear that anyone with that BAC reading over 0.25% would actually ever see the red light, because chances are that they would probably be dead. Just for fun, I also added another line that displays a different phrase with each of the levels.

Arduino 0022 Some of the parts that I used in this project were:

Redpark serial cable
Arduino Nano
Alcohol sensor (MQ-3)
RS232 to TTL converter
9V Battery

Creating the Arduino code was pretty simple; it read the sensor every five seconds and displayed the reading on the iPhone. Since the Arduino reads the formula in PPM (parts per million), I need to find a way to convert the PPM to BAC. Here is the code I used.

Here are the three different screen images from levels of alcohol in the program. Don't ask me how I got the last two.

Arduino 0022

To finish up my invention, I put the Arduino Nano, alcohol sensor, 9V battery and the RS232 to the TTL converter into a tin enclosure, (Altoids).

The hardest part of the project was calibrating the alcohol sensor to display accurate results (and oh, the testing we did!). I tried to use different potentiometers to adjust the output of the sensor but it was still not accurate enough. Even though it is not accurate, it is still tons of fun when I bring it to parties to show off my latest invention and see who is the most drunk. Everyone gets a kick out of it, even if they don't remember the next day.

My DIY breathe-in device My DIY Breathe-in Device
My iPhone breathalyzer monitor

Omar Arriaga attends Canada College in Redwood City, California and is pursuing a degree in Electrical Engineering. His interests include building robots, learning about new electronic gadgets, dirt biking, long walks on the beach and drinks beer (only for research).

If you have an electronics story you'd like to share, please send it to [email protected].