Drunkpong: An excuse to make a USB Breathalyzer

You're throwing a party for the Game Developers Conference and you think it would be cool to have a custom game. What's the natural response? How about Pong that adapts its difficulty based on how drunk you are!

Among my numerous interests is custom hardware for games and interactive art. When my friend and coworker Matthew Wegner suggested the idea of making a breathalyzer peripheral for a party game at GDC, how could I respond with anything but, "Hahahaha, Hells YES! I am ON that!"

I started by researching the various consumer breathalyzers. In the end I decided to hack the Alcoscan AL2500. It provides readings within a reasonable error tolerance and costs about $30 on Amazon -- much cheaper than fuel cell meters. Upon opening it up, I found that it's set up pretty simply. It's driven by an ATMEGA48V-10AU microcontroller, with the semiconductor sensor connected to an analog input, and digital outputs that drive a simple seven-segment style LCD.

Alcoscan AL2500 BreathalyzerBoard, back. Simple AVR microcontroller with sensor as an analog input and LCD as digital outputs

As I saw it, there were basically two options for obtaining the data from the breathalyzer and sending it to the computer. On the one hand, you could read the analog value from the breath sensor, or on the other hand, you could reconstruct the LCD digits from the digital outputs. Since the analog circuit driving the sensor was a little complicated and beyond my expertise (and I'd procrastinated enough that learning more before GDC was out of the question), I decided to reconstruct digits. I first followed traces on the PCB to find which pins on the microcontroller were driving the LCD. I then systematically grounded each pin while turning the unit on to determine which pins drove which LCD segments.

Mapping out which pins control which LCD segmentsPin cross reference for AVR microcontroller and LCD

I then soldered wires to the relevant LCD outputs on the board (the connectors were nice and big compared to the microcontroller pins). I spent a bit of time determining which outputs from the LCD I wanted to read. As it turns out, you only need five segments from a seven-segment digit to determine the numerical value of the digit -- the bottom and bottom right segments are superfluous (see Matt Mets's recent post, who solved the problem independently). I ran a total of eleven wires -- two digits for the BAC level and one wire for the "Wait" indicator -- into digital inputs on an Arduino Diecimila. The Arduino code ended up pretty simple -- it reconstructs two digits and the status of the "Wait" indicator and transmits these serially via USB.

You only need to observe five segments of a seven-segment display to know which number is displayedSoldering more wires - first digit done

I then read the serial data in using the Java RXTX library and spit it into a text file, which I then read in from Unity. The game then makes the paddle size larger the drunker you are!

Waiting for the player to use the breathalyzerPlaying with Player 1 significantly drunk

The hardware is of course begging to be used in other ways -- how about a program that locks you out of Ecto and your forum accounts when you're right trashed? No more embarrassing comments that you can't take back! I may go back and make a more sophisticated game in the future -- Pong was about the right scope for the single day of development time I had left after handling the hardware and serial transmission!

I'll have the game up for play at the 9Bit indie games party Tuesday night -- if you're at GDC just find folks from Flashbang, Gastronaut, or ThatGameCompany to get an invite and drink tickets! I'll post an Instructable and some more information about the software when time permits. Extra special thanks to Becky Stern and Matt Mets for their advising on the hardware interface!

8 Responses to “Drunkpong: An excuse to make a USB Breathalyzer”

  1. NiñoScript Says:

    Ohh, that is really nice. I think i'll make one of those sometime
    althogh i think that my friends will always have the biggest possible pad :-P

  2. Mekanik Says:

    Awesome!!

  3. Can we use AI to alter game mechanics? | plant seeds Says:

    [...] turns out that enjoyment varies quite a bit between users. So what we can do is build our games as adaptive systems. Part of the work I am doing at the moment involves tuning game parameters to adapt to user [...]

  4. Nancy Says:

    Hi Matt,

    And here I was thinking I was the most original student game designer in the universe when I thought of making a USB breathalyser to affect game performance. Tsk tsk to me.

    Though I know this post is pretty old, I was wondering if you ever got around to posting an instructable on how to construct such a device? We have a budget of $500 to spend on our project and I was hoping to avoid wasting $350 on piece that comes with a USB output. But it may be my only choice since my hardware hacking experience is pretty lame at best.

    Thank you for any help you can offer. This is truly an amazing work.

    - Nancy

  5. Surge Says:

    This is pretty cool for a party game. I would like to see the instructable as will if you can post them still. Thanks for the post.

  6. angel Says:

    Hello sorry for my english, is there any possibility to see the arduino code to undestand how to repeat the hack of the breathalyzer.
    thanks

  7. Paul Says:

    Hello,

    Is there a way to hack the alcoscan to read 0.00 regardless of alcohol contained in breath?

    Thanks...

  8. Brian Says:

    Matt! Awesome post. I know it is old- and I am with Nancy, we're trying to make a cool "toy" for a charity gala and I would love to piggy back off of your work, rather than start all over figuring out the display on the alcoscan.

    Please let me know if you would be willing to share your notes.

    Best,
    Brian

Leave a Reply


GENERIC ANTABUSEVENTOLIN SIDE EFFECTSRevia