When companies like SeeedStudio and Sparkfun began offer gas sensors, the alcohol sensor just looked like way to much fun to the beer drinking nerds out there. A few breathalyzer projects popped up as a result. However, those projects never seemed to capture this low quality alcohol sensor well enough. Well, I’m happy to report, I think I have found just the way to do it; An old fashioned analog panel meter.
Now when I started this project, I knew I wasn’t going to make a police quality BAC tester, but I knew I could atleast make something fun. I wanted to lay down the project as I have it now for anyone who was interested in building it this way. However, in the future, I am planning an ATTiny based version that is ready to be kitted up into a nice, small, portable box. (Perhaps MintyBreathalyzer?)
Carrying on; Let’s get rolling. Here is a quick and easy parts list:
- Arduino – Any model. (If you’re willing to re-write code, any uC with analog to digital will suffice.)
- MQ-3 Alcohol Sensor: I picked mine up from Sparkfun, but there are other sources.
- Panel Meter: I am working with a 20mA current meter. However, it will be driven off of PWM so you can use anything as long as you are willing to experiment. I’ll cover this in detail later, but for reference, I picked up my meter from Sparkfun as well.
Step # 1: Wiring The Panel Meter:
Now, as I mentioned before, I’m working with a 20mA current meter. We will be using PWM to drive the meter, so if you’ve got any other meter will work, but you’ll need to determine the correct current limting resistor to attach. For myself, I worked mostly from guess and check. Using the example ‘Fade’ code in Arduino, I wired the panel meter with one pin going to ground and the second pin running through the current limiter, into a PWM enabled digital pin. (I used 6.)
As an example to determine your current limiting resistor;
From the Arduino website, I read that each I/O pint can pull 40mA. With that in mind, I knew I had to limit that current down to 20mA. Knowing the PWM will span from 0-5v, at the highest point, the pin will be writing 5v to the panel meter. So, using ohms law, lets determine our resistance:
R= V/I = 5v/0.02amp = 250.
To keep things simple and moving, I popped in a 220ohm resistor.
Step #2: Wiring The Alcohol Sensor:
The alcohol sensor is a bit more difficult. Essentially, it is composed of a heating element, and a voltage detector. This is the simplest way to wire the sensor as I found via Wiring.
Step #3: Code
The last and final step is the code. I’ve written a super simple little sketch to map the analog value to PWM values using the Map Function
/*
Super simple breathalyzer code.
Ryan Barnes - http://www.thelowtech.com/
To use:
1. Change pin definitions to match your setup.
2. Upload and run sketch.
3. View the serial monitor. The left number is the result your sensor
initially reading. Allow for ~2-3hours of burn in.
4. When the value has leveled off after burn in, plug value into the
map function as the low value (currently set to 300.)
5. Drink, blow, be marry!
*/
int sensorPin = A0;
int meterPin = 6;
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
Serial.print(sensorValue);
Serial.print("\t");
int level = map(sensorValue, 300, 1023, 0, 255);
Serial.println(level, DEC);
analogWrite(meterPin, level);
}
Final Wiring & Schematic

A little wiring diagram done in Fritzing. My first attempt with it, so bare with me! I made the lovely panel meter graphic though, and I think it is pretty awesome!

