Ahmad Rana's Engineering Log

Projects: Drunk-o-meter 

 

 

 

 

Introduction

Engineering Log

Embedded Talks

Contact

 

 

 

Inventors: Sal and Ahmad

Background and Summary:

The idea started in one of our parties, but unlike a lot of great inventions, it was not jotted down on a napkin. All the napkins had already been used up to wipe somebody throwing up. In fact, that’s what started the discussion in the first place. In the morning, instead of a hangover, we came up with a few sketches, and over a couple more beers, we took the idea further by developing the software requirements. It then sat on the shelf for a while, until we decided to revive it.

The basic idea is to combine a breath analyzer with sobriety test (trace a figure on touch screen while avoiding obstacles), and not only automatically call the taxi service if needed, but also scold the guests for being too drunk.

Drunk-o-meter being a hobby project, the objective was to be as cheap as possible. First attempt would be made to salvage the huge stack of goodies that my brother and I have in the basement. If we couldn’t find something specific in our stack, tweak the project requirements to suit it to what we do find. Otherwise, buy it cheaply from e-bay. Only as a last resort were we willing to buy from hobby shops like Sparkfun, Digikey, Mouser etc.

Initial Proposal:

The initial proposal was to develop the system shown in the block diagram given in Figure 1.

Figure 1. Block diagram of initial proposal.

.NET Compact Framework 3.5 was to be used on VDX-6326 SBC (Single Board Computer) to develop software. A cheap, commercial breath analyzer was to be used. Seven segment display would be taken out, and the lines connected to GPIO pins of the SBC. The breath analyzer would be started through output GPIO lines, and input GPIO lines would then be scanned to capture the reading of the breath analyzer. LCD panel with a touchscreen or a pen based device (like in a tablet PC) was to be used as user interface. The touchscreen was to interface with one of the USB ports, and LCD through TFT/LVDS interface of the SBC. Stereo speakers would connect directly to the SBC to provide sound. A GPRS/GSM interface could be considered as a future enhancement to make calls directly to a taxi service if the guest was too drunk to drive.

Parts Procurement:

A breath analyze was bought from e-bay (from China) for about $6, including shipping. When it arrived (Figure 2), it was realized that some information had been lost in translation, and the analyzer had an LCD seven segment display instead of LED as had been advertised. LCD scanning is much more complex than driving LED based seven segment displays. After opening up the meter, it was observed that though doable, even getting leads off from the small circuit board would be difficult. The second option was to scavenge the alcohol sensor, and use an ADC (analog-to-digital converter) to get the signal. Fortunately as a windfall, we were able to get for free an Arduino based microcontroller with a built-in ADC, as well as well as an alcohol sensor along with a break-out circuit board (Figure 3). Apart from being free, another advantage was that Arduino could be connected to the SBC through a USB interface, which was a much cleaner interface that GPIO interface in terms of handling and software development.

Figure 2. A cheap commercial off-the-shelf Breath Analyzer.

Figure 3. Alcohol sensor and an Arduino board with USB interface.

The use of alcohol sensor and Arduino is described in Sparkfun Electronics’ product website, so it’s not reproduced here.

As for the user interface, many options were tried out, including but not limited to, using an old police vehicle touchscreen interface, repairing a tablet PC display, using Wacomb tablet etc. But none of these were successful because of suitable device drivers not being available. Time constraints for the project mandated that device driver development from scratch not to be carried out. Also, a scan of Microsoft’s Embedded Spark forums indicated that other contestants had run into problems using LVDS/TFT interface. So an easier way out was chosen. Use the VGA output of the SBC, and buy a 4-wire resistive touchscreen along with a USB controller. The USB controller was bought from ebay for $40. Unfortunately, when it was received, it was cracked, and a replacement had to be sent out causing another couple of weeks’ delay.

For the video controller, we went through our collection in the hobby workshop, and found an old Datalux LMV10R monitor (Figure 4). A compatible Sharp LQ64D343 6.4” LCD panel had been bought from ebay for $15 (including shipping) a while ago, which was used. This combination of Datalux controller M1023 version E and Sharp screen is very popular choice for hobbyists, and has been discussed at length in the forums at http://www.mp3car.com/.

Figure 4. Salvaging video controller from Datalux monitor.

For backlight inverter, a two-light CCFL inverter which had been bought form e-bay a while ago for less than $10 (including shipping) was used. When everything was put together, it worked out quite nice and gave satisfactory results (Figure 5).

Figure  5. Everything was packaged in foam used by model airplane hobbyists.

As for the sound, the speakers were taken from an old IBM laptop (Figure 6). Fortunately, the connector that came with the speakers fitted right into the SBC audio socket. However, the sound was pathetic. So for the rest of the project, external computer speakers (with a built-in audio amplifier) were used. The final platform is shown in Figure 7. Utilization of the laptop computers was left to future work.

Figure  6. Nice tiny speakers salvaged from an old IBM Thinkpad laptop.

Figure 7. Resulting platform is not mobile as yet, but for proof of concept, components have been used which are suitable for a mobile platform only.

Application development:

Application was developed using managed application environment in .NET Compact Framework 3.5. A new image had been generated to bring in the USB based touchscreen drivers. The screen resolution also had to be changed to 640x480. To support Arduino on USB interface, drivers from FTDI had to be downloaded and built into the image. Graphics used in the development of the product were the courtesy of my brother. Different freely available sound-bites were used, so for commercial application, they’ll have to be replaced.

Known  Issues:

1.    The application is not built into the kernel image. Instead, after the kernel has booted up, it is downloaded using a USB drive, and then run. Project time constraints did not allow the implementation of auto-launch facility which would run the application at boot-time.

2.    Larger sound bites couldn’t be played, so they had to be split into smaller sound bites. This issue needs to be investigated further.

3.    There seems to be a memory leak, because of which the application completely or partially (does not display certain images) crashes after several uses.

Future Developments:

There are two major items that need to be completed before the product can be considered as a product that can be introduced to the market. The first one has already been mentioned, and that is including an audio amplifier. That is trivial work, and in principle, has been shown in the proof-of-concept trial in the video. The second one includes providing access to a telephone line by using an external GPRS/GSM or, if a WiFi hotspot is available, making a VoIP application on the product. The latter option was seriously considered and even investigated, but dropped because of project timeline constraints. Finally, battery options have to be considered to make the product truly mobile.

Drunk-o-meter in Action: