<?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>inconsequentia</title>
	<atom:link href="http://hardy.dropbear.id.au/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://hardy.dropbear.id.au/blog</link>
	<description></description>
	<lastBuildDate>Fri, 26 Apr 2013 17:26:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>UPnP/DLNA clients in Ubuntu 13.04</title>
		<link>http://hardy.dropbear.id.au/blog/2013/04/upnpdlna-clients-in-ubuntu-13-04</link>
		<comments>http://hardy.dropbear.id.au/blog/2013/04/upnpdlna-clients-in-ubuntu-13-04#comments</comments>
		<pubDate>Fri, 26 Apr 2013 16:45:57 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[upnp]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=229</guid>
		<description><![CDATA[Streaming content from a UPnP server (in my case, the XBMC media centre in my lounge room) to an Ubuntu machine is fairly simple. But there didn’t seem to be any documentation that I could find, and I ended up spending a surprising amount of time futzing around making it work. This is how I did [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2013/04/banshee-and-upnp-remote.png"><img class="alignleft size-medium wp-image-233" alt="Banshee and UPnP remote" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2013/04/banshee-and-upnp-remote-300x291.png" width="300" height="291" /></a>Streaming content from a UPnP server (in my case, the <a href="http://xbmc.org/">XBMC</a> media centre in my lounge room) to an Ubuntu machine is fairly simple. But there didn’t seem to be any documentation that I could find, and I ended up spending a surprising amount of time futzing around making it work. This is how I did it in Ubuntu 13.04. I use GNOME for my desktop, but confirmed that it also works just fine with the default Unity desktop. Other environments may need to tweak how the service starts, as well as clients.</p>
<h3>Install software</h3>
<p>We’re using the <a href="https://live.gnome.org/Rygel">Rygel</a> UPnP package, specifically its MPRIS interface to enable UPnP rendering to desktop media players. In addition, we install <a href="https://live.gnome.org/GUPnP/">GUPnP</a> to provide a UPnP Control Point, and finally <a href="http://banshee.fm/">banshee</a>. I had a crack at using Totem as a renderer, as of April 2013 the version in Ubuntu registered as a MediaRenderer but quietly refused to play any content I asked it to. The upnp-inspector package is nice for checking everything works.<br />
<code>sudo aptitude install rygel rygel-preferences gupnp-tools banshee upnp-inspector</code></p>
<h3>Configure rygel</h3>
<p>Open Rygel’s configuration file:<br />
<code>nano ~/.config/rygel.conf</code><br />
And enable the MPRIS interface by adding the following at end of the file:<br />
<code>[MPRIS]<br />
enabled=true</code></p>
<p>Rygel is designed as a UPnP media server, and by default will start offering up local video, music and picture shares as media servers. If you don’t want this, it can be disabled by running the Rygel Preferences GUI tool, or by adding this to the [general] section of your rygel.conf:<br />
<code>interface=<br />
upnp-enabled=false</code></p>
<h3>Autostart Rygel at login</h3>
<p><code>cp /usr/share/applications/rygel.desktop ~/.config/autostart</code><br />
Log out and back in to start the Rygel service.</p>
<h3>Configure Banshee</h3>
<p>Finally, the MPRIS interface needs to be enabled in Banshee. Start it up, navigate to Edit -&gt; Preferences. Click the Extensions tab, scroll down to the utilities section, and ensure the MPRIS D-Bus Interface is enabled.</p>
<h3>Playing things</h3>
<div id="attachment_231" class="wp-caption alignright" style="width: 310px"><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2013/04/upnp-inspector.png"><img class="size-medium wp-image-231 " alt="UPnP Inspector window" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2013/04/upnp-inspector-300x140.png" width="300" height="140" /></a><p class="wp-caption-text">Inspector window showing my XBMC server, the local Rygel share, banshee, and BubbleUPnP on my android phone.</p></div>
<p>Start UPnP Inspector. It should list any available MediaServers on your network and, if you didn’t disable them, local shares from Rygel. Start banshee, and it should also appear as a MediaRenderer in the inspector window.</p>
<p>Any UPnP control point on the network will be able to send content to banshee (I’m fond of <a href="https://play.google.com/store/apps/details?id=com.bubblesoft.android.bubbleupnp">BubbleUPnP</a> on Android). Or start the UPnP AV Remote control program. I’ve only been playing with it for an hour or two, but get best results from external control point software. The GUPnP remote occasionally stalls trying to play things.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2013/04/upnpdlna-clients-in-ubuntu-13-04/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking the Ikea DIODER in ten minutes flat</title>
		<link>http://hardy.dropbear.id.au/blog/2012/09/hacking-the-ikea-dioder-in-ten-minutes-flat</link>
		<comments>http://hardy.dropbear.id.au/blog/2012/09/hacking-the-ikea-dioder-in-ten-minutes-flat#comments</comments>
		<pubDate>Sun, 16 Sep 2012 14:57:49 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[blinkenlights]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=219</guid>
		<description><![CDATA[Last week I bought a set of DIODER lights from the Ikea down the road, pretty much on a whim. They’re not the cheapest way to buy RGB strip lighting, but I did like the modular design. And it’s remarkably easy to modify the controller to drive the system with an arduino. The system comes [...]]]></description>
				<content:encoded><![CDATA[<p>Last week I bought a set of <a href="http://www.ikea.com/au/en/catalog/products/10202328/">DIODER</a> lights from the Ikea down the road, pretty much on a whim. They’re not the cheapest way to buy RGB strip lighting, but I did like the modular design. And it’s remarkably easy to modify the controller to drive the system with an arduino.</p>
<p>The system comes with a controller that allows you to set a colour manually, as well as pre-set colour change and fade functions. Rather than build my own circuit I wanted to save time by reusing this controller. Opening it up revealed a PIC microcontroller, and three MOSFETs for the red, green and blue channels.</p>
<p><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/dioder-controller.jpg"><img class="alignright size-medium wp-image-220" title="Dioder control board" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/dioder-controller-224x300.jpg" alt="" width="224" height="300" /></a></p>
<p>First thing to do is disable the microcontroller by cutting through the power track. Cutting through the big pad I’ve marked on the diagram means it’s easy to then wire a switch across it if you want to be able to use the controller as normal.</p>
<p>Three output pins from the microcontroller drive the MOSFETs, but only two of them have big friendly solder pads, so I soldered wires on to the three resistors just below the MOSFETs (R5, R6 AND R7). Then soldered the other ends of these wires to a short strip of header pins. These are then plugged straight in to pins 9, 10 and 11 on my Arduino. I’ve labelled the picture with which MOSFET drives which LED channel, but they match what’s printed on the PCB where the input cable is connected.</p>
<p>Finally, we need a ground wire. Easiest way to connect it is to solder a wire on to the –ve wire on the input cable. The other end of that is again soldered on to a header pin, which is connected to the ground pin of the Arduino.</p>
<p>And that’s it. I hooked these up to my <a href="http://freetronics.com/leostick">LeoStick</a> the Freetronics guys gave away as swag for LCA 2012 and loaded up some <a href="https://github.com/phardy/ColourTester/blob/master/ColourTester.ino">demo code</a> I had sitting around from the last time I played with an RGB LED.</p>
<p><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/dioder-and-leostick.jpg"><img class="alignleft size-medium wp-image-222" title="Finished DIODER hack" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/dioder-and-leostick-300x225.jpg" alt="" width="300" height="225" /></a>Right now I’m using this setup as a light controller for <a href="http://code.google.com/p/boblight/">boblight</a> on my XBMC media centre. Setting up the controller, writing my own single-channel boblight sketch, installing software and configuring the XBMC addon was all done in a single evening. It was a lot of fun, and even with a single channel the results are pretty awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2012/09/hacking-the-ikea-dioder-in-ten-minutes-flat/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controlling external lighting with Arduino</title>
		<link>http://hardy.dropbear.id.au/blog/2012/09/controlling-external-lighting-with-arduino</link>
		<comments>http://hardy.dropbear.id.au/blog/2012/09/controlling-external-lighting-with-arduino#comments</comments>
		<pubDate>Tue, 04 Sep 2012 11:42:24 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[remote control]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=203</guid>
		<description><![CDATA[The path to my front door is long and very poorly lit. There’s a sensor light mounted above it, but that’s never worked and, living in a rental, getting it fixed has been a bit of a task. So I bought a roll of 3-wire LED rope light on eBay. Cable-tied it to the underside [...]]]></description>
				<content:encoded><![CDATA[<p>The path to my front door is long and very poorly lit. There’s a sensor light mounted above it, but that’s never worked and, living in a rental, getting it fixed has been a bit of a task. So I bought a roll of 3-wire LED rope light on eBay. Cable-tied it to the underside of the bottom stretcher of the fence running alongside the path. The power cable was fed in through a window by the front door, and I had nice, bright, even illumination. But it was still kind of boring. So I bought an ethernet-capable arduino.<span id="more-203"></span></p>
<p>My rope light has three wires — two strings of LEDs and a common ground. It also has a little control box with a rectifier and an MCU with a handful of pre-programmed modes. I cut the cable between the controller and the rope, and was incredibly surprised to discover that the LEDs were being fed with 240V DC. At a very low current, but still dangerous enough to make me throw away initial plans and approach it again with a lot more care. Also beefier relays.</p>
<p>The rest, though, was very straightforward. The Arduino Playground has <a href="http://arduino.cc/playground/Main/InterfacingWithHardware">plenty of information</a> about interfacing with relays. I’ve got 12V relays, so I’m using a 12V wall wart to power my Arduino board, and then run Vin from the Arduino out to power the relays via a <a href="http://arduino.cc/playground/uploads/Main/relays.pdf">simple driver circuit</a>. I’m not too pleased about running separate power supplies for the rope lights and the lower-powered control electronics, but I’m definitely not capable of doing anything about combining them yet, so that’s the way it will stay for now.</p>
<p>My first revision of this project used four of these drivers (I thought I’d find a use for the others… eventually) on a piece of prototype board, with header pins attached so I could attach it to the Arduino as a shield. It was my first non-trivial Arduino project, and first time I’d done any serious soldering for a while, so it looked rough as guts. But it worked, and gave me much more interesting ways to control my lighting. The first test of the full system, with a two-channel variant of the <a href="http://arduino.cc/en/Tutorial/Blink">Blink demo</a> sketch, looked like this (<a href="http://www.youtube.com/watch?v=iDIPC-zcYpg">direct youtube link</a>).</p>
<p><iframe width="500" height="281" src="http://www.youtube.com/embed/iDIPC-zcYpg?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<div id="attachment_209" class="wp-caption alignright" style="width: 234px"><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/teeny-shield.jpg"><img class="size-medium wp-image-209" title="Shield" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/teeny-shield-224x300.jpg" alt="" width="224" height="300" /></a><p class="wp-caption-text">Completed shield</p></div>
<p>I ran this board for a while, but wanted to control the outside lights from the same system as the <a title="Jackson PT9723 remote power control and Arduino" href="http://hardy.dropbear.id.au/blog/2012/08/jackson-pt9723-remote-power-control-and-arduino">power controller I built recently</a>, so build new drivers for my relays on the side of that shield. The end result was a very, very full short shield, but the entire thing looks much nicer, and very deserving of the translucent case I mounted it in. I still want to do a little more work with the hardware. First to add a hardware (illuminated) button for separate control of the outside lights, and then maybe look in to using an external voltage regulator to supply the 12V and 5V I’m using for the control board instead of feeding 12V in to the Arduino. But I’m very happy with the project so far.</p>
<p>I haven’t yet uploaded the software I wrote to run all of this. It needs tidying, and there’s a weird bug in the timers still, and sooner or later I’m going to have to change the hardcoded password in my branch. However, I love showing off the webpage, so check this out:</p>
<div id="attachment_211" class="wp-caption alignleft" style="width: 180px"><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/teeny-control-screenshot.png"><img class="size-medium wp-image-211 " title="Control screenshot" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/09/teeny-control-screenshot-170x300.png" alt="" width="170" height="300" /></a><p class="wp-caption-text">Remote control website running on my phone</p></div>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2012/09/controlling-external-lighting-with-arduino/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jackson PT9723 remote power control and Arduino</title>
		<link>http://hardy.dropbear.id.au/blog/2012/08/jackson-pt9723-remote-power-control-and-arduino</link>
		<comments>http://hardy.dropbear.id.au/blog/2012/08/jackson-pt9723-remote-power-control-and-arduino#comments</comments>
		<pubDate>Sun, 19 Aug 2012 15:04:03 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[remote control]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=144</guid>
		<description><![CDATA[The Jackson PT9723 is yet another 433MHz remote power control system. I picked mine up on sale from Officeworks last month, who don’t seem to sell them any more. But they’re still readily available online for a fairly modest price. I bought it with the intention of controlling it with an Arduino. However, interfacing with [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/Jackson-packaging.jpg"><img class="alignright size-medium wp-image-145" title="Jackson-packaging" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/Jackson-packaging-300x222.jpg" alt="Jackson blister pack" width="300" height="222" /></a><br />
The Jackson PT9723 is yet another 433MHz remote power control system. I picked mine up on sale from Officeworks last month, who don’t seem to sell them any more. But they’re still readily available online for a fairly modest price.</p>
<p>I bought it with the intention of controlling it with an Arduino. However, interfacing with it proved to be a little more difficult than most other systems around, and nobody else seems to have done it yet. So here’s how I managed it.<br />
<span id="more-144"></span></p>
<h3>About the remote</h3>
<p>The remote handles four separate channels. On the outside, rather than buttons that toggle each channel on or off, the remote has separate on and off buttons for each channel, as well as a 9th button to turn all channels off. On the inside there’s two main parts that we care about.</p>
<ul>
<li>A <a href="http://www.holtek.com/english/docum/consumer/71xx_1.htm">Holtek 7130A-1</a> power regulator. This takes the 12V from the battery and outputs 3V (at up to 30mA) to power the rest of the circuit. After accidentally hooking this up to my bench supply with the polarity reversed, I can confirm that these operate using <em>really</em> foul-smelling smoke. Luckily we won’t be requiring it any more.</li>
<li>A <a href="http://www.holtek.com/english/docum/consumer/4xr01t3.htm">Holtek HT46R01T3</a>. This chip combines a small MCU with a 433MHz transmitter. The data sheet specifies an operating voltage of 2V-3.6V, so it’s trivial to power from the 3.3V rail on an Arduino.</li>
</ul>
<p>Six of the GPIOs from the HT46R01T3 are used. Each button shorts a pair of these GPIOs together to tell the MCU to transmit a command. So to talk to an arduino we break out six GPIO pins, plus two more wires to power the remote.</p>
<h3>Parts</h3>
<p>As well as an Arduino, we use:</p>
<ul>
<li>A shift register. I used a <a href="http://freetronics.com/expand/">Freetronics EXPAND shift register module</a>.</li>
<li>8x NPN transistors. BC549s worked for me. A BC547 or any other equivalent should be fine.</li>
<li>8x 150kΩ resistors.</li>
<li>Some 8-strand ribbon cable, in addition to a handful of other hookup wire.</li>
</ul>
<h3>Hardware hacking</h3>
<p>Each command is triggered by shorting two GPIO pins together. The pins used, and the resulting command, look like:<br />

<table id="wp-table-reloaded-id-3-no-1" class="wp-table-reloaded wp-table-reloaded-id-3">
<thead>
	<tr class="row-1 odd">
		<th class="column-1"><strong>Pins</strong></th><th class="column-2"><strong>16</strong></th><th class="column-3"><strong>2</strong></th><th class="column-4"><strong>13</strong></th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1"><strong>14</strong></td><td class="column-2">Outlet 1 On</td><td class="column-3">Outlet 2 Off</td><td class="column-4">All Outlets Off</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1"><strong>15</strong></td><td class="column-2">Outlet 1 Off</td><td class="column-3">Outlet 3 On</td><td class="column-4">Outlet 4 On</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1"><strong>3</strong></td><td class="column-2">Outlet 2 On</td><td class="column-3">Outlet 4 Off</td><td class="column-4">Outlet 4 Off</td>
	</tr>
</tbody>
</table>
</p>
<p><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/remote-wiring.jpg"><img class="alignleft size-medium wp-image-151" title="remote-wiring" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/remote-wiring-225x300.jpg" alt="Internal wiring connections for remote" width="225" height="300" /></a></p>
<p style="text-align: left;">To start with, we take a length of 8-strand ribbon cable, and solder it on to the remote PCB. For power, use the negative battery terminal, and the far right (from the back) pin of the power regulator. For the GPIO pins, I used a continuity meter to trace them to a convenient solder pad on one of the push buttons.</p>
<p style="text-align: left;">For my remote, these are how the different wires wound up being connected:</p>
<p style="text-align: left;">
<table id="wp-table-reloaded-id-4-no-1" class="wp-table-reloaded wp-table-reloaded-id-4">
<tbody>
	<tr class="row-1 odd">
		<td class="column-1">Red</td><td class="column-2">+3.3V</td>
	</tr>
	<tr class="row-2 even">
		<td class="column-1">Brown</td><td class="column-2">GND</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">Grey</td><td class="column-2">Pin 2</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">Purple</td><td class="column-2">Pin 3</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">Blue</td><td class="column-2">Pin 13</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">Green</td><td class="column-2">Pin 14</td>
	</tr>
	<tr class="row-7 odd">
		<td class="column-1">Yellow</td><td class="column-2">Pin 15</td>
	</tr>
	<tr class="row-8 even">
		<td class="column-1">Orange</td><td class="column-2">Pin 16</td>
	</tr>
</tbody>
</table>
</p>
<div id="attachment_172" class="wp-caption alignright" style="width: 310px"><a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/power-control-excerpt_schem.png"><img class="size-medium wp-image-172" title="Sample switch connection" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/power-control-excerpt_schem-300x204.png" alt="" width="300" height="204" /></a><p class="wp-caption-text">Using output 7 on the shift register to issue a command through the remote.</p></div>
<p>We use a separate transistor to activate each command, omitting the “all outputs off” command. Each output from the shift register is connected to a 150kΩ resistor, which is then connected to the base of an NPN transistor. Two GPIO pins are then connected to the collector and emitter pins of the transistor. To issue the “Outlet 1 On” command, connect GPIO pins 14 and 16. It doesn’t seem to matter which way around these are connected to the transistor — I tested both orientations and they seemed to work.</p>
<p>We need eight of these switches. I tested each command on a breadboard, and then individually after assembling them on a prototype board. Once they’re assembled they’re connected to the outputs from the shift register. My code uses “Outlet 1 On” hooked to output H, “Outlet 1 Off” to output G, “Outlet 2 On” to output F and so on. Because I assembled it upside down. :-(</p>
<p>Connect the +ve wire from the remote to the 3.3V power pin on the Arduino, and the ground wire from the remote to one of the ground pins on the Arduino.</p>
<p>Finally, the shift register is connected to the Arduino. For the EXPAND module:</p>
<ul>
<li>Connect Vcc and Reset pins to the 5V supply on the Arduino.</li>
<li>Connect GND and Output Enable pins to the GND pin on the Arduino.</li>
<li>Connect Clock to digital pin 5 on the Arduino.</li>
<li>Connect Latch to digital pin 6 on the Arduino.</li>
<li>Connect Serial In to digital pin 7 on the Arduino.</li>
</ul>
<p>It gets a little bit cramped, but I was able to fit the EXPAND module and all other components on to a Freetronics ProtoShield Short, with enough room left over on the right hand side for a couple more relay drivers that I am avoiding discussing in this post.<a href="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/Jackson-shield.jpg"><img class="alignleft size-medium wp-image-178" title="Remote control shield" src="http://hardy.dropbear.id.au/blog/wp-content/uploads/2012/08/Jackson-shield-224x300.jpg" alt="" width="224" height="300" /></a></p>
<h3>Software hacking</h3>
<p>To transmit a command we have to simulate a button press:</p>
<ul>
<li>Send a value to the shift register turning on the appropriate register output.</li>
<li>Delay briefly. 500ms works well to just issue a command. If you want to use the arduino to program outlets then closer to 2000ms would be needed.</li>
<li>Send a 0 to the shift register to turn off all register outputs.</li>
</ul>
<p>The below sample sketch listens for keystrokes entered on the serial console, and sends the associated command. Train a couple of outlets to the remote, load the sketch, open a serial console (make sure the “no line ending” option is set), and then if you’re anything like me spend half an hour typing on the keyboard and giggling at the little LEDs turning on and off.</p>
<pre name="code" class="c">
/* RemoteDemo
   Demo sketch for Jackson remote power control.

   Hardware:
   A shift register connected to pins 5, 6, and 7.
   Outputs are wired as:
     A: 4off
     B: 4on
     C: 3off
     D: 3on
     E: 2off
     F: 2on
     G: 1off
     H: 1on

   Run the sketch, and open the Serial Monitor in the Arduino IDE.
   Typing a letter between a-h will send the associated command.
*/
// IO pins
const int dataPin = 7;
const int latchPin = 6;
const int clockPin = 5;

boolean cmdEnabled = false; // true if we're sending a command
long cmdTimer = 0;          // track how long we're sending command
int inByte = 0;             // incoming serial byte

void sendCmdOn(int cmd) {
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, cmd);
  digitalWrite(latchPin, HIGH);
  cmdEnabled = true;
  cmdTimer = millis() + 500;
}

void sendCmdOff() {
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, 0);
  digitalWrite(latchPin, HIGH);
  cmdEnabled = false;
}

void setup() {
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);

  // Flush the expand module
  sendCmdOff();

  Serial.begin(9600);
}

void loop() {
  // If there's a serial character waiting, parse it
  // and send the appropriate command.
  if (Serial.available() &gt; 0) {
    inByte = char(Serial.read());
    switch (inByte) {
    case 'h':
      Serial.println("Turning on Outlet 1");
      sendCmdOn(128);
      break;
    case 'g':
      Serial.println("Turning off Outlet 1");
      sendCmdOn(64);
      break;
    case 'f':
      Serial.println("Turning on Outlet 2");
      sendCmdOn(32);
      break;
    case 'e':
      Serial.println("Turning off Outlet 2");
      sendCmdOn(16);
      break;
    case 'd':
      Serial.println("Turning on Outlet 3");
      sendCmdOn(8);
      break;
    case 'c':
      Serial.println("Turning off Outlet 3");
      sendCmdOn(4);
      break;
    case 'b':
      Serial.println("Turning on Outlet 4");
      sendCmdOn(2);
      break;
    case 'a':
      Serial.println("Turning off Outlet 4");
      sendCmdOn(1);
      break;
    default:
      Serial.println("Invalid command received");
    }
  }

  // If we've exceeded the timer, stop sending a command.
  if (cmdEnabled &amp;&amp; cmdTimer &lt; millis()) {
    Serial.println("Releasing button");
    sendCmdOff();
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2012/08/jackson-pt9723-remote-power-control-and-arduino/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>So long, momo :-(</title>
		<link>http://hardy.dropbear.id.au/blog/2010/01/so-long-momo</link>
		<comments>http://hardy.dropbear.id.au/blog/2010/01/so-long-momo#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:06:36 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=135</guid>
		<description><![CDATA[Yesterday I bricked my phone. I bought a HTC Dream on an Optus plan the day they released it in Australia. Out of the box it was awesome, pretty much everything I wanted out of a smartphone. But as time passed, the Cupcake android release became widespread, and Optus lollygagged about pushing the update out [...]]]></description>
				<content:encoded><![CDATA[<p>Yesterday I bricked my phone.</p>
<p>I bought a HTC Dream on an Optus plan the day they released it in Australia. Out of the box it was awesome, pretty much everything I wanted out of a smartphone. But as time passed, the Cupcake android release became widespread, and Optus lollygagged about pushing the update out to their users. One by one my favourite applications released updates that made them incompatible with my phone, until eventually I gave up and found a good guide on rooting G1s.</p>
<p>With an up-to-date <a href="http://www.cyanogenmod.com/">firmware</a> and <a href="http://code.google.com/p/market-enabler/">Market Enabler</a> to get around Optus’ other major problem of not making paid applications available, I was in smartphone heaven. That was until I heard wind of ROMs based on the Android 2.1 release (as seen on the new Nexus One handset) running on the G1. It looked like it might be fun to try, so off I went.</p>
<p>One of the steps involved in initially rooting a handset involves loading a new <a href="http://android-dls.com/wiki/index.php?title=Android_FAQ#Q:_What_is_an_SPL.3F">SPL</a> to bypass region checking and enable booting unsigned ROMs, so I’d done it a couple of times before and was fairly comfortable with it. Unfortunately, newer builds need the Haykuro SPL, which is supposed to be more aggressive with how it deals with the internal storage space (leading to more size for bigger images), but also kind of dangerous. I double– and triple-checked everything, but still seem to have screwed something up flashing the SPL, and now I have a phone that is basically dead. The 1st bootloader screen comes up, but I can’t get in to the fastboot menu or the recovery image. My poor little momo (my computers are named after <a href="http://en.wikipedia.org/wiki/Samurai_Champloo">Samurai Champloo</a> characters) was no more.</p>
<p>Luckily my birthday was yesterday, so I don’t feel too bad about treating myself to a new phone. After a morning of reading reviews, I think I’ve decided on a <a href="http://www.engadget.com/2009/11/02/motorola-milestone-does-what-droidont/">Motorola Milestone</a>. I’m a little wary of Motorola — my last Moto handset was an absolute disaster, and working for a mobile communications company means I’ve had a chance to tinker with newer Motorola handsets that were similarly disappointing. But the Milestone seems to be a very impressive and solidly-built phone. The jury is still out on whether the Milestone or the new Nexus One would win for Best Android Phone right now, but I for one am swayed by a good hardware keyboard.</p>
<p>So, momo is dead, long live… uh… momo?</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2010/01/so-long-momo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spontaneous travel</title>
		<link>http://hardy.dropbear.id.au/blog/2009/10/spontaneous-travel</link>
		<comments>http://hardy.dropbear.id.au/blog/2009/10/spontaneous-travel#comments</comments>
		<pubDate>Sun, 18 Oct 2009 15:52:32 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[non-nerd]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=129</guid>
		<description><![CDATA[I’ve been on holiday for most of the last week. One of my brothers in Adelaide was getting married in a beach-front ceremony in the small town of Port Rickaby, a few hours drive west of Adelaide. I took some extra time off work, because I wanted a holiday, and wound up spending a couple [...]]]></description>
				<content:encoded><![CDATA[<p>I’ve been on holiday for most of the last week. One of my brothers in Adelaide was getting married in a beach-front ceremony in the small town of Port Rickaby, a few hours drive west of Adelaide. I took some extra time off work, because I wanted a holiday, and wound up spending a couple of days in Coober Pedy. Coober Pedy is a very very strange place, and well worth a visit. The opal industry is fascinating. I might write some more about Coober Pedy, not just because I like saying Coober Pedy. But the point of this post is a very brief rant about spontaneous traveling.</p>
<p>I flew out of Sydney on Tuesday evening. On Tuesday morning I realised I should probably think of something to do with my hire car and my three blissful days of nothing before I had to be at Rickaby, so spent some time with google maps. Eventually picked Coober Pedy because:</p>
<ul>
<li>I’d never really been to central Australia before. Seen some bits of desert while tooling around in WA, but not <em>true</em> outback.</li>
<li>My vague recollection was that it was a pretty interesting place.</li>
<li>I like saying Coober Pedy.</li>
<li>It was about as far away from anywhere I’ve been before, that I could reasonably get to in the time I had.</li>
</ul>
<p>I tried explaining this to a bloke I met in the pub in Coober Pedy. He was absolutely amazed, and couldn’t quite comprehend that somebody would just, on the spur of the moment, get in a car and spend ten hours driving to Coober Pedy, just because.</p>
<p>Last year I went to Cowra because on a Friday morning I thought “hrmn, I want to go somewhere this weekend, where should I go?”, and picking Cowra because I hadn’t traveled West of Sydney much, and Cowra seemed about as far as I could reasonably drive on a Friday night. I got there and had a conversation with a bloke in a pub that went something like:<br />
“So if you’re from Sydney, what are you doing out here? Work?“<br />
”*shrug* Just having a look around. Wanted to get out of town for a weekend, and wound up here.“<br />
”…bullshit.“<br />
<small>Incidentally, the Japanese garden at Cowra is the largest in the southern hemisphere, and absolutely amazing.</small></p>
<p>By the time I’d gotten to Taralga six months ago, I’d given up and just told people that I was on my way to Yass but had to go via Bathurst because *mumble*mumble*. That seemed like a much more realistic explanation than wanting to see more of inland NSW (and telling them I’d taken a two-door hatch along <a href="http://en.wikipedia.org/wiki/Wombeyan_Caves_Road">Wombeyan Caves Road</a> would have probably been pretty damn embarrassing).</p>
<p>What’s the big deal? Do people not just travel for the hell of it any more? Maybe they think it only counts if you’re going overseas? Have we forgotten how much of the new and exciting is sitting right at our doorstep (and if not there, <strong>definitely</strong> a two hour flight and ten hour drive from it)? Maybe small town inhabitants just don’t believe their particular small town is worth visiting (I know I <em>still</em> think this about Yass).</p>
<p>When was the last time <em>you</em> threw the figurative dart at a map?</p>
<p>Can I fit the words “Coober Pedy” in to this post one more time?</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2009/10/spontaneous-travel/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PXE booting using OpenWRT Kamikaze</title>
		<link>http://hardy.dropbear.id.au/blog/2009/04/pxe-booting-using-openwrt-kamikaze</link>
		<comments>http://hardy.dropbear.id.au/blog/2009/04/pxe-booting-using-openwrt-kamikaze#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:00:51 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dnsmasq]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=126</guid>
		<description><![CDATA[My network gets its addresses from dnsmasq running on the Kamikaze 8.09 release of OpenWRT. This operating system uses an unusual system for configuration, and getting dnsmasq set up for network booting took a little bit of effort. So I’m documenting it here, for either anybody else who’s stuck on it, or for when I [...]]]></description>
				<content:encoded><![CDATA[<p>My network gets its addresses from <a href="http://thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> running on the Kamikaze 8.09 release of <a href="http://openwrt.org/">OpenWRT</a>. This operating system uses an unusual system for configuration, and getting dnsmasq set up for network booting took a little bit of effort. So I’m documenting it here, for either anybody else who’s stuck on it, or for when I inevitably forget.</p>
<p>Edit <code>/etc/config/dhcp</code>, and in the <code>config dnsmasq</code> section add a line like this. The format is as per the dnsmasq man page:</p>
<pre>    option dhcp_boot	pxelinux.0,tftp_server_hostname,tftp_server_ipaddr</pre>
<p>The init script does all the parsing of the dhcp config file, converting things in there to cmdline arguments to dnsmasq. So you need to edit <code>/etc/init.d/dnsmasq</code>, and in the <code>dnsmasq()</code> function add this line:</p>
<pre>	append_parm "$cfg" "dhcp_boot" "--dhcp-boot"</pre>
<p>The function already has a bunch of append_parm lines. Just search for those and add your new line immediately under them.</p>
<p>Restart dnsmasq and you’re good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2009/04/pxe-booting-using-openwrt-kamikaze/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Belated Ada Lovelace day post</title>
		<link>http://hardy.dropbear.id.au/blog/2009/03/belated-ada-lovelace-day-post</link>
		<comments>http://hardy.dropbear.id.au/blog/2009/03/belated-ada-lovelace-day-post#comments</comments>
		<pubDate>Wed, 25 Mar 2009 06:45:42 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AdaLovelaceDay09]]></category>
		<category><![CDATA[lca2009]]></category>
		<category><![CDATA[linux.conf.au]]></category>
		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=117</guid>
		<description><![CDATA[I know I’m running late, I’ve barely had time to think lately, let alone try to assemble a coherent blog post. But yesterday was Ada Lovelace day and I wanted to draw some attention to one of the less vocal but definitely no less important members of the Sydney IT community; good friend and crack [...]]]></description>
				<content:encoded><![CDATA[<p>I know I’m running late, I’ve barely had time to think lately, let alone try to assemble a coherent blog post. But yesterday was <a href="http://findingada.com/">Ada Lovelace day</a> and I wanted to draw some attention to one of the less vocal but definitely no less important members of the Sydney IT community; good friend and crack geek feminist ninja Alice Boxhall.</p>
<p><a href="http://www.flickr.com/photos/stibbons/2130359688/" title="Alice by stibbons, on Flickr"><img src="http://farm3.static.flickr.com/2246/2130359688_a8541853da.jpg" width="500" height="333" alt="Alice" /></a><br />
<small>(apparently I don’t have a picture of her doing anything particularly nerdy)</small></p>
<p>I first met Alice[1] not too long after she was hired by Google, as the sole female engineer in their Sydney office. Happily, that doesn’t seem to be the case any more, but she continues to do a lot of great work as an IT evangelist. Along with Pia Waugh, Alice works with school-age girls encouraging them to get involved with computing, most recently at the <a href="http://www.vicictforwomen.com.au/www/html/197-gogirl-go-for-it---2008.asp">Go Go Girl for IT</a> event. She’s also been involved with local Aussiechix events, helping run the <a href="http://conf.au.linuxchix.org/2008-microconference-sydney-and-melbourne">micro-confs</a> in Sydney and Melbourne last year, as well as being involved in Linuxchix miniconfs at recent LCAs.</p>
<p>I’m always impressed by her encyclopedic knowledge of the issues women face, both in the professional IT sphere and elsewhere, and the passion and clarity she brings to defending her rights and the rights of other women. I listened in on Alice’s group during the Evangelising IT workshop at the Linuxchix miniconf this year, which came up with some excellent strategies for trying to keep girls (and boys as well!) interested in computing. It was one of the highlights of LCA for me this year.</p>
<p><a href="http://www.flickr.com/photos/stibbons/3208706511/" title="Linuxchix miniconf: Evangelising IT workshop by stibbons, on Flickr"><img src="http://farm4.static.flickr.com/3428/3208706511_f1c482aac7.jpg" width="500" height="333" alt="Linuxchix miniconf: Evangelising IT workshop" /></a></p>
<p>On a completely unrelated note, Alice is a very talented photographer who shares my love for old-school picture making. Having a chance to learn from her both behind the camera and in the darkroom is just another reason for me to feel inspired by her work.</p>
<p>[1] For the record, I believe this happened shortly after my then-housemate, <a href="http://spacepants.org/">Jamie</a> also started work at Google. I arrived home one afternoon to find half the Google office in our pool.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2009/03/belated-ada-lovelace-day-post/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>1234567890</title>
		<link>http://hardy.dropbear.id.au/blog/2009/02/1234567890</link>
		<comments>http://hardy.dropbear.id.au/blog/2009/02/1234567890#comments</comments>
		<pubDate>Fri, 13 Feb 2009 23:44:59 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[1234567890]]></category>
		<category><![CDATA[nerdy anniversaries]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=115</guid>
		<description><![CDATA[Well, that was fun. peter@fuu:~$ date +%s 1234567890 Apparently the next big event is 0x50000000 seconds since epoch, due to happen shortly after 9pm on the 13th of July, 2012.]]></description>
				<content:encoded><![CDATA[<p>Well, that was fun.</p>
<p><code>peter@fuu:~$ date +%s<br />
1234567890</code></p>
<p>Apparently the next big event is 0x50000000 seconds since epoch, due to happen shortly after 9pm on the 13th of July, 2012.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2009/02/1234567890/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finally framed</title>
		<link>http://hardy.dropbear.id.au/blog/2009/02/finally-framed</link>
		<comments>http://hardy.dropbear.id.au/blog/2009/02/finally-framed#comments</comments>
		<pubDate>Tue, 10 Feb 2009 12:14:35 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[non-nerd]]></category>
		<category><![CDATA[lca2009 linux.conf.au photography]]></category>

		<guid isPermaLink="false">http://hardy.dropbear.id.au/blog/?p=111</guid>
		<description><![CDATA[I really wanted to bring my LCA auction print to the SLUG meeting week before last, but I’d already taken it to the framer and spent a good hour or so trying to decide how it should be framed. The Framing Factory in Roseville do consistently excellent work, and I’m always happy with them. Unfortunately [...]]]></description>
				<content:encoded><![CDATA[<p>I really wanted to bring my <a href="http://hardy.dropbear.id.au/blog/2009/01/how-to-win-an-lca-charity-auction-without-really-trying">LCA auction print</a> to the <a href="http://slug.org.au/">SLUG</a> meeting week before last, but I’d already taken it to the framer and spent a good hour or so trying to decide how it should be framed. The Framing Factory in Roseville do consistently excellent work, and I’m always happy with them. Unfortunately they have a two week turnaround (although I did get a rush job out of them a few days before Christmas, but my mind has blanked out how much extra it cost). Well, today I finally picked it up. And once again they didn’t disappoint.</p>
<p><a title="&quot;Neptune's Fury&quot;, framed and hung. by stibbons, on Flickr" href="http://www.flickr.com/photos/stibbons/3269385534/"><img src="http://farm4.static.flickr.com/3462/3269385534_e0fbb5da0e.jpg" alt="&quot;Neptune's Fury&quot;, framed and hung." width="500" height="333" /></a></p>
<p>We went with a 100mm (3.9″) flat white matte, surrounded by a 70mm (2.8″) plain black frame. Apart from a slight bevel on the inside edge, the frame is plain and square. All told, this thing is 1070mmx870mm (42.1“x34.3″), easily the biggest and most impressive print I own.</p>
<p>I couldn’t be happier with the way it’s come out, and I’m incredibly proud to have such a beautiful and prestigious print gracing my lounge room.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardy.dropbear.id.au/blog/2009/02/finally-framed/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
