High Level Design

Inspiration Block Diagram Interface Formulae


Introduction

High Level Design

Program/Hardware Design

Results
Conclusions
Appendices

Inspiration
(Or: Inspiration besides the obvious)

Our inspiration for this project came from a very simple illustration of how a Breathalyzer works in the book, The Way Things Work, by David Macaulay. We'd also often found ourselves in situations where we would have liked to know our current BAC, but we had no methods of determining it, beyond crude estimation using the "attempt to touch your nose with your finger with your eyes closed while standing on one leg" method, which often resulted in injuries. Thus was born the Breath-o-Matic.

Block Diagram

 

Interface Description
(Or: What to look for when your vision gets blurry and your brain stops functioning, and you’re not entirely sure whether you just blew into the Breath-o-Matic’s mouthpiece or the dog’s nose)

When the Breath-o-Matic is first turned on, the Main Menu appears on the screen with three choices: press the Green Button to access the High Score List, press the Blue Button the force sample acquisition, or start blowin’!

Pressing the Green Button brings the user to the Breath-o-Matic’s high score list, which cycles through all of the current high scores. If there are no high scores yet, a message to that effect is displayed. At this point, the Blue Button will delete high scores, and the Green Button brings the user back to the Main Menu.

If the user elects at the Main Menu to huff and/or puff into the mouthpiece, the pressure sensor will detect a pressure differential and the Breath-o-Matic will begin taking samples. Pressing the Blue Button will accomplish the same thing. Approximately every half-second, a sample is taken, an LED flashes and the speaker beeps. These actions provide the user with breathtaking (har!) visual and audible feedback.

After about five seconds (10 samples), the user stops blowing, and the MCU waits six seconds, or until the sample has stabilized, whichever comes first. If the sample has not stabilized after six seconds, the speaker makes an angry noise, and the user is ejected back to the main menu to try again, or, if they are feeling belligerent, chuck the device across the room. If the sample has stabilized, the speaker plays a happy tune and the user is presented with their reading, which, for good little girls and boys, may well be zero. We use six LEDs to indicate six different levels of intoxication. These levels include “Sober” (BAC<0.04), “Happy” (0.04≤BAC<0.06), “Tipsy” (0.06≤BAC<0.09), “Confused” (0.09≤BAC<0.12) “Incomprehensible” (0.12≤BAC<0.15) and “Boris Yeltsin” (BAC ≥0.15).

If the user has achieved a high score, by either having a higher BAC than any of the ten current high scores, or by there being fewer than ten high scores on record, then they are notified of their disgraceful achievement and prompted to enter their name via a standard computer keyboard (not included). After name entry, the user is shuffled over to the high score list, where they may see how they stand compared to the ten other lowliest degenerates to have used the Breath-o-Matic. High scorers may wish to celebrate their success with a glass of water, a long nap, and a brain shattering hangover (also not included).

Formulae

The TGS 2620 alcohol sensor functions as a variable resistor, whose resistance has a logarithmic response to ethanol, as shown in the following plot, lifted with no shame from the TGS 2620 datasheet.



Using the Golden Rule of log-log equation determination (i.e., estimating values based on the fact that lines look “pretty close together”), we extracted the following equations for determining the PPM of ethanol in air from the sensor’s resistance:

Region 1 (2 ≤ Rs/R0 < 4): PPM = 244.8(R0/Rs)1.304

Region 2 (Rs/R0 < 2): PPM = 248(R0/Rs)1.323

R0 is a constant that depends on the individual sensor, and Rs is the sensor’s resistance in ohms. We calculated R0 of our sensor to be 6584 ohms. Values of Rs/R0 above 4 correspond to BACs of less than 0.015, and therefore are reported as a BAC of 0.

Parts per million is defined as grams of solute per grams of solvent. BAC, however, is defined as grams of ethanol per 100mL of blood. Because the intention of our project was to be noninvasive, we ruled out our first design, which would use a mechanized needle to puncture the user’s vein, suck out the user’s blood using a 12V pump, and determine the BAC from the blood sample. Instead, we sample the user’s breath, which is less invasive, but slightly more harmful to bystanders and the environment in a halitosital sense. Alveoli (deep lung) air has one twenty-six hundredth of the ethanol (by mass) that blood does. Thus, we can convert to BAC from the sensor’s output of parts per million as follows:

PPM ETOH = (g ETOH / 106g Blood)
BAC = (1g ETOH / 106g blood)(129g air / 1L air)(210)(10-6) = (g ETOH / 210L air) = (g ETOH / 100mL blood)