My Story: iPhone Breathalyzer

Just-for-Fun Arduino-Based Alcohol Sensor App

By Omar Arriaga

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.

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.
iPhone Breathalyzer App

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

Redpark serial cable
Arduino Nano
Alcohol sensor (MQ-3)
RS232 to TTL converter
Potentiometer
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.

Arduino 0022

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).

My DIY breathe-in device
My DIY Breathe-in Device
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 iPhone breathalyzer monitor

If you have an electronics story or project you'd like to share, please email MyStory@Jameco.com

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).