The Talking Breathalyzer

by alinke in Circuits > Arduino

24599 Views, 112 Favorites, 0 Comments

The Talking Breathalyzer

IMG_7530.JPG
Breathalyzer_02.jpg
Breathalyzer_01.jpg
Breathalyzer_03.jpg
Breathalyzer.jpg
*** Additional info at http://droidalyzer.com/talkingbreathalyzer/ ***

Video of the Talking Breathalyzer in Action:


More detail on the Talking Breathalyzer:




A customizable Breathalyzer that talks and tells you how much you’ve had to drink. It’s also open source and can easily be modified with your own text on the LCD screen and audio MP3 files.

When tethered to a PC with a USB cable, it has additional features including character animations, Breathalyzer Tweets, text to speech, weather and stock read-outs, and a Photobooth feature.

The Talking Breathalyzer is not a professional Breathalyzer and should be used for Amusement Purposes Only.

Part List

Seeeduino or Arduino - $25
Seeed Music Shield - $27.50
Seeed Twig Alcohol Sensor - $7.90
Seeed Twig Serial LCD - $13.90
Seeed Twig Cables - $4.90
2 GB MicroSD card (cards larger than 2GB will not work) - $7
Protoboard
10k Potentiometer
4 Momentary Switches
1 Off/On Switch (for power)
5 10k Resistors
1 Toggle Switch
Enclosure of your Choice
LIPO Battery - $23
LIPO Rider - $9.50
Talking Breathalyzer Software - Free
Head Phones
Mini USB Cable
USB Charger
Solar Panel Optional
Speaker Amp and Speaker Optional

*** A cell phone based version of this project is at http://droidalyzer.com ***

Schematic and Assembly

talking-breathatlyzer-schematic.jpg
P1010827.JPG
IMG_7289.JPG
IMG_7293.JPG
P1010802.JPG
P1010803.JPG
P1010810.JPG
IMG_7294.JPG
P1010779.JPG
IMG_7321.JPG
P1010806.JPG
IMG_7405.JPG
P1010799.JPG
P1010798.JPG
IMG_7308.JPG
IMG_7312.JPG
IMG_7505.JPG
P1010800.JPG
P1010815.JPG
P1010815.JPG
IMG_7295.JPG
IMG_7318.JPG
IMG_7334.JPG
IMG_7398.JPG
IMG_7400.JPG
IMG_7401.JPG
IMG_7410.JPG
IMG_7323.JPG
IMG_7411.JPG
IMG_7491.JPG
IMG_7418.JPG
Assemble following the schematic below. The assembly and layout will vary depending on the enclosure you are using. I used Adafruit's Arduino case but note that the Serial LCD used made by Seeedstudio is an older model, the new Serial LCD from Seeed will not fit into this case so you'll either need to find a bigger case or go with an alternative Serial LCD. I had a custom PCB board made but you can just as easily use a generic proto board and simply cut out the shape you need. This video describes the components of the Talking Breathalyzer.


Using the Breathalyzer in Portable Mode

IMG_7520.JPG
IMG_7490.JPG
The Breathalyzer comes presetup for stand alone mode. In stand alone mode, the Breathalyzer runs on its own battery power without a connection to a PC.

The Breathalyzer has 4 buttons. Button 1 starts the Breathalyzer function by first heating up the alcohol sensor for 20 seconds and then prompting the user to blow. After the user has blown, the Breathalyzer results are announced (LCD screen and Audio) and then the alcohol sensor is powered down and the Breathalyzer goes into an idle state. While in idle, the LCD screen, Arduino microcontroller, and speaker amp will continue to draw power so it’s best to power off the Breathalyzer while not in use to conserve the battery. Buttons 2,3, and 4 are open to be programmed for custom functions.

The toggle switch changes the Breathalyzer back and forth from normal operation to raw data operation. When operating in raw data, the alcohol sensor is heated up and alcohol sensor value is displayed on the LCD screen. Note: Keeping the alcohol sensor heated up in this mode will increase the drain on the battery. Raw data operation is useful if you want to overwrite the default Breathalyzer calibration settings and also to see the alcohol sensor data values.