Their Schematic editor wasn’t easy to deal with…I can’t seem to find a way to lock nets to a grid…
However, their breadboard view is pretty great. Hope it is helpful, I spent WAY to long on it!
All the being said, let me know if anything is missing, or incorrect and I’d be happy to help fix it!
Cheers, drink up!
It’s been far to long since I’ve been by to update. I hate myself for dropping off yet again…seems like a habit I can’t break. I like to make excuses like being trapped in two of the most difficult terms of my life, or relocating to Idaho for an internship, but I don’t think they are valid…I’m just a lazy bum. In an attempt to fight my laziness, (or better yet, inconsistency) let me list off the things keeping my busy since I’ve been away, and some of the crazy awesome posts I’ve got lined up to fill in all of the time I’ve been away!
First and foremost, the biggest project I dove into and never looked back was building a Reprap onces and for all! Out here in Idaho, the Idaho Reprap Users Group is absolutely amazing. I was able to get some quality printed parts, smooth rod and a build platform for a local in the group, motors came from a shop up in north Idaho, timing belts came from western Idaho, electronics and plastic from Ultimachine, and hardware from a local fastener supply shop that severely undercharged me, despite my protest. The build went fantastically, and well, it still is…a project that is truly never finished; one that spawns its own offspring! I’ll be putting a detailed build log here soon, with complete sources and costs, and my trials and tribulations along the way.
Secondly, tied along with the Reprap build, I was lucky enough to be roped in the formation of Open Lab Idaho, a hackerspace based here in Boise Idaho. While we are still working on getting the space up and running, (401c incorporation is not terribly easy.) its already been a blast. If you’re in Idaho, you’ve got to come by and check out the space when the doors finally open.
Thirdly, I’ve got my new workbench populated by the unfinished projects from last winter. Namely, the breathalyzer and the simple bot. Both of those will be perfectly well documented here, with video and written tutorials, and more.
Fourth, tying in with the video tutorials I mention above, I’m going to attempt to start a series of video tutorials / screencasts. The idea spawned from an attempt to teach classes on Reddit’s University of Reddit. Bandwidth issues, and attendance foiled my attempt at a live class, so I’ve been working recording videos offline. Expect to see those in the next few weeks!
Lastly, and maybe most importantly, I’ve been doing a huge amount of thinking and growing as a person. I’m far away from home here in Idaho, far from my friends and family, for the first time in my life. Not to mention working the first job that I can say I do not enjoy. Surely this kind of experience has kept the gears in my brain spinning nonstop, and I’ve got a ton to say about what I’ve learned on the road, in the corporate engineering world, and in good ol’ Boise Idaho. That being said, I’ll be working on a series of articles about my love of the made world over the organic world, the follies of career planning in our current state, how I’ve come to terms with not being an engineer, and my observations of online education.
Of couse, I’ve been my usual self too…attempting to get out snowkiting when the wind is blowing 40mph, sampling the local brews, digging up what little music and culture I can find around town, biking around, making friends (and enemies) and most importantly keeping my new lovely lady entertained:
Along with the Science Carnival and Maker Field Day, the organizers at Philadelphia Science Week asked me to bring a 3D printer on the Preston and Steve show for their annual Science Day…how could I turn that down? Along side some guys from the Franklin Institute, we played with science all day.
I have to say, I love when to see kids get really excited about science, but Preston and Steve…they out do the children.
…by the way, this is what happens when a soda bottle full of liquid nitrogen underneath a pile of ping pong and play pin balls explode.
It was an awesome morning that I was happy to be a part of! If the photo doesn’t suffice, feel free to check out the videos!
When the Philadelphia Science Carnival started organizing, they came to NextFab to see if we wanted to help plan an event. I jokingly mentioned a long running idea I’ve had for a ‘Maker Field Day’ full of competitive making…sure enough everyone loved it and we ran with it.
I designed 4 quick and simple ‘Maker Challenges’, speed soldering (good old fashioned who’s the fastest on the iron), “Foamwood Derby” (Pinewood derby…but with foam blocks and shaving tools!) , paper tower (One sheet, 50cm of tape…build it tall!) and Bristlebot racing (Words can’t describe, but this link can.).
It was a ton of work putting all of the kits together, working out the logistics, scheduling, etc etc…but it all came together great. We had a full turn out fill the Harcourt Center at the Franklin Institute…and to make things really incredible, Dean Kamen himself was kind enough to take time out of his day in Philly to present the winners with their prizes.
If you were to tell me 2 years ago I would plan an event that Dean Kamen would attend, I would say you were crazy! It was an amazing event and I had a black putting it all together…now perhaps this will be an annual affair?
I should have more exciting photos soon. For now, all I have is this photo taken on some antique camera that uses something called ‘film‘.
For the last 2 months, I’ve had the pleasure of being able to work with a group of students from Philadelphia Futures as they developed their ROV for this years Seaperch, Drexel’s annual High School / Middle School ROV competition. The team worked incredibly hard for all 2 months, coming in on weekends, staying late and pushing the limits of what they could do…and it certainly paid off! Placing third for their notebook of documentation and second for team spirit.
I had an amazing day today…bright and early, the day started on Logan Circle for one of the greatest events I’ve been a part of in Philadelphia, the Philadelphia Science Week Carnival. I was there with Nextfab, show people some of our desktop printers, which paled in comparison to the amazing stuff happen. There were robots galore, animals, chemistry, biology…just an awesome event that Philly has been missing.
And after all of this, the day wrapped up with Seaperch, with an amazing performance by the Philadelphia Futures kids!

Just finished the weird sound generator project. It lives in a pretty Toy Story themed lunch box now. I’ve chopped off some filtering in the intentions to get more sharp tones which worked out great. I’ll be working on a schematic of my final design later, as well as an Eagle board design that I’ll be etching…that if I have enough time, to be honest with myself.
Today at work we got a pretty laser cut box that contained an even prettier circuit board….being way to busy at work to tinker with this, I brought it home to see what I could do.
It came packed with a few connectors, 6 pin ISP jumper pins and the best of all, a knock off Nintendo controller.
Taking a look at the board, we find an Atmga644, an AD723 NTSC Encoder, a few PICs (24 & 33), RCA audio and video out and a 3.5mm headphone jack…looks familiar.
Attaching the disconnected RCA plug, headphone jack and nintendo connector, and powering it up, we hear a polite suggestion. Plugging into a TV, we get a nice little welcome screen…perhaps taunting us.
I’m giving no hints here. If you’re half as nerdy as I am, you’ll get the trick in no time!

I’ve been overly busy as of recent, but I had a beautiful day off to work on some projects. I spent a bit of time getting my little synth project to make noise (success) and starting a new wearable project.
Im also writing this from my new phone, being fancy. I took a super artsy photo of the WSG breadedboarded with it. I love apps, turns me into an instant artist!
I bottled up my homebrew today, and I filmed myself doing it. Thought it’d be fun to speed it up:











