My final toy project is a device that detects how much alcohol content the user has consumed, connects to an Android based phone, and gives the information to an app I created that determines and displays the BAC on the phone. The benefit of using a smartphone is it minimizes the cost of the hardware by allowing the phone's processor to perform the calculations. This project consisted of two parts: constructing the hardware circuitry and creating the app.
For creating the circuit, I decided to interface to the phone by the audio jack for a couple of reasons. One reason, unlike the usb, it is fully unlocked on all Android devices and has prebuilt libraries in order to use the microphone and speakers. The second reason is because the audio input is similar in design to nearly any smartphone such as the iPhone, and Blackberry. Therefore, the device could easily be ported to any smartphone device merely by making an app for that platform. Like I said earlier, the use of the phone's processor greatly minimizes cost. I now can focus on creating a tone generator that changes tones based upon the input by an alcohol sensor I purchased at Sparkfun for $2. The tone generator consists of a voltage regulator, a couple transistors, capacitors, and resistors. Total cost retail including the case was under $9. For a company mass producing, the cost would be less than a $3 (probably cheaper) to make. To the best of my knowledge there are no patents that use a smartphone as a breathalyzer legitimately, and therefore I will limit detailed designs on this wiki.
The simplicity of the hardware creates complexity in the app. The app took a lot longer than I thought it would take. The app takes the tone generated by the device, checks to make sure the device is connected (or that it is picking up its unique frequency). Then it performs calibration to set the base to 0.0 BAC. It will then request for you to blow into the device for approx 5 seconds. An algorithm takes the varying tone changes, performs Fourier transform, derives the spread between the frequencies from base, and determines the equivalent alcoholic content.
This project took a lot more time than I planned on, but I am excited with the final product. There are some disadvantages to my design. One, the alcohol sensor requires a 5 min before testing to heat up the sensor. This is noted in the specs of the sensor and there is really not much I can do about it unless use a different sensor. But once again this one is cheap and reliable. After it has been used more than once in a short period, the wait time before testing goes down. Second, by using the audio jack, the device cannot receive power via the phone, so it needs to be self powered adding to the size of the device. I decided on a 9V battery because the sensor requires a 5V DC supply and the 9V battery gives me a small package with a relatively good current draw. An alkaline 9V battery produces 400-500 mAh and my circuit takes 159.8mA to run. At approx 6 min per test (cold start) the 9V battery will supply 30-50 tests before dying.
This device was intended to be commercially viable to reproduce; costs and stability were foremost in my design process.
Hardware Build Pics
Alcohol Sensor MQ-3 Datasheet