Food Living Outside Play Technology Workshop Arduino Breathalyzer by Bot1398 on March 31, 2012 Table of Contents Arduino Breathalyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: Arduino Breathalyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Parts & Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 2: The Chemistry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 3: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 4: Creating A 5V Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 5: Build The Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Step 6: Putting It All Togather . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Step 7: Build A Case For The MQ-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 8: Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Step 9: All Done! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 http://www.instructables.com/id/Arduino-Breathalyzer/ Author:Bot1398 I am a 13 year old school student intrested in electronics rather than studies.I developed this hobby when I was 10 and when I found out this site I was like WOW!!! now I can share what I make.I feel that I~N~S~T~R~U~C~T~A~B~L~E~S is the best website ever made. Intro: Arduino Breathalyzer What is a breathalyzer you may ask? It is a device for estimating blood alcohol content (BAC) from a breath sample.In simple terms it is a device to test weather a person is drunk or not. As the title suggests it runs on the arduino.Our breathalyzer uses the MQ-3 alcohol sensor from sparkfun.It is a simple and fun to do project. This instructable explains how to create your own breathalyzer , making a shield for the arduino , putting the breathalyzer in a box, and making some changes to your breathalyzer. This Breathalyzer is not meant to be used as a means of breathalyzing. The MQ-3 is not accurate enough to register exact BAC and is sensitive to temperature and humidity.Never drink and drive and if you do call me =D . This instructable is a entry in the make it real challenge so if you like it please vote. Image Notes 1. The complete breathalyzer Step 1: Parts & Tools Parts: ~ Arduino Uno - Sparkfun.com ~ MQ-3 Alcohol Sensor - Sparkfun.com ~ 100k Ohm Potentiometer - Sparkfun.com ~ 330 Ohm Resistor - Sparkfun.com ~ 5 x Green LED's - Sparkfun.com ~ 3 x Yellow LED's - Sparkfun.conm ~ 2 x Red LED's - Sparkfun.com ~ 7805 Voltage Regulator - Local Electronics Store ~ 1000 uf Capacitor - Local Electronics Store ~ 2 x 9v Batteries - Local Electronics Store Tools: ~ Soldering Iron - Sparkfun.com ~ Solder Wire - Sparkfun.com ~ Jumper Wires -Sparkfun.com ~ Protoboard - Sparkfun.com ~ Project Box - Local Electronics Store ~ Inhaler Tube - I Found It In My House Image Notes http://www.instructables.com/id/Arduino-Breathalyzer/ Image Notes 1. Sparkfun.com 1. Sparkfun electronics Step 2: The Chemistry When the user exhales into a breath analyzer, any ethanol present in their breath is oxidized to acetic acid at the anode: CH3CH2OH(g) + H2O(l) → CH3CO2H(l) + 4H+(aq) + 4eAt the cathode, atmospheric oxygen is reduced: O2(g) + 4H+(aq) + 4e- → 2H2O(l) The overall reaction is the oxidation of ethanol to acetic acid and water. CH3CH2OH(l) + O2(g) → CH3COOH(l) + H2O(l) The electrical current produced by this reaction is measured by a microprocessor, and displayed as an approximation of overall blood alcohol content (BAC) by the Alcosensor. Image Notes 1. I Dont Like Steps Without Pictures Step 3: The Code Heres the code for our breathalyzer: const int analogPin = 0; // the pin that the potentiometer is attached to const int ledCount = 10; // the number of LEDs in the bar graph int ledPins[] = { 10,9,8,7,6,5,4,3,2,1 // Here we have the number of LEDs to use in the BarGraph }; 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); } }} http://www.instructables.com/id/Arduino-Breathalyzer/ Image Notes 1. Open source Step 4: Creating A 5V Supply We will use a 7805 5v regulator to take in 9v from the battery and give out steady 5v to MQ-3 alcohol sensor.We are doing this so that the MQ-3 receives enough power(<750ma).If we connect the MQ-3 directly to the arduino , there is a danger of frying it.I used a single 1000 uf capacitor with the 7805 regulator to give out 5v.I created the 5v supply on a seperate circuit board you can use the same circuit board on which we are going to solder the LEDs.I also connected a switch so that the breathalyzer can be switched on or off.See the last image for the circuit diagram.In the circuit the capacitor is between the middle pin and the right pin (See the picture tag) Image Notes 1. The completed 5v supply circuit Image Notes 1. Capacitor here - http://www.instructables.com/id/Arduino-Breathalyzer/ Step 5: Build The Circuit The Circuit is pretty straight forward.To connect the sensor, you have to connect one of the H pin to +5V Supply (use a external power supply) and the other one to Ground.Pin B (any of them) you connect to Ground.And pin A to arduino analog pin0 via 100k ohm potentiometer.To make the LEDs work, I have connected them in sequence using the Digital Pins 2 till 11 (ten LEDs total). Remember to use a resistor between 220Ω and 470Ω for each LED.I soldered the LEDs on a small protoboard and connected one wire to each LED which connected the LEDs to the arduino.To Power the arduino we are going to use a 9v battery and I also soldered a switch so that the breathalyzer can be switched on or off.I used a common switch for the 5v power supply and the arduino power supply.See the Last Image For The Circuit Diagram. Image Notes 1. LEDS soldered Image Notes 1. Wires soldered to the LEDs Image Notes 1. Wires soldered to the sensor Image Notes 1. The completed sensor circuit Image Notes 1. The LED Circuit Image Notes 1. Everything connected to arduino http://www.instructables.com/id/Arduino-Breathalyzer/ Image Notes 1. The sensor circuit - part one Image Notes 1. Sensor circuit - part 2 Step 6: Putting It All Togather Now that we have built all our circuits and tested them lets put them in a nice case.I used a case from a torch.I drilled 10 holes in the box.I had to respace the solder LEDs to fit them in the holes.First I installed the switch and then the power supply circuit then the LED array and then the sensor circuit .For the sensor wire4s to come out of the box I also made a hole at the side. NOTE: I have installed only one switch as I used a common switch for the 5v supply and the arduino suppky. Image Notes 1. The Box That I Used Image Notes 1. Holes Drilled Image Notes 1. Hole Drilled At the side Image Notes 1. Sensor wires coming out of the hole http://www.instructables.com/id/Arduino-Breathalyzer/ Image Notes 1. LEDs poking out of the holes Image Notes 1. The completed circuit Step 7: Build A Case For The MQ-3 I have asthma so inhalers are common in my house.I used one to fit in the MQ-3 sensor. The inhaled poking out of the breathalyzer box looks cool and professional .To fix the sensor I stuck the wires from the MQ-3 to the inhaled wall using insulating tape.I also kept only one end open for blowing into it and closed the other end using insulating tape.My inhaler has a cap on the blowers end so I can easily close the blowers end Image Notes 1. Inhaler Image Notes 1. Canister removed Image Notes 1. The cap removed Image Notes 1. The Case Ready For Use http://www.instructables.com/id/Arduino-Breathalyzer/ Step 8: Testing Now that we have completed our breathalyzer lets test it.No one drinks in our house so I used listrine for testing as it also contains alcohol. This idea was suggested by mpilchfamily.To test your breathalyzer take some alcoholic drink and gargle it in your mouth and then blow in the tube and you will see the LED array light up.I used white LEDs as I was out of green LEDs. Image Notes 1. The circuit working 2. Not much alcohol Step 9: All Done! Hope this project inspires further experimentation. The Arduino board is incredibly versatile,cheap, and accessible to all hobbyists . This is just one of many simple projects which can be constructed using the arduino. Keep pondering!.Dont forget to follow mores comming up.For any queries contact me heres my E-mail ID r1398ohit@gmail.com Image Notes 1. All Done !! =D Dont Forget To Vote Related Instructables Boozeduino by Grissini The Talking Breathalyzer by alinke The Lightning Simulator/Breathalyzer/Graphic The Talking Halloween Equalizer Breathalyzer Maker Style by Arduino Mark II by alinke Powered by EngineeringShock alinke http://www.instructables.com/id/Arduino-Breathalyzer/ Breathalyzer Microphone by randofo