<?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>Scott The Robot</title>
	<atom:link href="http://www.scotttherobot.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.scotttherobot.com</link>
	<description>the things that i do</description>
	<lastBuildDate>Wed, 10 Apr 2013 19:00:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Typing Tweets</title>
		<link>http://www.scotttherobot.com/?p=780</link>
		<comments>http://www.scotttherobot.com/?p=780#comments</comments>
		<pubDate>Mon, 01 Apr 2013 03:55:27 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=780</guid>
		<description><![CDATA[It&#8217;s great to tweet, and it&#8217;s great that people tweet. But the timeline of your and your follower&#8217;s tweets gets big fast. It&#8217;s always been my opinion that Twitter should be as real-time as possible. I loved the text-message model of the Twitter days of yore, though didn&#8217;t love constantly checking my phone. I found [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_820" class="wp-caption alignright" style="width: 310px"><a href="http://www.scotttherobot.com/wp-content/uploads/2013/03/tweets.png"><img class="size-medium wp-image-820" alt="Woo! Prettified tweets!" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/tweets-300x191.png" width="300" height="191" /></a><p class="wp-caption-text">Woo! Prettified tweets!</p></div>
<p>It&#8217;s great to tweet, and it&#8217;s great that people tweet. But the timeline of your and your follower&#8217;s tweets gets big fast. It&#8217;s always been my opinion that Twitter should be as real-time as possible. I loved the text-message model of the Twitter days of yore, though didn&#8217;t love constantly checking my phone. I found that what I actually crave is knowing there are tweets waiting for me to read, not necessarily reading the tweets themselves.</p>
<p>In the past, I&#8217;ve <a title="Ding dong!" href="http://www.scotttherobot.com/?p=698">connected my doorbell</a> to Twitter. This was great, but I still had to go to Twitter to see the tweets. Talk about #firstworldproblems.</p>
<p>In the past, I&#8217;ve also <a title="Keymash" href="http://www.scotttherobot.com/?p=719">seriously modified</a> a Smith Corona typewriter. This clearly is a match made in heaven, why didn&#8217;t I combine the two earlier? In fact, I remember seeing an article about <a href="http://oomlout.co.uk/?p=79/">another bunch of people doing the same</a>. It had to be done. This would give me the best of both worlds. I can hear the typewriter doing its thing when I&#8217;m doing my thing, and when I eventually walk past it I can catch up on the haps.</p>
<p><span id="more-780"></span></p>
<div id="attachment_722" class="wp-caption alignleft" style="width: 160px"><a href="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0042.jpg"><img class="size-thumbnail wp-image-722 " alt="This mess printed the preface to Twilight!" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0042-150x150.jpg" width="150" height="150" /></a><p class="wp-caption-text">This mess printed the preface to Twilight!</p></div>
<p>First, I better clean up the electronics. My intention was to use the typewriter as a display piece of sorts. My living room is about as interesting as a 100-square-feet room can be. I imagine a Typist Typewriter (<em>à la</em> &#8221;player piano&#8221;) could be a great conversation piece. But the breadboard everything lived on was an absolute mess, which meant for a low RAF (roommate-acceptance-factor). And in my previous testing it had to be tethered to my laptop, which meant for a low SAF (self-acceptance-factor).</p>
<p>I&#8217;ll explain my process and throw a gallery at the end.</p>
<p>The rat&#8217;s nest was easy to clean up. I ordered some DIP sockets and 30awg wire on Amazon (&lt;3 prime) and went to work making things more manageable.</p>
<p>I started by soldering wires to each of the key matrix pins on the typewriter&#8217;s main logic board since I didn&#8217;t have a non-janky mating connector and I was going for low-profile. I made the mistake of cutting ~12&#8243; leads of wire. I figured I&#8217;d trim them later, but in my excitement I never did. Next, I soldered in a couple DIP sockets for my multiplexers. Last time I <a title="Keymasher" href="http://www.scotttherobot.com/?p=685">soldered them directly</a>, I ended up cooking them! I patched in the lines from the rows/cols and re-used the old colored twisted pairs as data lines so the Arduino can talk to the multiplexers.</p>
<p>Excited, I plugged everything in for a test using an older version of my Arduino firmware. As I sent serial data down the pipe, the Arduino responded appropriately, but the muxes never enabled! Ahh! I forgot to connect the enable lines! A quick trip back to the bench and I&#8217;m in business. Characters print, but the keymap is wrong. I must have swapped lines. Okay, fine. I went through the motions and created a new keymap (iterating over each of 64 row/col combos and documenting which character is printed). After that, it was set! The typewriter simply prints raw data fed to it via serial/UART. I have special cases for ASCII 10 and 13, and 127, that map to the return key and the special character-erase key respectively.</p>
<p>After updating and optimizing <a title="Keymash on Github" href="https://github.com/scotttherobot/keymash/blob/master/keymash.ino">the Arduino firmware</a>, I decided to dedicate a <a href="http://www.raspberrypi.org/">Raspberry Pi</a> computer to be used as a controller. Since the typewriter prints raw data, all the text formatting has to be done by the controlling computer. I <a title="Keymash on Github" href="https://github.com/scotttherobot/keymash/blob/master/tweetmash.py" target="_blank">whipped up a script in Python</a> to take data from the <a href="https://github.com/jgoerzen/twidge/wiki">Twidge</a> Twitter CLI and objectify and sort it. This creates a collection holding each tweet&#8217;s properties (author and body), which allows me to easily sort and format the tweets for printing. After parsing the Twidge output, the program iterates through the collection and (assuming the typewriter&#8217;s carriage is sitting at a blank line) prints the author of the tweet. It then adjusts the carriage to a set position and begins to print the tweet&#8217;s body. Should the tweet be longer than the remaining columns available on the page (This typewriter prints about 65 characters per 8.5&#8243; wide page), it intelligently returns the carriage and advances it to the same start position for the body of the line above. This creates two columns on the page, one for authors and one for the tweet data.</p>
<p>This script is called via cron.</p>
<p><code> ~$ twidge lsrecent -su | python /home/pi/tweetmash.py<br />
</code></p>
<p>That&#8217;s really all there is to it. Since the whole thing doesn&#8217;t fit in the typewriter without leaving the keyboard out, my next project is to eliminate the Arduino. The Raspberry Pi has plenty of GPIO pins to control the multiplexers directly, and <a href="https://projects.drogon.net/raspberry-pi/wiringpi/">WiringPi</a> should allow me to control them with my existing Arduino firmware.</p>
<p>A <a title="Keymash on Github" href="https://github.com/scotttherobot/keymash" target="_blank">Github repo with all the software</a> is available.</p>
<p><strong>TLDR;  A typewriter automatically types out tweets as they&#8217;re posted. </strong></p>

<a href='http://www.scotttherobot.com/?attachment_id=813' title='IMG_0437'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0437-150x150.jpg" class="attachment-thumbnail" alt="Soldering directly to the rows and columns of the keyboard connector" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=784' title='IMG_0440'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0440-150x150.jpg" class="attachment-thumbnail" alt="Don&#039;t judge my soldering, it was 3am and I was tired!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=782' title='IMG_0438'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0438-150x150.jpg" class="attachment-thumbnail" alt="I stuck with color-coded cat5 pairs for the binary data lines" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=786' title='IMG_0442'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0442-150x150.jpg" class="attachment-thumbnail" alt="I&#039;m ashamed." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=793' title='IMG_0449'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0449-150x150.jpg" class="attachment-thumbnail" alt="Look! There&#039;s space for my hardware on the left!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=803' title='IMG_0461'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0461-150x150.jpg" class="attachment-thumbnail" alt="Oops, I forgot the enable line... I went back and added it (the stray blue wire on the right)" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=796' title='IMG_0452'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0452-150x150.jpg" class="attachment-thumbnail" alt="Connecting to the Arduino for more testing and firmware development." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=802' title='IMG_0460'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0460-150x150.jpg" class="attachment-thumbnail" alt="After generating a new keymap (I swapped some wires, it seems), these are my first prints." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=805' title='IMG_0464'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0464-150x150.jpg" class="attachment-thumbnail" alt="Nothing like ASCII Justin Bieber to brighten up your day. Baby, Baby, Baby -- OH!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=811' title='IMG_0470'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0470-150x150.jpg" class="attachment-thumbnail" alt="With few scruples, I jammed the still-mess-of-wires into the free space. I insulated the boards from each other with a vintage IBM 5081 punch card." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=808' title='IMG_0467'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0467-150x150.jpg" class="attachment-thumbnail" alt="With the firmware straightened out, I decided Raspberry Pi would be the best brain." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=809' title='IMG_0468'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0468-150x150.jpg" class="attachment-thumbnail" alt="My software isn&#039;t smart enough to wrap words yet :(" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=820' title='tweets'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/tweets-150x150.png" class="attachment-thumbnail" alt="Woo! Prettified tweets!" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=780</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project: USB Apple Extended Keyboard II</title>
		<link>http://www.scotttherobot.com/?p=755</link>
		<comments>http://www.scotttherobot.com/?p=755#comments</comments>
		<pubDate>Sat, 16 Mar 2013 04:41:48 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=755</guid>
		<description><![CDATA[I&#8217;m lucky enough to have a fab Apple Extended Keyboard II that belongs to my Macintosh SE. Unfortunately, it wasn&#8217;t doing much good connected to my rarely-used SE, so I figured a better home for it would be on my desk at work, where I spend the day pounding away on a crummy keyboard anyway. [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_758" class="wp-caption alignright" style="width: 310px"><a href="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0412.jpg"><img class="size-medium wp-image-758" alt="Woo! It works great with my MacBook Air. One hiccup, for the number pad to work, you must hold &quot;num lock&quot; when connecting the keyboard. The &quot;num lock&quot; key and light don't seem to work as they should. Small price to pay." src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0412-300x200.jpg" width="300" height="200" /></a><p class="wp-caption-text">Woo! It works great with my MacBook Air. One hiccup, for the number pad to work, you must hold &#8220;num lock&#8221; when connecting the keyboard. The &#8220;num lock&#8221; key and light don&#8217;t seem to work as they should. Small price to pay.</p></div>
<p>I&#8217;m lucky enough to have a fab <a title="Apple Extended Keyboard" href="http://en.wikipedia.org/wiki/Apple_Extended_Keyboard" target="_blank">Apple Extended Keyboard</a> II that belongs to my Macintosh SE. Unfortunately, it wasn&#8217;t doing much good connected to my rarely-used SE, so I figured a better home for it would be on my desk at work, where I spend the day pounding away on a crummy keyboard anyway.</p>
<p>This keyboard is a dream to type on because it uses mechanical switches. And I lucked out: Apple made a lot of revisions of this keyboard with cheap switches, but it turns out that I got one of the good ones. Mine is a USA model with authentic Alps Cream key switches. Lovely!</p>
<p>The biggest stumbling block is the interface to the computer. The Apple Extended Keyboard II is from the days of ADB, Apple Desktop Bus. The internet revealed two solutions: An expensive and sometimes-hard-to-find <a title="iMate" href="http://www.amazon.com/Griffin-2001-ADB-iMate-Universal-adapter/dp/B000067V8L" target="_blank">adapter by Griffin</a>, or a $16 microcontroller and some DIY elbow grease. Naturally I chose the latter.</p>
<p><span id="more-755"></span></p>
<h4>Building It</h4>
<p>All that&#8217;s in this project is a <a title="Teensy!" href="http://www.pjrc.com/teensy/" target="_blank">Teensy 2.0 microcontroller </a>and the keyboard. You do have to compile and install <a title="TMK Keyboard Converter" href="https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/README.md" target="_blank">the firmware</a>, though.  A simple task, though on my Mac I had to install <a title="CrossPack" href="http://www.obdev.at/products/crosspack/index.html">CrossPack</a> to compile for the Teensy and <a title="Teensy Loader" href="http://www.pjrc.com/teensy/loader.html">TeensyLoader</a> to flash code to it. Here I must give a shout out to <a href="http://geekhack.org/index.php?topic=14290.0" target="_blank">the awesome folks who developed it</a> - they also have support for a bunch of keyboard types.</p>
<p><code> ~$ git clone git://github.com/tmk/tmk_keyboard.git<br />
~$ cd tmk_keyboard/converter/adb_usb<br />
~$ make<br />
</code></p>
<p>Then use the TeensyLoader app to flash the .hex image onto the uC.</p>
<p>Connect ADB pin 1 (data) to Teensy pin F0, pin 3 to Teensy vcc (5v), and pin 4 to Tesny gnd (ground). You could wire up a DIN-4 (&#8220;s-video&#8221;) connector if you wanted (female to use an authentic Apple cable, male to make your own cable), or you could completely enclose the Teensy into the keyboard like I did.</p>
<p>Here&#8217;s a gallery. The process is as simple as connecting the proper 3 pins to your ADB keyboard and then programming the microcontroller. I chose to enclose the entire converter inside my keyboard, as I didn&#8217;t want a little dongle hanging out to break and I also didn&#8217;t have the proper connecters to mate with the keyboard&#8217;s.</p>

<a href='http://www.scotttherobot.com/?attachment_id=756' title='Teensy'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0400-150x150.jpg" class="attachment-thumbnail" alt="The microcontroller, soldered up and connected to a mutilated slimline USB cable.  PS I have since thoroughly cleaned the keys. They were pretty dirty, as you can see!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=761' title='Tucked in'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0405-150x150.jpg" class="attachment-thumbnail" alt="All tucked in, out of the way." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=762' title='ADB port'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0403-150x150.jpg" class="attachment-thumbnail" alt="I tacked wires onto the existing ADB solder joints so I can still use the keyboard with ADB macs." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=763' title='Tucked away.'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0402-150x150.jpg" class="attachment-thumbnail" alt="The connector fits neatly back into place." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=764' title='Ready to go'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0399-150x150.jpg" class="attachment-thumbnail" alt="All done, ready to be buttoned up." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=760' title='Cable pass'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0409-150x150.jpg" class="attachment-thumbnail" alt="The usb cable comes in through a slightly widened existing hole in the case." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=759' title='Cable'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0411-150x150.jpg" class="attachment-thumbnail" alt="It passes out on the inside of the edge, so the cable just seems to appear." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=757' title='side'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0413-150x150.jpg" class="attachment-thumbnail" alt="The ADB ports are still there, ready to be used. The USB cable comes out from under the raised keyboard." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=758' title='It works!'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/03/IMG_0412-150x150.jpg" class="attachment-thumbnail" alt="Woo! It works great with my MacBook Air!" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=755</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Browsing on the Macintosh SE</title>
		<link>http://www.scotttherobot.com/?p=729</link>
		<comments>http://www.scotttherobot.com/?p=729#comments</comments>
		<pubDate>Tue, 08 Jan 2013 23:13:23 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=729</guid>
		<description><![CDATA[Well, I decided to drag my SE home from my parent&#8217;s house when I came back from winter break. It sat in the laundry room for a couple weeks, but I was bored today so I decided to stretch its legs. I had also recently been reminded of the Hack A Day retro challenge and so [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_730" class="wp-caption alignright" style="width: 235px"><a href="http://www.scotttherobot.com/wp-content/uploads/2013/01/IMG_6227.jpg"><img class="size-medium wp-image-730" alt="Excuse the poor quality." src="http://www.scotttherobot.com/wp-content/uploads/2013/01/IMG_6227-e1357685893512-225x300.jpg" width="225" height="300" /></a><p class="wp-caption-text">Excuse the poor quality.</p></div>
<p>Well, I decided to drag my SE home from my parent&#8217;s house when I came back from winter break. It sat in the laundry room for a couple weeks, but I was bored today so I decided to stretch its legs. I had also recently been reminded of the <a href="http://retro.hackaday.com/">Hack A Day retro challenge</a> and so I thought it might be the perfect way to spend my afternoon.</p>
<p>Back when I first got the SE, I was eager to connect it to anything that I could, so I had a ziplock bag full of all sorts of vintage-Mac cables. AppleTalk adapters, serial cables, etc. A quick dig through the bag netted me a mini DIN-8 to DB9 cable. I dug around another box and found a null modem cable and a USB-serial adapter. By connecting these three cables together and plugging the USB side into my MacBook Air and the mini-DIN into the SE&#8217;s modem port, I was able to quickly establish a serial connection with Zterm.</p>
<p><span id="more-729"></span></p>
<p>My initial intention was to download a TCP stack and a System 7 compatible browser, however I couldn&#8217;t get the TCP stack properly unzipped on my contemporary Mac and I couldn&#8217;t find a browser that was suitable for System 7.0. Most that I found required a later variant of System 7. While the later version is available from Apple for free, I would have no way to create an 800k floppy to install from as I only have 1.4m floppies. To boot, the only other machine I own with an 800k drive is at the very same parent&#8217;s house still.</p>
<p>Moving on from that idea, I decided I&#8217;d just use a terminal browser. Getting a console was a slight challenge, as Mac OS X doesn&#8217;t natively support hardware terminals. Attempting to enable one simply does nothing. As I recall, the only version of Mac OS X to support hardware terminals is Mac OS X Server, as Xserves are the only contemporary Macs that have hardware serial ports.</p>
<p>The solution came from everyone else who has ever used an Apple II as a terminal. Screen! Within screen, you can execute getty. Perfect. After fussing with baud settings and window sizes (I found that the screen session on OS X needs to match height and width of the SE terminal) I was in business. Now to find a suitable browser. Instead of installing Links or Lynx locally, I SSH&#8217;d right into my AWS instance, as I already had lynx installed there. Everything fell in place.</p>
<p>As you can see in the (rather poor) image attached, the HAD retro site loaded right up. There&#8217;s some issue with the terminal that I haven&#8217;t straightened quite out yet, but I have a feeling that it has to do with Screen on my MacBook Air. I&#8217;m going to connect the SE to a Raspberry Pi and see how that turns out. That&#8217;s a project for a later hour, though. I think I deserve a nap right now.</p>

<a href='http://www.scotttherobot.com/?attachment_id=735' title='Hack-A-Day'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/01/IMG_0052-150x150.jpg" class="attachment-thumbnail" alt="Closeup" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=739' title='SSH'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/01/IMG_00531-150x150.jpg" class="attachment-thumbnail" alt="I ssh&#039;d into AWS. Excuse the blurring, for privacy. Not that it really hides anything importance." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=730' title='Macintosh SE'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2013/01/IMG_6227-e1357685893512-150x150.jpg" class="attachment-thumbnail" alt="Excuse the poor quality." /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=729</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keymash</title>
		<link>http://www.scotttherobot.com/?p=719</link>
		<comments>http://www.scotttherobot.com/?p=719#comments</comments>
		<pubDate>Fri, 28 Dec 2012 08:57:03 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=719</guid>
		<description><![CDATA[Typewriter hacking! Ahh! Typewriters are pretty cool little devices. They&#8217;re keyboards directly interfaced with daisy-wheel printers. In our venture towards converting a typewriter into an old-school teleterminal, I&#8217;ve first dedicated myself to getting the thing to print autonomously. And I&#8217;ve succeeded! This project is actually really exciting to me purely because of its novelty. I [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_721" class="wp-caption alignright" style="width: 310px"><a href="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0040.jpg"><img class="size-medium wp-image-721" alt="The first 100% successful string printed." src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0040-300x225.jpg" width="300" height="225" /></a><p class="wp-caption-text">The first 100% successful string printed.</p></div>
<p>Typewriter hacking! Ahh!</p>
<p>Typewriters are pretty cool little devices. They&#8217;re keyboards directly interfaced with daisy-wheel printers. In our venture towards converting a typewriter into an old-school teleterminal, I&#8217;ve first dedicated myself to getting the thing to print autonomously. And I&#8217;ve succeeded!</p>
<p>This project is actually really exciting to me purely because of its novelty. I think it&#8217;s so super cool. Donny, my roommate, suggested building a web form that would allow people to send messages to it. Perhaps we would put a webcam on so you could watch your message get hammered out in real time.</p>
<p><span id="more-719"></span></p>
<p>After a really failed attempt with a Royal electric typewriter, I dragged home a Smith Corona DeVille 80. This puppy has a dead-simple keyboard that I was able to reverse engineer in a matter of 30 minutes. I built up a wiring harness to bring the signal/scan lines onto my breadboard so they could be multiplexed by the arduino, and then I built a keymap by closing every possible combination of signal and scan lines and writing down what each combo printed.</p>
<p>After building out the Arduino sketch, I have something that accepts characters over serial, parses them and simulates the proper keystrokes. In fact, the keystrokes it simulates are nearly the same ones a human would make. To type the character &#8216;A&#8217;, that is the capital letter  &#8217;a', the arduino first sets the caps lock on the typewriter, then types the letter &#8216;a&#8217;, then disables caps lock. The same sequence is done for special characters like &#8216;!&#8217;, &#8220;@&#8221;, &#8220;#&#8221;, etc&#8230;</p>
<p>One of the first things I printed, naturally, was the preface and start of chapter 1 of the novel Twilight. It came out nicely.
<a href='http://www.scotttherobot.com/?attachment_id=721' title='Hello, Donny!'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0040-150x150.jpg" class="attachment-thumbnail" alt="The first 100% successful string printed." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=722' title='Mess'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0042-150x150.jpg" class="attachment-thumbnail" alt="This mess printed the preface to Twilight!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=723' title='bang bang'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0043-150x150.jpg" class="attachment-thumbnail" alt="A closer view of the wiring job. I&#039;ve just forced a pin header into the keyboard connector." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=724' title='oops'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0044-150x150.jpg" class="attachment-thumbnail" alt="A little bug, it seems the CAPS LOCK GOT STUCK ON" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=725' title='muxes'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0049-150x150.jpg" class="attachment-thumbnail" alt="The multiplexers that electronically connect scan and signal lines." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=726' title='twiiiiilllight'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0050-150x150.jpg" class="attachment-thumbnail" alt="Mmmm twilighty goodness ^.^" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=744' title='Keypress Spoofer'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/keymash-150x150.png" class="attachment-thumbnail" alt="The circuit to select and connect row/cols on the keyboard matrix." /></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=719</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ding dong!</title>
		<link>http://www.scotttherobot.com/?p=698</link>
		<comments>http://www.scotttherobot.com/?p=698#comments</comments>
		<pubDate>Wed, 05 Dec 2012 22:35:56 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=698</guid>
		<description><![CDATA[So, most homes have doorbells. Do people really use them anymore? At our home, not only do we never have visitors, but the doorbell button is out of reach. It sits idle, its transformer slowly syphoning power. Wouldn&#8217;t it be great to repurpose the doorbell into something that&#8217;s useful? I thought so. Some torrent clients [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_699" class="wp-caption alignleft" style="width: 310px"><a href="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0035.jpg"><img class="size-medium wp-image-699 " title="IMG_0035" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0035-300x225.jpg" width="300" height="225" /></a><p class="wp-caption-text">Deaf, Dumb, and Mute&#8230; Until now!</p></div>
<p>So, most homes have doorbells. Do people really use them anymore? At our home, not only do we never have visitors, but the doorbell button is out of reach. It sits idle, its transformer slowly syphoning power.</p>
<p>Wouldn&#8217;t it be great to repurpose the doorbell into something that&#8217;s useful? I thought so. Some torrent clients have the nifty capability of running a command when a torrent downloads &#8212; so why not ring the doorbell? Not being that avid of a torrenter, I instead chose to give it a Twitter account and alert the house whenever my roommate or I tweet.</p>
<p><span id="more-698"></span></p>
<p>How do? Arduino, naturally. Also, Raspberry Pi.</p>
<p>The Arduino has a relay on one of its digital pins. When the relay closes, the doorbell button is &#8220;pushed&#8221; and the chime rings. The Arduino is programmed to wait for a character [1 through 4]over the serial port. A &#8217;1&#8242; is a short push (&#8220;dingdong&#8221;). A &#8217;4&#8242; is a push-and-hold (&#8220;ding&#8230;dong&#8221;). &#8217;2&#8242; and &#8217;3&#8242; are somewhere in between.</p>
<p>The Raspberry Pi runs Nginx as a web server and PHP5. When a request is made to the web server, a serial port is opened and a character is sent down the pipe to the Arduino.</p>
<p>Locally, I wrote a shell script that gets stuck in /bin/ called &#8220;doorbell&#8221;. When you run it, it makes a request with cURL to the Raspberry Pi, which rings the doorbell. Simple stuff.</p>
<p>For the Twitter part, I fell back onto the trusty Twidge CLI for Twitter. It keeps track of unread posts and all that jazz. I wrote a simple shell script (to be run each minute by Crontab) that gets the output of twidge, counts the number of characters, and if it&#8217;s more than zero (0), it rings the bell. In the future I&#8217;d like to implement the &#8220;feature&#8221; of it chiming once per new tweet, but for now it rings once if there are new tweets at all.</p>

<a href='http://www.scotttherobot.com/?attachment_id=699' title='IMG_0035'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0035-150x150.jpg" class="attachment-thumbnail" alt="Deaf, Dumb, and Mute... Until now!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=700' title='IMG_0036'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0036-150x150.jpg" class="attachment-thumbnail" alt="Raspberry Pi and Arduino" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=701' title='IMG_0037'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/12/IMG_0037-150x150.jpg" class="attachment-thumbnail" alt="Patching into the button" /></a>

<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=698</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keymasher</title>
		<link>http://www.scotttherobot.com/?p=685</link>
		<comments>http://www.scotttherobot.com/?p=685#comments</comments>
		<pubDate>Thu, 29 Nov 2012 04:10:03 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=685</guid>
		<description><![CDATA[So, one of my favorite projects that I&#8217;ve seen online in the past year involve automating the electric typewriter. I guess if you were to compare it to the &#8220;player piano&#8221; it would be called a &#8220;typist typewriter&#8221; &#8211; a typewriter that hammers away at itself. I&#8217;ve found two such projects. One&#8217;s a twitter monitor [...]]]></description>
				<content:encoded><![CDATA[<p>So, one of my favorite projects that I&#8217;ve seen online in the past year involve automating the electric typewriter. I guess if you were to compare it to the &#8220;player piano&#8221; it would be called a &#8220;typist typewriter&#8221; &#8211; a typewriter that hammers away at itself.</p>
<p>I&#8217;ve found two such projects. One&#8217;s a twitter monitor that types out tweets with a certain tag. It&#8217;s not interactive, it just prints. The other is a teleprinter that passes keypresses over serial, and prints out any characters received over serial. This was more the direction I wanted to go. My roommate was very excited about the concept of having a teleterminal, that is having a Linux console available on the typewriter. I thought, and continue to think that this is a reasonable goal to work towards. How many people can say they have a teleprinter? How many people can say that they built it themselves?</p>
<p><span id="more-685"></span></p>
<p>My roommate Donny had a typewriter in mind, so all that was left to do was figure out what needed to happen electrically. All of the typewriter-related projects that I&#8217;ve found online have been incomplete in their documentation. Both had code samples available, but no hardware or circuit diagrams. So for that I was on my own, so I picked an approach and I settled into it.</p>
<p>To understand how this approach works, it&#8217;s important to first understand how a typewriter&#8217;s keyboard works. Keyboards are simply matrices of switches. In the case of most typewriters, there are 8 electrical columns and 8 electrical rows. To detect a keypress, the controller will pull one column to a logical &#8220;high&#8221; and then sequentially check all the rows to see if they have become high. If one has, it means a connection was made by a particular key. The lines being pulled high are called signal lines, and the lines being checked against each signal line are called scan lines.</p>
<p>So, to electronically spoof keypresses, you must create a path between the row and column that corresponds to the character you wish to print. How? The answer I came upon was using a set of multiplexers connected together. Eight columns are connected to one mux, and eight rows are connected to another. The common i/o lines of the multiplexers are tied together. This way, all it takes to connect any two lines together is to set the select bits of each multiplexer and then lower the inhibit line, creating an electrical path and simulating a keystroke. All of this can be done using an Arduino microcontroller, which is perfect.</p>
<p>The parts themselves are relatively easy to come by. You can order them online or buy them at an electronic parts store. We ended up driving 60 miles round trip to get them, because we had nothing better to do and didn&#8217;t want to wait.</p>
<h2>Hardware Used</h2>
<ul>
<li>Arduino Uno</li>
<li>4051 CMOS multiplexers</li>
</ul>

<a href='http://www.scotttherobot.com/?attachment_id=687' title='IMG_0005'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/11/IMG_0005-150x150.jpg" class="attachment-thumbnail" alt="Identifying rows and columns. A character will be printed when a &quot;dot&quot; touches a &quot;clear&quot;." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=688' title='IMG_0008'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/11/IMG_0008-150x150.jpg" class="attachment-thumbnail" alt="Settling the multiplexers in. They&#039;re cheap enough to not socket." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=689' title='IMG_0013'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/11/IMG_0013-150x150.jpg" class="attachment-thumbnail" alt="Almost there!" /></a>
<a href='http://www.scotttherobot.com/?attachment_id=690' title='IMG_0020'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/11/IMG_0020-150x150.jpg" class="attachment-thumbnail" alt="Connecting the finished MUX board to the typewriter&#039;s keyboard port." /></a>
<a href='http://www.scotttherobot.com/?attachment_id=691' title='IMG_0021'><img width="150" height="150" src="http://www.scotttherobot.com/wp-content/uploads/2012/11/IMG_0021-150x150.jpg" class="attachment-thumbnail" alt="Woo! Letters!" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=685</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Surplus, Passworded Sunfire V100</title>
		<link>http://www.scotttherobot.com/?p=658</link>
		<comments>http://www.scotttherobot.com/?p=658#comments</comments>
		<pubDate>Sun, 12 Aug 2012 21:58:18 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=658</guid>
		<description><![CDATA[So I bought a SunFire V100 the other day from HSC (halted). Brought it home, soldered up a console cable, and fired it up. Turns out, LOMlite is password protected, as is the firmware. Nooo!! Here&#8217;s my solution to get a non-bootable machine working. This is the compilation of so much research and lots of help [...]]]></description>
				<content:encoded><![CDATA[<p>So I bought a SunFire V100 the other day from HSC (halted). Brought it home, soldered up a console cable, and fired it up. Turns out, LOMlite is password protected, as is the firmware. Nooo!! Here&#8217;s my solution to get a non-bootable machine working.<a href="http://www.scotttherobot.com/wp-content/uploads/2012/08/Sun-Fire-V100-front.png"><img class="alignright size-medium wp-image-659" title="Sun-Fire-V100-front" src="http://www.scotttherobot.com/wp-content/uploads/2012/08/Sun-Fire-V100-front-300x105.png" alt="" width="300" height="105" /></a></p>
<p>This is the compilation of so much research and lots of help from the nice people of Reddit, and a few unhelpful comments from Experts-Exchange. The reddit thread is <a title="Rescuing a Sunfire" href="http://www.reddit.com/r/solaris/comments/y27j3/rescuing_a_sunfire_v100_firmware_password_reset/">here</a>.</p>
<p>Read on for the meat and potatoes.</p>
<p><span id="more-658"></span></p>
<p>I was able to get everything sorted out with a little experimenting. I&#8217;m writing this in newb layman&#8217;s terms because if you&#8217;re a CS student like me and new to Sun and Sparc hardware, it&#8217;s so much easier to understand this way.</p>
<p>If your Sun just has one of the things locked and you can&#8217;t boot, this may help you too! But I was cursed, and both were locked.</p>
<p>Hindsight: The most important step in this guide is clearing the OpenBoot Firmware Password. Without this password, you can&#8217;t choose the boot order or really do anything with the machine.</p>
<p>You will need:</p>
<ul>
<li>Sunfire v100/v120 with the case opened</li>
<li>Metal jumper or screwdriver</li>
<li>Console cable and terminal emulator</li>
<li>A computer or virtual machine running Solaris (x86 or SPARC) setup as a JumpStart server</li>
<li>A network to attach both machines to</li>
<li>The Solaris DVD install image</li>
<li>Solaris 9 Supplemental CD (source for LOMlite packages)</li>
</ul>
<p>Steps:</p>
<p>0. Install Solaris on another machine. I virtualized this on my MacBook using Sun/Oracle&#8217;s own VirtualBox. Follow a guide you may find elsewhere online to set this up as a JumpStart server. This is where you will define the hostname and IP address of your Sunfire. This step is the second-trickiest to do and may take some time. Be patient and triple-check for typos in your configuration files.</p>
<p>1. Connect to the LOM console of the Sunfire using your terminal emulator and console cable. Connect the Sunfire to the network via ethernet using the net0 connection. On your terminal, you should see the LOMlite password prompt asking for a username and password. At this time, rapidly short and unshort the JP13 pins on the main motherboard with the screwdriver. You can find these pins easily- they&#8217;re between the CPU cooler and the motherboard&#8217;s watch battery, immediately next to the LOM MCU. If you do this a dozen or so times very rapidly, the LOM will fail to read the eeprom and the unprotected lom&gt; prompt will show up.</p>
<p>1a. Try the &#8220;poweron&#8221; command. If the machine is already set to boot from the CD drive, you should monopolize this and get a bootable Solaris install CD in there ASAP! Don&#8217;t jumpstart boot if you don&#8217;t have to! If you can boot a Solaris cd, skip to step 4. If the machine boots to the internal drive, this could work if you know the root password. Skip to step 5 if this is the case. If it boots the internal hard drive but you don&#8217;t know the root password, or if the internal hard drive has been wiped/dban-ed/is otherwise unbootable, keep reading.</p>
<p>2. Issue a &#8220;bootmode reset_nvram&#8221; command. Then, try the &#8220;poweron&#8221; command. This will change the default boot order to net, allowing us to jumpstart the machine from the server you built in step 0. If you get the lom&gt; prompt again, type &#8220;console&#8221;. If you get the &#8220;console not shared&#8221; message, wait about 2 minutes, and type &#8220;console&#8221; again. Keep trying until it works for you. If you&#8217;re lucky, you may catch the OpenFirmware header which shows the machine&#8217;s MAC address and specs. After this, it should drop you to a console that has a simple &#8220;&gt;&#8221; prompt. This is called the &#8220;restricted monitor prompt&#8221;, which only allows you to issue &#8220;boot&#8221; without having the firmware password. There are other commands, but you aren&#8217;t allowed to use them. This prompt is the locked-down version of the OK prompt. You can not choose a boot device without the password, which is why we reset the nvram, which has the side effect of forcing network boot.</p>
<p>3. Type the &#8220;boot&#8221; command. This is the moment of truth. If your JumpStart server is configured properly, the console should output some hex-looking strings and a &#8220;spinning&#8221; character. Eventually, the Solaris installer will start and guide you through the installation. At the &#8220;disk selection&#8221; stage of the installation, make sure the installer knows to change the default boot order to the internal disk and to NOT continue booting from the network. It had done this by default for me and the installer pointed it out to verify, but it&#8217;s good to double check.</p>
<p>3a. If the Sunfire doesn&#8217;t find your Jumpstart server, go back and double check some things. Sit down at the jumpstart machine&#8217;s console. You&#8217;ll need to be root to edit most of these files. Make sure the Sunfire&#8217;s MAC address and desired hostname are in the ethers file. Make sure the MAC address digits are separated by &#8220;:&#8221; and it matches the MAC that&#8217;s listed on the System Configuration Card sticker and the OpenFirmware header that comes over the V100 console. One guide I followed said to use the &#8220;-&#8221; and that didn&#8217;t work for me. Make sure the Sunfire&#8217;s desired IP and hostname in the hosts file. Double check for typos. Run the &#8220;share&#8221; command on the server and make sure the /export/config and the /export/install directories are shared by NFS. Use the ./check command to check the configuration files. Re-run the add_install_client script double checking the parameters.</p>
<p>3b. If running through 3a doesn&#8217;t help, don&#8217;t give up. Find another guide and see if they say to do things differently. It can&#8217;t hurt to try different methods to find one that works.</p>
<p>4. When the install is done, reboot the system when it asks you to. I chose the option not to auto-reboot when finished, so this was a step for me- it might not be for you depending on what you chose. When the system is restarting, watch the console carefully. You should see the restricted monitor prompt automatically boot from the internal hard drive, yay!!! Then you should see that &#8220;spinning&#8221; character while Solaris bootstraps and initializes things. The first boot took a few minutes for me, be patient. Eventually you should get a console login. Login as root. I setup my Jumpstart server set a root password on the machine automatically, which was &#8220;password&#8221;. It may be different depending on the guide you followed.</p>
<p>5. Clear the OpenFirmware password. You must be root to do this. When you have a root command line in Solaris (#), issue the command &#8220;eeprom security-mode=none&#8221;. This shouldn&#8217;t return anything. Then issue &#8220;eeprom&#8221; and hit enter. This will print out the eeprom configuration to the console, where you can double-check the security mode. If it says &#8220;none&#8221;, be happy. You will now have a full ok&gt; prompt at OBP. Yay!</p>
<p>6. Clear the LOM. This is by far the trickiest if you have no solaris resources (like me). To clear the LOM, you need the 3 SUNWlom* packages, called SUNWlomu, SUNWlomm, and SUNWlomr. These used to be freeware on the Sun site, but when Oracle bought them out they pulled them offline. Apparently, the only place to find them is on the Solaris 9 Supplemental CD. I have yet to find a copy of this CD online or these packages individually, so I wish you good luck. If you do find the packages, you can install them by following the instructions to do so in <a title="Oracle LOM doc" href="http://docs.oracle.com/cd/E19102-01/n1280.srvr/819-5086-10/poweron.html#64988">this</a> doc. A nice redditor spent hours digging through the Oracle site and finally found them for me on the disk image of the Solaris Supplement CD, however you need login credentials to access the downloads. Next all you have to do is edit the lom configuration file and change &#8220;serial-security=1;&#8221; to  &#8221;serial-security=0;&#8221; and reboot.</p>
<p>6a. If you can&#8217;t clear the LOM password because you don&#8217;t have the packages, make sure you have the eeprom set to auto-boot. You can use the eeprom utility to check this. Issuing &#8220;eeprom auto-boot?=true&#8221; will ensure that it does. This way, when you don&#8217;t have the lid off of the machine (and can&#8217;t reset the lom a bajillion times with a screwdriver), the power rocker switch on the back of the machine will start up Solaris with no console interaction, which is an okay trade off considering the machine used to not boot up at all.</p>
<p>6b. If you want to ditch Solaris, I recommend finding the lom packages first and clearing it too, because as far as I know, Debian Sparc or any of the other non-Solaris OSes can&#8217;t deal with the onboard lom or eeprom, so it&#8217;s best to keep them as vanilla as possible just in case something fails.</p>
<p>&nbsp;</p>
<p>That&#8217;s it. You should now have a booting system. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=658</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi Antics (Garage Door Opener)</title>
		<link>http://www.scotttherobot.com/?p=635</link>
		<comments>http://www.scotttherobot.com/?p=635#comments</comments>
		<pubDate>Sat, 30 Jun 2012 05:37:53 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=635</guid>
		<description><![CDATA[So, not long ago I received a Raspberry Pi in the mail. Yep, that&#8217;s the ultra-coveted, ultra-backordered, ultra-low power, ultra-small, ultra-awesome single-board-computer that only costs $35 (give or take). I had it kicking around for a few weeks running Debian before I really had a solid idea of what I should do with it, which [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-652" title="IMG_3443" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3443-e1341035819894-224x300.jpg" alt="" width="224" height="300" /></p>
<p>So, not long ago I received a Raspberry Pi in the mail. Yep, that&#8217;s the ultra-coveted, ultra-backordered, ultra-low power, ultra-small, ultra-awesome single-board-computer that only costs $35 (give or take). I had it kicking around for a few weeks running Debian before I really had a solid idea of what I should do with it, which turned into an exercise in home automation. I plan to design a home automation system with my electrical-engineering-major roommate come September.</p>
<p>Essentially, this exercise serves as a proof of concept which demonstrates the reliability of the Arduino-Server communication as well as the viability of the Raspberry Pi as a platform for running the home automation software.</p>
<p><span id="more-635"></span></p>
<h3>Overview</h3>
<p>Anyway, the abstract design for our system will be a chain of microcontroller nodes all connected back to a server, which monitors the system, provides a web interface, and automates. I had already made a rudimentary web-arduino link over serial that could flash a light, so I thought hooking up a garage door opener would be cake. This system had been tethered to the server instance on my laptop, which is undesirable. Pair the Arduino with the Pi (instead of the laptop) and a wifi dongle and we&#8217;re in business. I also had written (quite a while back) an Android application to allow mobile actuation of that little LED blinky sketch I wrote, so adapting that isn&#8217;t even necessary because I built it to be user-configurable.</p>
<p>I will spoil the fun and say the project was successful. I can actuate the garage door from a web interface hosted from the Pi. However, this is not to say the project does not have it&#8217;s faults. Due to the hardware limitations of the Pi, I find the system to be completely unstable as the Pi cannot provide adequate power to the wifi adapter used to connect it to the network. Should the system be networked with Ethernet, or even assembled with a low-power wifi adapter or perhaps even utilize a powered hub with the current hardware, the stability would be greatly improved.</p>
<p>I also ran into an issue where the Pi refused to boot without a monitor connected over HDMI (headless), which I remedied by forcing HDMI-hot-plugging (the Pi always assumes a monitor is connected). This may have something to do with the Debian Wheezy beta that I am using.</p>
<h3>Design</h3>
<p>Starting out, I knew the basic design of the system. A server running LAMPP would interface with a microcontroller (in this case an Arduino Uno) via serial UART. A software package would have to be written on the server side to deal with automation events through a web browser. This software must also be able to communicate with the microcontroller.</p>
<p><a href="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3435.jpeg"><img class="size-medium wp-image-640 alignleft" title="IMG_3435" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3435-e1341012883648-300x224.jpg" alt="" width="300" height="224" /></a>The Arduino microcontroller has GPIO built in, but not much more. To interface with a garage door opener, I needed to be able to switch together two contacts. This is easily accomplished with a relay. There is a very helpful and very prolific wiring diagram of how to connect a relay to a digital output pin on an Arduino floating around on the internet; I used this and it helped me (a meager CS student, not EE) greatly. It can be found by searching &#8220;using a relay with arduino&#8221;.</p>
<p><img class="alignright size-medium wp-image-638" title="Arduino" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3379-224x300.jpg" alt="" width="224" height="300" /></p>
<p>One sunny afternoon I strolled down to RadioShack. I am very much partial to HSC/Halted, however it&#8217;s 15 minutes away and was closed at the time. I would have saved a chunk of change by buying parts there instead. At Radioshack, I acquired a small reed relay capable of switching .5A at 125v, which I felt (from absolutely no research or experience) would be sufficient for switching the garage door. I also got a small prototyping circuit board, the type which has a bajillion tinned holes and nothing more. I assembled the circuit as laid out in the diagram which I mentioned above. I actually bought two relays in case I should decide to add another channel of control at a later time. For now, I left it unpopulated.</p>
<p>Connecting this to the Arduino was cake. I connected the ground lead, the +5v lead, and finally the signal lead to digital pin 5 (a personal choice). I then adapted my LED-blinking sketch (which responds to bits over serial) to instead &#8220;push&#8221; the relay button.</p>
<p>The completed circuit can be seen in the photos above. It&#8217;s quite simple.</p>
<h3>Making it Garage-Proof</h3>
<p><img class="alignleft size-medium wp-image-641" title="IMG_3436" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3436-e1341013047957-224x300.jpg" alt="" width="224" height="300" /></p>
<p>I figured if it would be in the garage, it would need to be *proofed. I remembered a sample of watertight outdoor enclosures I had requested forever ago and figured one would be perfect for this application. Of course, I would have to destroy it&#8217;s water-tight properties to interface it with the outside world, but I wasn&#8217;t too worried about that.</p>
<p>The image shows the rPi nestled in its new home, with a notch dremel-ed out of the case for connectivity.<a href="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3439.jpeg"><img class="alignright size-medium wp-image-642" title="IMG_3439" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3439-e1341013148259-224x300.jpg" alt="" width="224" height="300" /></a></p>
<p>I wrapped the relay board and the Arduino together with electrician&#8217;s tape to keep them from knocking around and shorting on the Raspberry Pi.</p>
<p>I then fit that bundle atop the Pi inside the enclosure, seen in one of these photos.</p>
<p>After the USB cables were connected, I buttoned up the enclosure and taped the bundle of USB cables across the top for good measure.</p>
<p>The USB wifi adapter was then taped on top of said bundle. I am having</p>
<p><img class="size-medium wp-image-643 alignleft" title="IMG_3441" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3441-e1341013290959-300x224.jpg" alt="" width="300" height="224" /></p>
<p>reliability issues with this particular adapter, so I do hope to replace it soon with a low-power module.</p>
<h3>Installation</h3>
<p>Installing the whole bundle was a piece of cake. I took the leads from the relay and screwed them into the garage door opener contacts. I placed the whole package on top of the opener motor itself, and plugged the Pi into the spare outlet in the ceiling. I was able to SSH into it almost immediately (yay for fast boot times), and echoed a &#8220;1&#8243; over the serial port the Arduino sat on. The garage door moved, yay!</p>
<p><a href="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3444.jpeg"><img class="alignright size-medium wp-image-644" title="IMG_3444" src="http://www.scotttherobot.com/wp-content/uploads/2012/06/IMG_3444-e1341013543541-300x224.jpg" alt="" width="300" height="224" /></a></p>
<p>I also found (duh?) that I can use scp to send a &#8220;1&#8243; directly from my own computer without having to do more than type the Pi&#8217;s password.</p>
<p>In the image showing the bundle above the opener, you can see a blue spot of projection on the ceiling from the wifi adapter. If this blue glow is solid, it means the network has gone down and the connection was lost. Sad times! If it flashes, it means there is an active connection between the adapter and my home router. Which is good. Unfortunately due to the Raspberry Pi not being able to provide enough power to the power-hungry wifi adapter, the connection is lost more than it&#8217;s active.</p>
<p>Aside from the wifi instability, this little proof-of-concept has been eye-opening. If it were hardwired into the network (like any of our actual home-automation gear would be), or even if it had a powered USB hub to give the wifi adapter some juice, I have few doubts that it would be rock-solid reliable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=635</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Printing ALL the things!</title>
		<link>http://www.scotttherobot.com/?p=606</link>
		<comments>http://www.scotttherobot.com/?p=606#comments</comments>
		<pubDate>Fri, 02 Mar 2012 20:12:21 +0000</pubDate>
		<dc:creator>Scott Vanderlind</dc:creator>
				<category><![CDATA[General Bulletin]]></category>

		<guid isPermaLink="false">http://www.scotttherobot.com/?p=606</guid>
		<description><![CDATA[So, I&#8217;ve been planning to embark on a series of projects over the next few weeks/months/time units of my life. It&#8217;s midterm season, so instead of studying (what is studying?) I found myself working on these potentially-useless-but-novel projects. In this case, a receipt printer that prints out tweets by the minute. It&#8217;s my own version [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2568-e1330717344361.jpg"><img class="alignright size-medium wp-image-609" title="IMG_2568" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2568-e1330717344361-300x224.jpg" width="300" height="224" /></a>So, I&#8217;ve been planning to embark on a series of projects over the next few weeks/months/time units of my life. It&#8217;s midterm season, so instead of studying (what is studying?) I found myself working on these potentially-useless-but-novel projects. In this case, a receipt printer that prints out tweets by the minute. It&#8217;s my own version of an occasionally done project, and an idea that I had (but never really pursued) several years ago. My roommate found a post about a similar project on Engadget that was made using an Arduino, and it re-kindled my desire to do it.</p>
<p><span id="more-606"></span></p>
<p>Earlier in the week, I had won a thermal printer on Ebay. More specifically, it&#8217;s a Zebra LP-2443, commonly used by UPS and people who use UPS to print 4&#215;6 sticky-backed shipping labels. I won it for the bargain price of a little under $13, plus flat-rate shipping. This particular machine features the most high-tech interfaces (heh), RS-232 and IEEE-1284. These are more commonly known as serial and parallel, respectively. Now, while I am the owner of several types of computers, none of them were graced with either of these interfaces. So, I was off to Monoprice.com (one of my favorite shopping sites) where I picked up this little baby: A USB-parallel adapter.</p>
<p><a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/USB-parallel.jpg"><img class="size-medium wp-image-608 alignleft" title="USB-parallel" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/USB-parallel-300x225.jpg" width="300" height="225" /></a>It didn&#8217;t advertise any compatibility with Mac OS X or Linux (the platforms that I run), but I bought it anyway, because who can go wrong at the low price of $6? And I didn&#8217;t go wrong, because it worked wonderfully.</p>
<p>At first, I attempted to connect the printer to my Mac via a PL2303 USB-Serial adapter, but for some reason I couldn&#8217;t manage to get any bits to flow. I suspect it may have had something to do with the fact that I didn&#8217;t have any thermal stock besides a bunch of old receipts taped together, which the printer wasn&#8217;t very happy with.</p>
<p>Next I moved to the parallel adapter (Above? At left? Who knows where that danged photo went.) with my Mac, and that proved more promising, even with the jank paper. The adapter showed up in the Printer dialog and there was a Zebra EPL2 driver, and I was thrilled. The first time I tried to print something, it printed it with a little delay. Rejoice! I tried it again: Nothing. Well, that sucked.</p>
<p>So, I moved to a Linux machine, an &#8220;old&#8221; formerly-Vista-laptop my sister gave me. I plugged the adapter in, fired up the printer and the print settings dialog, and whaddyaknow, it saw it and had the very same EPL2 driver as my Mac. I opened Vim, typed &#8220;Hello, world.&#8221; and sent it to the printer. And I&#8217;ll be damned, it printed. I did it again, and it printed again. Holy crap, it was working.</p>
<p><a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2572-e1330718693450.jpg"><img class="alignright size-medium wp-image-611" title="IMG_2572" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2572-e1330718693450-224x300.jpg" width="224" height="300" /></a></p>
<p>Now, this whole time, my objective was to somehow push tweets to it, but only the most recent unprinted tweets. Now that I was on Linux, I assumed Twidge (a Twitter CLI) would be the answer, and I was right. My initial evaluation of Twidge was that it could just automatically spit out the recent tweets to a file, using a little terminal redirection and the crontab. Then, I would use diff (with more redirection) to compare those tweets to a file containing the tweets that have already been printed. Then I would take that file and process it using a hand-coded (on paper in my math class) C program that I wrote to insert carriage returns after every ~20th character to make it printable. And then print that out. All using cron to automate it.</p>
<p>Seems logical, right? Yes and no. Yes, it&#8217;s logical, but it&#8217;s grossly unnecessary. After reading the Twidge help file, I learned that it knows which tweets are read and unread and will happily only spit out the unread ones, simply by adding the -su flag to the command. Lovely! Everything I wrote about above is nullified and life is easy again.</p>
<p>I then looked into printing out the output of Twidge. I had expected I would have to redirect it to a file and then print that file. But again, I was wrong. By throwing on a &#8220;| lp&#8221; to the command, all output was piped (excuse the pun) to the default printer. Lovely. But it&#8217;s upside down. No bother, just rotate the output in the printer settings by 180°. Lovely, now they&#8217;re right side up. But wait, if there are a lot of tweets, they get disordered because they&#8217;re being printed in order but upside down&#8230; After reading the lp man page, I came up with a super elegant solution. This time it was to change &#8220;| lp&#8221; to &#8220;| lp -o outputorder=reverse&#8221;. That forces the printer to collate the already-rotated pages in reverse order, correcting the issue I was having.</p>
<p>So it works. I edited my crontab to execute that command &#8220;twidge lsrecent -su | lp -o outputorder=reverse&#8221; once a minute, on the minute, sixty times an hour, etc. for as long as the computer is running. Note to self: Don&#8217;t leave it running at night, because it&#8217;s loud enough to keep me from falling asleep the night before I have two midterms.</p>
<p>A few footnotes: I bought the thermal rolls at Staples because I needed them and they were the cheapest ones they had, that&#8217;s why they&#8217;re so narrow (half of the printer&#8217;s supported width). I plan to order wider ones online. I gave it it&#8217;s own twitter account so it only prints things I care about. Sorry, Engadget, you didn&#8217;t make the cut. Also, it kinda formats things jankily at the moment because.. I really don&#8217;t quite know why.</p>
<p>Addendum: Since I wrote this post, I determined why things were being formatted funnily. Twidge formats it&#8217;s output for the screen with lots of extra spaces and line-breaks, so it was not pretty on the printer. I have since written two little C programs that I pipe the tweets through before hitting the printer to format everything properly and even make appendages to some tweets. I will eventually write these up. The first one, called TweetReplacer, simply reads standard input into an array of a struct I designed to represent each tweet, scans the usernames for my friend&#8217;s account, and then adds a (rather inappropriate) hashtag to the end of all his tweets. The next one, called TwitterFormatter, arranges the tweets into a single column of 23-character lines. It&#8217;s smart enough to not break words in half when changing lines, too. I&#8217;m rather proud of it.</p>
<p>&nbsp;</p>
<p>Here are some final pictures for good measure.<a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2564.jpg"><img class="size-medium wp-image-612 alignleft" title="IMG_2564" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2564-e1330718915782-300x224.jpg" width="300" height="224" /></a><a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2556-e1330718934954.jpg"><img class="size-medium wp-image-613 alignleft" title="IMG_2556" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2556-e1330718934954-224x300.jpg" width="224" height="300" /></a><a href="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2558-e1330718949207.jpg"><img class="size-medium wp-image-614 alignleft" title="IMG_2558" alt="" src="http://www.scotttherobot.com/wp-content/uploads/2012/03/IMG_2558-e1330718949207-224x300.jpg" width="224" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scotttherobot.com/?feed=rss2&#038;p=606</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
