Introduction: Boozeduino

About: I make projects, they have names. Some are obscure and some straightforward. Form or Function; I go either way. Battery powered or edible, I love making things.

Now with more LED.

Arduino mega powered breathalyser using the MQ-3 sensor.   A relative gauge for judging how intoxicated you are.
NOT TO BE USED AS MEANS OF BREATHALYZING NEVER DRINK AND DRIVE.
This is more of a device to encourage one to drink more. The MQ-3 can't achieve the accuracy to register exact BAC.
And It behaves weirdly. Sensitive to temperature and humidity. This is purely for fun.

Links

http://nootropicdesign.com/projectlab/2010/09/17/arduino-breathalyzer/
http://www.danielandrade.net/2010/03/07/building-an-breathalyzer-with-mq-3-and-arduino/
http://www.gfxhax.com/drinkshield/drinkshield-coding/
http://www.sparkfun.com/datasheets/Sensors/MQ-3.pdf
http://nootropicdesign.com/toolduino/ Awesome tool for this, made testing MQ-3 analog levels a snap.


Intro
My first project, instructable, First everything. I'm a total noob and my main goal was to not burn out any chips. I got an Uno early in January and my girlfriend got me an MQ-3(among other goodies) for Valentines day. I had blinked and breadboarded but hadn't tried a complete project. Here it goes......

Step 1: Parts & Tools

PARTS LIST

  1x Arduino+Mega+2560  $50  Liquidware     *Great Price*
  4x 5mmClearBlue Led  $5 Sure electronics
18x 5mmGreenLed  $4 Adafruit
  6x 5mmRedled  $4 Adafruit
10x 5mmYellowLed  35cent/each Sparkfun
  1x MQ-3 Alcohol Gas Sensor  $5 Sparkfun
  1x Drilled PCB for leds   $3 Radioshack 
  1x Power supply PCB for MQ-3  $2 Radioshack   
  1x 7805 Voltage Regulator  $2 Radioshack
  2x 10uF capacitors 
50x 250ohm resistors 
  1x Project Box  $5 RadioShack
  4x #4 Machine Screws  $2 RadioShack
  2x 9V Snap Connectors  $3 for 5 Radioshack
  1x Really long heat shrink tubing or cord with 4 wire  $2 Local store
  1x Cheap microphone housing(Rockband)  $Salvaged
  1x Mic holder  $5
  1x On/off Switch
  1x spool of solder
  1x alcohol hand sanitizer 
  1x pieces of velcro for mounting
  1x tube of adhesive 
  Lots of wire in multi colors

Tools

   Solder Iron
   Heat Shrinker(Blowdryer or Lighter at worst)
   Multimeter
   Helping Hands
   Usb cable
   Arduino IDE 021
   Dremel and/or Drill
   3/8" bit
   Flathead screwdriver

    Alot of stuff for a newbie but if you been at this a little bit, you've got most of these things, minus the MQ-3.  You could use any number of other project boxes, more or less LEDs.  This is a real flexible project.

Step 2: The Code

/*

@ Code for interfacing Alcohol Gas Sensor MQ-3 with Arduino
@ Code by Daniel Spillere Andrade and Daniel Amato Zabotti
@ daniel@danielandrade.net / danielzabotti@gmail.com
@ www.DanielAndrade.net

*/


const int analogPin = 0; // the pin that the sensor wire is attached to
const int ledCount = 32; // the number of LEDs in the bar graph

int ledPins[] = {
  53,52,51,50,49,48,47,46,46,45,44,43,42,41,40,39,38,37,36,
  35,34,33,32,31,30,29,28,27,26,25,24,23,22};
// Here we have the number of LEDs to use in the BarGraph   53 is green 22 is red


void setup() {

for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);
}}

void loop() {
//This is the code to light up LED's
int sensorReading = analogRead(analogPin);

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 3: Mic Teardown and Holder

First, I pried the case open with a small flathead screw driver. Ripped out the existing components.
Then removed and examined the cord. Not 4 wires, no help for us-throw it aside. The non electric parts of the rockband mic give it a nice weighty feel so I wanted to keep those. The MQ-3 fit conveniently inside the rubber housing made for the electret microphone. I then poked a hole through the rubber underside to feed my wires for the MQ-3. The sensor has 6 leads. We will use 4. The sensor is reversible so alignment doesn't matter. 4Long wires(resistance unknown) go to the separate circuit. We read the sensor between the yellow wire and the resistor pulling to ground.
One caveat of the MQ-3 is to let it "Burn-in" for 24-48 hours. Worked for a noob. There are other ways to calibrate the sensor. If you know hardware, set up 2 circuits and read the Datasheets. Software guy, use the Drinksheild.h library from Gfxhax.

Step 4: 5volt Supply

A 7805 voltage regulator to take 9volt battery and provide a steady 5v to MQ-3. We are doing this because the MQ-3 wants enough power (<750ma) that I was worried about frying an arduino. Also, this will supply the lights in the mic housing with power. I wanted a visual indicator for knowing the mic was on. Check one, Check two.

Reference material
http://www.protostack.com/blog/2009/07/atmega8-breadboard-circuit-part-1-of-3-power-supply/

Step 5: LED Array

Let there be Light Emiting Diodes.     I used a breadboard style PCB from radio shack for this part.  To get the sensor to work right,  ALL the grounds need to be connected.  Even though we are using 2 power supplies, connect ALL grounds together with the arduino.   

Step 6: The Case

I pretty much winged it.  This was one of the hardest part of the whole project.  Using a dremel for the first time was not easy(I used the wrong bits).  I should have drilled and filed.  To drill the holes in the front I use a 3/8 bit and sharpied targets with a stencil.  It worked OK.    The real fitting was the all the wires.  Keep em neat and tidy.  

Step 7: Putting It Together

Once I had all the sub-assemblies tested and put together it was time to try and cram it into the box. Agian I kinda winged it. I had to cut a small corner from the LED array pcb. I also cut down the Supply pcb.
The first thing in was the mic holder. Then On/Off switch, battery, power supply pcb. I then soldered my remaining connections and checked everything, again.

Step 8: Drinking and Refining.

The sensor responds better to hard alcohol than beer.  Wine is good.  Hand santizer is great.   Tequila is best.  

My Perfect Margarita:
  3 parts sweet & sour mix
  1 part Tequila Blanca 
  1 part Grand Marnier or Cointreau
Start with ice in salt rimmed glass and an iced martini shaker.
Sweet & sour into the shaker
Tequila and Orange liqueur 
Shake vigorously and pour over ice.  

Be safe and Have fun. 

Microcontroller Contest

Runner Up in the
Microcontroller Contest

LED Contest

Participated in the
LED Contest