<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>biphenyl.org &#187; Hacks</title>
	<atom:link href="http://biphenyl.org/blog/category/hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://biphenyl.org/blog</link>
	<description>Aromatic, organic, no longer associated with persistent environmental toxins?</description>
	<lastBuildDate>Sat, 16 Jul 2011 07:03:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Make the Future You Imagined: The Power Glove &#8212; 20th Anniversary Edition</title>
		<link>http://biphenyl.org/blog/2009/04/03/the-power-glove-20th-anniversary-edition/</link>
		<comments>http://biphenyl.org/blog/2009/04/03/the-power-glove-20th-anniversary-edition/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 17:20:45 +0000</pubDate>
		<dc:creator>biphenyl</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Flashbang]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://biphenyl.org/blog/?p=36</guid>
		<description><![CDATA[I always loved the Nintendo Power Glove. Not because it was a fun or useful peripheral &#8212; it wasn&#8217;t. In fact it wasn&#8217;t bad, as Lucas asserted, it was absolutely terrible. Only two games were ever made to work with it &#8212; Super Glove Ball and Bad Street Brawler. You could use it with other [...]]]></description>
			<content:encoded><![CDATA[<p>I always loved the Nintendo Power Glove. Not because it was a fun or useful peripheral &#8212; it wasn&#8217;t. In fact it wasn&#8217;t bad, as <a href="http://www.imdb.com/title/tt0098663/quotes">Lucas</a> asserted, it was absolutely terrible. Only two games were ever made to work with it &#8212; Super Glove Ball and Bad Street Brawler. You could use it with other NES games of course, but it was just an obfuscated controller. Plus, it was horribly imprecise, and since it required a sensor bar to find its orientation, you had to hold your hand at shoulder level all the time. No, I loved the Power Glove for what it represented &#8212; a precursor to virtual reality, a way for humans to directly manipulate computers, like an artifact from some sort of alternate future Earth.</p>
<p>I realized one day that we&#8217;re actually living in that future. It doesn&#8217;t look the same as we imagined it, but the necessary elements are all there. It&#8217;s been 20 years now since Mattel released the Power Glove, in 1989. Especially in the last few years, the availability of sophisticated sensing equipment to hardware hackers has grown by leaps and bounds. Technology like programmable microcontrollers, accelerometers, and Bluetooth are readily available &#8212; and cheap. In short, the time is ripe to re-make the Power Glove &#8212; and make it <em>right</em>.</p>
<p>Over the past month, I&#8217;ve done just that. I stripped the guts out of an original Power Glove, replaced the ultrasonic sensors with an accelerometer, the proprietary microcontroller with an open-source Arduino, and the wired connection with Bluetooth. I wrote an input manager to get the data into <a href="http://unity3d.com">Unity</a>, and hooked it up to the boxing game Adam and I are making for iPhone, Touch KO. What&#8217;s more, I&#8217;ve documented the whole process so that you can make you own!</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3985361&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3985361&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>I have a video, photos, and an instructable of the build process, and have the schematic, Arduino, and Unity code available for download. You can read the data in any way you like, but since many software packages don&#8217;t have direct access to serial ports (Unity included), I&#8217;ve also written a small Java program that takes the input and dumps it directly to a text file.</p>
<p>Side note: Since my last post I tried and now totally dig twitter. <a href="http://twitter.com/biphenyl">Follow me</a>.</p>
<ul>
<li><a href="http://www.instructables.com/id/Power-Glove-20th-Anniversary-Edition/">Instructable</a></li>
<li><a href="http://vimeo.com/3985361">Video on Vimeo</a></li>
<li><a href="http://www.flickr.com/photos/mmechtley/sets/72157615867731266/">Build Photoset on Flickr</a></li>
<li><a href="http://biphenyl.org/projects/PG20Edition/PG20EditionSchematic.pdf">Circuit Schematic</a></li>
<li><a href="http://biphenyl.org/projects/PG20Edition/PG20Edition.zip">Zip of Arduino, Unity, and Java code</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://biphenyl.org/blog/2009/04/03/the-power-glove-20th-anniversary-edition/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Drunkpong: An excuse to make a USB Breathalyzer</title>
		<link>http://biphenyl.org/blog/2008/02/19/drunkpong-an-excuse-to-make-a-usb-breathalyzer/</link>
		<comments>http://biphenyl.org/blog/2008/02/19/drunkpong-an-excuse-to-make-a-usb-breathalyzer/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 09:13:35 +0000</pubDate>
		<dc:creator>biphenyl</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://biphenyl.org/blog/2008/02/19/drunkpong-an-excuse-to-make-a-usb-breathalyzer/</guid>
		<description><![CDATA[You&#8217;re throwing a party for the Game Developers Conference and you think it would be cool to have a custom game. What&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re throwing a party for the <a href="http://gdconf.com/">Game Developers Conference</a> and you think it would be cool to have a custom game. What&#8217;s the natural response? How about Pong that adapts its difficulty based on how drunk you are!</p>
<p>Among my numerous interests is custom hardware for games and interactive art. When my friend and coworker <a href="http://fun-motion.com/">Matthew Wegner</a> suggested the idea of making a breathalyzer peripheral for a party game at GDC, how could I respond with anything but, &#8220;Hahahaha, Hells YES! I am ON that!&#8221;</p>
<p>I started by researching the various consumer breathalyzers. In the end I decided to hack the <a href="http://www.amazon.com/Alcoscan-AL2500-Breathalyzer-Breathalizer-Alcohol/dp/B000OGIREQ">Alcoscan AL2500</a>. It provides readings within a reasonable error tolerance and costs about $30 on Amazon &#8212; much cheaper than fuel cell meters. Upon opening it up, I found that it&#8217;s set up pretty simply. It&#8217;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.</p>
<p><a href="http://www.flickr.com/photos/mmechtley/2276954688/" title="Alcoscan AL2500 Breathalyzer by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2313/2276954688_b21841e347_m.jpg" alt="Alcoscan AL2500 Breathalyzer" height="240" width="180" /></a><a href="http://www.flickr.com/photos/mmechtley/2276957674/" title="Board, back. Simple AVR microcontroller with sensor as an analog input and LCD as digital outputs by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2341/2276957674_ee1d6cd7f9_m.jpg" alt="Board, back. Simple AVR microcontroller with sensor as an analog input and LCD as digital outputs" height="180" width="240" /></a></p>
<p>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&#8217;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.</p>
<p><a href="http://www.flickr.com/photos/mmechtley/2276170061/" title="Mapping out which pins control which LCD segments by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2339/2276170061_720ddc3156_m.jpg" alt="Mapping out which pins control which LCD segments" height="240" width="180" /></a><a href="http://www.flickr.com/photos/mmechtley/2276172743/" title="Pin cross reference for AVR microcontroller and LCD by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2335/2276172743_4f1a68fe09_m.jpg" alt="Pin cross reference for AVR microcontroller and LCD" height="180" width="240" /></a></p>
<p>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 &#8212; the bottom and bottom right segments are superfluous (see <a href="http://www.cibomahto.com/?p=152">Matt Mets&#8217;s recent post</a>, who solved the problem independently). I ran a total of eleven wires &#8212; two digits for the BAC level and one wire for the &#8220;Wait&#8221; indicator &#8212; into digital inputs on an <a href="http://www.arduino.cc/en/Main/ArduinoBoardDiecimila">Arduino Diecimila</a>. The Arduino code ended up pretty simple &#8212; it reconstructs two digits and the status of the &#8220;Wait&#8221; indicator and transmits these serially via USB.</p>
<p><a href="http://www.flickr.com/photos/mmechtley/2276175019/" title="You only need to observe five segments of a seven-segment display to know which number is displayed by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2185/2276175019_89175e3bcd_m.jpg" alt="You only need to observe five segments of a seven-segment display to know which number is displayed" height="180" width="240" /></a><a href="http://www.flickr.com/photos/mmechtley/2276967352/" title="Soldering more wires - first digit done by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2077/2276967352_ff39bfce04_m.jpg" alt="Soldering more wires - first digit done" height="180" width="240" /></a></p>
<p>I then read the serial data in using the Java <a href="http://rxtx.org/">RXTX library</a> and spit it into a text file, which I then read in from <a href="http://unity3d.com/">Unity</a>. The game then makes the paddle size larger the drunker you are!</p>
<p><a href="http://www.flickr.com/photos/mmechtley/2276970964/" title="Waiting for the player to use the breathalyzer by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2240/2276970964_3fb3aeb47a_m.jpg" alt="Waiting for the player to use the breathalyzer" height="182" width="240" /></a><a href="http://www.flickr.com/photos/mmechtley/2276180739/" title="Playing with Player 1 significantly drunk by mmechtley, on Flickr"><img src="http://farm3.static.flickr.com/2382/2276180739_985c0fb33a_m.jpg" alt="Playing with Player 1 significantly drunk" height="180" width="240" /></a></p>
<p>The hardware is of course begging to be used in other ways &#8212; how about a program that locks you out of Ecto and your forum accounts when you&#8217;re right trashed? No more embarrassing comments that you can&#8217;t take back! I may go back and make a more sophisticated game in the future &#8212; Pong was about the right scope for the single day of development time I had left after handling the hardware and serial transmission!</p>
<p>I&#8217;ll have the game up for play at the 9Bit indie games party Tuesday night &#8212; if you&#8217;re at GDC just find folks from <a href="http://flashbangstudios.com">Flashbang</a>, <a href="http://www.gastronautstudios.com">Gastronaut</a>, or <a href="http://thatgamecompany.com">ThatGameCompany</a> to get an invite and drink tickets! I&#8217;ll post an Instructable and some more information about the software when time permits. Extra special thanks to <a href="http://sternlab.org">Becky Stern</a> and <a href="http://cibomahto.com">Matt Mets</a> for their advising on the hardware interface!</p>
]]></content:encoded>
			<wfw:commentRss>http://biphenyl.org/blog/2008/02/19/drunkpong-an-excuse-to-make-a-usb-breathalyzer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Replacing ls in OS X</title>
		<link>http://biphenyl.org/blog/2007/11/10/replacing-ls-in-os-x/</link>
		<comments>http://biphenyl.org/blog/2007/11/10/replacing-ls-in-os-x/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 07:19:16 +0000</pubDate>
		<dc:creator>biphenyl</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://biphenyl.org/blog/2007/11/10/replacing-ls-in-os-x/</guid>
		<description><![CDATA[Ever since I replaced my laptop with a MacBook in January of this year I&#8217;ve been impressed with Apple&#8217;s OS X &#8211; in fact I&#8217;ve moved over to using it entirely, having replaced my desktop with a Mac Pro in July. It has a very snazzy interface and overall good user experience, and underneath all [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I replaced my laptop with a MacBook in January of this year I&#8217;ve been impressed with Apple&#8217;s OS X &#8211; in fact I&#8217;ve moved over to using it entirely, having replaced my desktop with a Mac Pro in July. It has a very snazzy interface and overall good user experience, and underneath all that prettiness it&#8217;s running on BSD so I can hack away via terminal all I like. However, coming from a Linux background, I&#8217;ve found the color options for the default BSD <code>ls</code> command lacking. With the GNU <code>ls</code>, you have a very large degree of control over how things look by using the <code>.dir_colors</code> file in your home directory. With that in mind, I decided to replace the default <code>ls</code> using this simple method.</p>
<p>First, install <a href="http://developer.apple.com/tools/xcode/">XCode Tools</a>, found on the original OS X disc. Alternatively, you can download it from Apple, though it&#8217;s about 1GB. There are a number of useful developer tools included, but what you really want is <code>gcc</code>, the GNU C Compiler. (If you do much programming, you&#8217;ve probably already installed this) The idea here is we&#8217;re simply going to compile the GNU <code>ls</code> and <code>dircolors</code> for our Mac. If you&#8217;ve used Linux much, you&#8217;ll recognize the steps exactly.</p>
<p>Next, download the newest version of coreutils from the <a href="http://ftp.gnu.org/gnu/coreutils/">GNU FTP</a>. Pop open a terminal and make a temporary directory, then decompress the archive &#8211; for instance <code>tar -xvjf coreutils-6.9.tar.bz2</code></p>
<p>Enter the directory created from decompressing coreutils. Now we&#8217;ll compile for our system. Simply run <code>./configure</code> and then <code>make</code> when it&#8217;s done. If either <code>configure</code> or <code>make</code> gives you any guff, you probably just need a new version of XCode Tools/<code>gcc</code>.</p>
<p>Presuming that all went well, we&#8217;ve now got a new <code>ls</code> binary ready to go. To backup your old one (and its man pages) and replace it with the new, simply run:<br />
<code>sudo mv /bin/ls /bin/ls.bak<br />
sudo cp src/ls /bin/ls<br />
sudo cp src/dircolors /bin/dircolors<br />
sudo mv /usr/share/man/man1/ls.1 /usr/share/man/man1/ls.1.bak<br />
sudo cp man/ls.1 /usr/share/man/man1/ls.1<br />
sudo cp man/dircolors.1 /usr/share/man/man1/dircolors.1</code></p>
<p>Don&#8217;t forget to trash the coreutils directory once you&#8217;re done with it.</p>
<p>Now all you need to do is run <code>ls --color=auto</code> to get colored output. I suggest adding the line <code>alias ls='ls -hF --color=auto'</code> to your <code>.bash_profile</code> file. This makes <code>ls</code> color-code output, as well as giving helpful symbols to indicate executable/directory/etc status and displaying file sizes in a human-readable format.</p>
<p>To get the full benefit of the color system, you&#8217;ll also want to create a <code>.dir_colors</code> file in your home directory, and have <code>dircolors</code> run when you start a shell. Add a line to your <code>.bash_profile</code> such as <code>eval `dircolors`</code>. You may <a href="http://biphenyl.org/blog/content/files/.dir_colors">download my <code>.dir_colors</code></a> and modify it if you like. With all that done, you can get pretty results like this:</p>
<p><img src="http://biphenyl.org/blog/content/images/replaced_ls.png" alt="ls with colors!" /></p>
]]></content:encoded>
			<wfw:commentRss>http://biphenyl.org/blog/2007/11/10/replacing-ls-in-os-x/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