Turning the knob will change the character that speaks the Breathalyzer results. You’ll hear a different character sound as you turn the knob and the character changes. Stop turning when you’ve got the desired character.


Using the Breathalyzer USB Tethered to a PC (PC Mode)

pc mode.JPG
twitter1.jpg
twitter3.jpg
twitter4.jpg
twitter5.jpg
photobooth1.jpg
photobooth2.jpg
photobooth4.jpg
photobooth3.jpg
photobooth5.jpg
drink1.jpg
drink2.jpg
drink3.jpg
drink4.jpg
photobooth20117202122046.jpg
photobooth201172020632687.jpg
photobooth2011720213349984.jpg
Step 4 describes how to switch the Breathalyzer to PC mode which involves downloading a new Arduino firmware to the Breathalyzer and then USB connect the Breathalyzer to your PC. In PC mode, the Talking Breathalyzer includes additional features:
  • Animated Readouts of Breathalyzer Results with 4 Characters (Spooky, New York Cabbie, Old English, and Pirate), See the Characters here
  • Tweeting of Breathalyzer Results (optional and turned off by default)
  • Weather and Stock Readouts
  • Photobooth Feature
  • Customizable Breathalyzer Audio Responses with Text to Speech or User Supplied MP3s
Video of the Talking Breathalyzer in PC Mode:

How to Switch From Portable Mode to PC Mode and Vice Versa

switching-modes.jpg
This video describes how to toggle the Breathalyzer from stand alone/portable mode to PC/USB connected mode.

Customizing the Breathalyzer in Portable Mode - Arduino Code Walk Through

Breathalyzer_02.jpg
Breathalyzer.jpg
Breathalyzer_01.jpg
Here's how to customize the Breathalyzer Arduino code when it's running in stand alone/portable mode. These two videos describe the code for the portable mode. The actual code is here.

Breathalyzer Arduino Code Walk Through Part 1 Video:



Breathalyzer Arduino Code Walk Through Part 2 Video:


Adding Custom Functions in Portable Mode

Breathalyzer_01.jpg

In addition to the Breathalyzer function, there are three buttons available (buttons A, B, and C in the schematic) for custom functions.

In the default code, button 2 displays “TIME FOR BEER” on the LCD screen and plays a beer drinking song you supply. To use this feature, rename a beer drinking song of your choice to beer.mp3 and copy to the root directory of the microSD card.

In the default code, button 3 is a “Name that Show” game.  When button 3 is pressed, a TV show theme song plays and then the user has a few seconds to guess the name of the show before it is displayed on the LCD screen. To use this feature, you’ll need to supply your own MP3 sound clips copying them to the root of the microSD card and then editing the show and mp3 names in the code. The theme song MP3s can be as long as you like but it’s recommended to keep them to 15 seconds or less to keep the flow of the game going. Thus, you’ll want to use an audio editor to shorten them.

/////********* SHOW THEMES HERE ******************************

prog_char string_65[] PROGMEM = "dallas.mp3"; //show tune

prog_char string_66[] PROGMEM = "DALLAS";     //displays the name of the show on line 1 of the LCD

prog_char string_67[] PROGMEM = "";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

prog_char string_68[] PROGMEM = "mvice.mp3"; //show tune

prog_char string_69[] PROGMEM = "MIAMI VICE";     //displays the name of the show on line 1 of the LCD

prog_char string_70[] PROGMEM = "";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

prog_char string_71[] PROGMEM = "airwolf.mp3"; //show tune

prog_char string_72[] PROGMEM = "AIRWOLF";     //displays the name of the show on line 1 of the LCD

prog_char string_73[] PROGMEM = "";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

 

In the default code, button 4 is a “Name that Movie” game and works in the same manner as button 3. Here also you’ll need to supply your own MP3s copying them to the root of the microSD card and then edit the movie names and mp3s in the code.

/////*********MOVIE QUOTES HERE ******************************

prog_char string_188[] PROGMEM = "2001.mp3"; //movie quote

prog_char string_189[] PROGMEM = "2001 SPACE";     //displays the name of the show on line 1 of the LCD

prog_char string_190[] PROGMEM = "ODDESEY";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

prog_char string_191[] PROGMEM = "airplane.mp3"; //show tune

prog_char string_192[] PROGMEM = "AIRPLANE";     //displays the name of the show on line 1 of the LCD

prog_char string_193[] PROGMEM = "";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

prog_char string_194[] PROGMEM = "dodgebal.mp3"; //show tune

prog_char string_195[] PROGMEM = "DODGEBALL";     //displays the name of the show on line 1 of the LCD

prog_char string_196[] PROGMEM = "";           //continues to display name of show on line 2 of LCD if needed, leave blank if not needed

 Of course if you know a little Arduino programming, you can modify the code and do whatever you want.

The Source Code for PC Mode - Adobe Flash Action Script 3.0

logic diagram.jpg
pumpkin drunk.jpg

The PC application that powers the Talking Breathalyzer is written in Adobe Flash Action Script 3.0. The diagram below shows how it works: The PC software listens for data coming in from the Arduino via a serial server (serproxy.exe) which is a background process running on the PC.

Here is the source code if you want to make any tweaks on your own. The main program is fairly complex and consists of 8,000+ lines of code but if you know your way around Action Script 3.0, you'll be able to figure it out. You'll need a copy of Adobe Flash Professional CS5 or higher to open and compile the source. Definitely shoot me a note if you add something cool.

Software Installation and Manual

breath-config.jpg
After you've built the Talking Breathalyzer, you'll need to the Breathalyzer software to get things up and running. This step describes how the install the software for both Portable and PC Modes. Sorry Mac and Linux users,the automated installation program is for Windows users only. The software will work on the Mac and Linux but some additional manual setup steps would be required.

1)  Download the Breathalyzer Software from http://talkingbreathalyzer.com/install.html.

 2)  Launch the setup program and follow the prompts to install the software.

 3)  Insert the USB cable into the Breathalyzer and plug the other end into your PC.

 4)  If you’re on Windows 7, the driver should install automatically. If you’re on Windows XP, you’ll be prompted for the driver. Install the driver from c:\Program Files\Breathalyzer\drivers or c:\Program Files (x86)\ Breathalyzer\drivers if your OS is 64bit.

The driver will install automatically on Windows 7.

 5)  Window XP Users Only: Driver install for XP users.

After installing the driver, you will be prompted to run through the same screens a second time.

Note: The software installation also includes a customized version of the Arduino software. If you are an existing Arduino user, technically you could use your existing Arduino software to modify the code but you’ll need to copy in some extra files and libraries so rather than go through this trouble, it’ll be easier to just use the customized Arduino install included with this installation.

The full manual can be downloaded here http://talkingbreathalyzer.com/manual.html

Alternate Case Installation

IMG_7249.JPG
IMG_7063.JPG
IMG_7083.JPG
IMG_7122.JPG
IMG_7140.JPG
IMG_7128.JPG
IMG_7226.JPG
IMG_7147.JPG
IMG_7148.JPG
IMG_7149.JPG
IMG_7162.JPG
IMG_7158.JPG
IMG_7131.JPG
IMG_7133.JPG
IMG_7134.JPG
IMG_7246.JPG
IMG_7142.JPG
IMG_7165.JPG
IMG_7184.JPG
IMG_7185.JPG
IMG_7187.JPG
IMG_7189.JPG
IMG_7113.JPG
IMG_7190.JPG
IMG_7203.JPG
IMG_7213.JPG
IMG_7229.JPG
IMG_7233.JPG
Here's another Talking Breathalyzer build, same insides just with a bigger case. The extra room makes it easier to get the components in there and also there is a room for an internal amp and speaker.