/barones-app

Connect a breathalyzer to your phone, take pictures of your drunk friends and their highscores

Primary LanguageJavaScript

Breathalyzer on your smartphone

alt tag

Connect a breathalyzer to your smartphone and take pictures of your drunk friends with their highscores. This project was around two years in the making, I started doing it in Java (the Android part) but got frustrated and left the project sitting in a box all this time. For the smartphone app I'm using phonegap/cordova, so it should work on iOS or windows phone, or at least, it should be easy to be ported.

The idea isn't new, but all similar projects I found, didn't share the smartphone app's code, I do. It isn't the nicest app you could find, but it works.

I tried to recover all the information I wrote done when I first build this, I got most important information but some details and pictures are missing.

Bill of materials

Aproximate cost: 40-45€

Alcohol sensor

Schematics and code was taken from here : http://www.seeedstudio.com/wiki/index.php?title=Twig_-_Alcohol_Sensor It uses the MQ303A.

alt tag

Features

  • Input Voltage: 5V
  • Working Current: 120mA
  • Detectable Concentration: 20-1000ppm
  • Grove Compatible connector
  • Highly sensitive to alcohol.
  • Fast response and resumes quickly after alcohol exposure.
  • Long life.
  • Compact form factor.

Notes

To get better measurement, sensor needs to be power on for several hours before usage. Since this is a "for-fun" app, there's no need to wait long time, and after a few minutes (20-30min) readings are more or less stable. It could last several hours with one full charge of battery.

Bluetooth module

I use the JY-MCU module, very famous and cheap. You can find it in several stores (eBay, AliExpress, DX,...). I also connect one led to their state output. This led will pulse when not connected and switch to permanent on when connected.

You need to program the BT module first You could use the .ino code in arduino/ProgramBTModule to program your BT module. Connect RX (arduino digital pin 2) to TX (BT), and TX (arduino digital pin 3) to RX (BT), upload the code to the arduino and wait a few seconds. The device should appear as CONEJO-ALCOHOL in your phone's BT devices list.

alt tag

Schematic

Handmade schematic since I didn't have the parts in Fritzing or any other schematic editor, I know it's a mess and ugly.

alt tag

The box

Folder openscad-box contains the OpensSCAD and STL files for 3D printing it. Any small box could work too.

Mobile App

The mobile app is done with Phonegap/Cordova ( + angularJS), you need it in your system and this small README file will not cover its installation or general usage. To generate (in my case) the android code, just run 'phonegap build android', later, create the APK with your favorite method (I use Intellij IDEA). The app is really simple, it doesn't catch many errors, but it works. Needs work on the texts and on the style of menus, but I'm really bad at it.

alt tag

Home menu, once you're connected, a new option 'Test' will appear

alt tag

Connecting to your BT device (alcohol sensor)

alt tag

Blow into the sensor during 10 seconds

alt tag

If your 'score' is higher than the lower one, you enter the hall of fame (or shame, I'm not sure)

alt tag

Hall of fame (shame), picture, name, score and date

Disclaimer

This project was developed for fun, do not expect accurate results. For a more serious readings you will probably need better components. Blood Alcohol Content (BAC) could only be estimated from a breath sample and it's usually highly inaccurate. If you need a breathanalyzer to know if you're able to drive, you should not drive. Drink responsibly.

Licenses

This is distributed under the Apache License v2.0 unless some library or code isn't compatible ):

Copyright 2014 Daniel Esteban - conejo@conejo.me

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.