<?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>molen, inc.</title>
	<atom:link href="http://alexmole.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexmole.co.uk</link>
	<description></description>
	<lastBuildDate>Tue, 13 Dec 2011 23:46:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Ikea DIODER custom controller</title>
		<link>http://alexmole.co.uk/2011/12/ikea-dioder-custom-controller/</link>
		<comments>http://alexmole.co.uk/2011/12/ikea-dioder-custom-controller/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 23:26:00 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[making]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[dioder]]></category>
		<category><![CDATA[nanode]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=78</guid>
		<description><![CDATA[Like lots of folks on the internet, I saw the DIODER and felt that it could be improved. And what better way than to make it internet-controlled? Given that I had a Nanode lying around looking for a use it &#8230; <a href="http://alexmole.co.uk/2011/12/ikea-dioder-custom-controller/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Like lots of folks on the internet, I saw the <a title="DIODER" href="http://www.ikea.com/gb/en/catalog/products/00202324/" target="_blank">DIODER</a> and felt that it could be improved. And what better way than to make it internet-controlled? Given that I had a Nanode lying around looking for a use it seemed like providence.</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/photo-2.jpg"><img class="aligncenter size-large wp-image-87" title="dioder" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/photo-2-1024x764.jpg" alt="Finished DIODER controller" width="584" height="435" /></a></p>
<p>So the plan was this:</p>
<ul>
<li>Instead of just cycling between some gaudy colours, lets pick some classier ones</li>
<li>Let&#8217;s allow the colours to be updated via the web, saving them to EEPROM</li>
<li>Using 1D Perlin noise to blend between a pair of colours will allow for pleasing fades and far more interest than just transitioning from A-&gt;B (so much interest that it turned out 2 colours is all it needs &#8230; for now)</li>
<li>Use HSL colour space for super-classy fading</li>
</ul>
<div>And here&#8217;s the code that does all that: <a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/rgb.pde">rgb.pde</a>.</div>
<div>The hardware side was pretty straightforward &#8211; a MOSFET (Stp36nf06l) per channel to buffer the output from the microcontroller (the LEDs run at 12v). I just used the 12v adaptor that came with the DIODER, and ditched the Ikea controller and little junction box thingy. I did add a switch to kick the ethernet chip into a low power mode (because it saves ~350mA and it was easy <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</div>
<p>&nbsp;</p>
<div><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/photo-3.jpg"><img class="aligncenter size-large wp-image-88" title="dioder-circuit" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/photo-3-1024x764.jpg" alt="closeup of the controller board" width="584" height="435" /></a></div>
<div>It took a while to figure out the HSL colour space, so here&#8217;s what I ended up with:</div>
<pre><span style="color: #7e7e7e;">// based on http://www.dipzo.com/wordpress/?p=50</span>
<span style="color: #cc6600;">void</span> hslToRgb( <span style="color: #cc6600;">int</span> hue, <span style="color: #cc6600;">byte</span> sat, <span style="color: #cc6600;">byte</span> light, <span style="color: #cc6600;">byte</span>* lpOutRgb )
{
  <span style="color: #cc6600;">if</span>( sat == 0 )
  {
    lpOutRgb[0] = lpOutRgb[1] = lpOutRgb[2] = light;
    <span style="color: #cc6600;">return</span>;
  }

  <span style="color: #cc6600;">float</span> nhue   = (<span style="color: #cc6600;">float</span>)hue * (1.0f / 360.0f);
  <span style="color: #cc6600;">float</span> nsat   = (<span style="color: #cc6600;">float</span>)sat * (1.0f / 255.0f);
  <span style="color: #cc6600;">float</span> nlight = (<span style="color: #cc6600;">float</span>)light * (1.0f / 255.0f);

  <span style="color: #cc6600;">float</span> m2;
  <span style="color: #cc6600;">if</span>( light &lt; 128 )
    m2 = nlight * ( 1.0f + nsat );
  <span style="color: #cc6600;">else</span>
    m2 = ( nlight + nsat ) - ( nsat * nlight );

  <span style="color: #cc6600;">float</span> m1 = ( 2.0f * nlight ) - m2;

  lpOutRgb[0] = hueToChannel( m1, m2, nhue + (1.0f / 3.0f) );
  lpOutRgb[1] = hueToChannel( m1, m2, nhue );
  lpOutRgb[2] = hueToChannel( m1, m2, nhue - (1.0f / 3.0f) );
}

<span style="color: #cc6600;">byte</span> hueToChannel( <span style="color: #cc6600;">float</span> m1, <span style="color: #cc6600;">float</span> m2, <span style="color: #cc6600;">float</span> h )
{
  <span style="color: #cc6600;">float</span> channel = hueToChannelInternal( m1, m2, h );
  <span style="color: #cc6600;">byte</span>  uchan   = (<span style="color: #cc6600;">byte</span>)(255.0f * channel);
  <span style="color: #cc6600;">return</span> uchan;
}

<span style="color: #cc6600;">float</span> hueToChannelInternal( <span style="color: #cc6600;">float</span> m1, <span style="color: #cc6600;">float</span> m2, <span style="color: #cc6600;">float</span> h )
{
   <span style="color: #cc6600;">if</span>( h &lt; 0.0f ) h += 1.0f;
   <span style="color: #cc6600;">if</span>( h &gt; 1.0f ) h -= 1.0f;

   <span style="color: #cc6600;">if</span>( ( 6.0f * h ) &lt; 1.0f )  <span style="color: #cc6600;">return</span> ( m1 + ( m2 - m1 ) * 6.0f * h );
   <span style="color: #cc6600;">if</span>( ( 2.0f * h ) &lt; 1.0f )  <span style="color: #cc6600;">return</span> m2;
   <span style="color: #cc6600;">if</span>( ( 3.0f * h ) &lt; 2.0f )  <span style="color: #cc6600;">return</span> ( m1 + ( m2 - m1 ) * ((2.0f/3.0f) - h) * 6.0f );
   <span style="color: #cc6600;">return</span> m1;
}</pre>
<p>I also experimented with adding a gamma curve to the output, but while it definitely improved colour matching, it made fading a lot more jerky, so I didn&#8217;t go with it in the end.</p>
<p>Once I had reliable HSL-&gt;RGB working, I needed a good HSL interpolate function. That took some effort. I found you can use a straight linear interpolate on the S &amp; L channels, but you need a custom one for the Hue channel as it needs to pick the shortest way to go around the circle. I also wrote it all to treat the interpolation parameter as a value from 0 to 1 in 0.8 fixed point format. This is how it looks:</p>
<pre><span style="color: #cc6600;">void</span> lerpHsl( const <span style="color: #cc6600;">int</span>* a, const <span style="color: #cc6600;">int</span>* b, <span style="color: #cc6600;">byte</span> t, <span style="color: #cc6600;">int</span>* lpOutHsl )
{
  lpOutHsl[0] = lerpHueFp8( a[0], b[0], t );
  lpOutHsl[1] = lerpFp8( a[1], b[1], t );
  lpOutHsl[2] = lerpFp8( a[2], b[2], t );
}

<span style="color: #cc6600;">int</span> lerpFp8( <span style="color: #cc6600;">int</span> a, <span style="color: #cc6600;">int</span> b, <span style="color: #cc6600;">byte</span> t )
{
  <span style="color: #cc6600;">long</span> t0 = ( b - a ) * t;
  <span style="color: #cc6600;">return</span> ( a + ( t0 &gt;&gt; 8 ) );
}

<span style="color: #cc6600;">int</span> lerpHueFp8( <span style="color: #cc6600;">int</span> a, <span style="color: #cc6600;">int</span> b, <span style="color: #cc6600;">byte</span> t )
{  
  <span style="color: #7e7e7e;">// adjust inputs so we take the shortest route around the circle</span>
  <span style="color: #cc6600;">int</span> cwdist = b - a;
  <span style="color: #cc6600;">if</span>( <span style="color: #cc6600;">abs</span>(cwdist) &gt; 180 )
  {
    <span style="color: #cc6600;">if</span>( b &gt; a )  a += 360;
    <span style="color: #cc6600;">else</span>         b += 360;
  }

  <span style="color: #cc6600;">long</span> t0 = ( b - a ) * t;
  <span style="color: #cc6600;">int</span> l = a + (t0 &gt;&gt; 8);

  <span style="color: #cc6600;">return</span> ( l % 360 );
}</pre>
<p>The last colour-related piece was to get a good 1D Perlin noise-like function. After some googling failed to turn up a nice implementation for Arduino, I built this, based on Hugo Elias&#8217; great page <a title="here" href="http://freespace.virgin.net/hugo.elias/models/m_perlin.htm" target="_blank">here</a>.</p>
<pre>#define kPerlinOctaves      3
<span style="color: #cc6600;">static</span> const <span style="color: #cc6600;">float</span> kaPerlinOctaveAmplitude[kPerlinOctaves] =
{
  0.75f, 0.4f, 0.1f,
};

<span style="color: #cc6600;">float</span> perlinNoise1( <span style="color: #cc6600;">long</span> x )
{
  x = ( x&lt;&lt;13 ) ^ x;
  <span style="color: #cc6600;">return</span> ( 1.0f - ( (x * (x * x * 15731 + 789221L) + 1376312589L) &amp; 0x7fffffff) * (1.0f / 1073741824.0f) );
}

<span style="color: #cc6600;">float</span> perlinSmoothedNoise1( <span style="color: #cc6600;">long</span> x )
{
  <span style="color: #cc6600;">return</span> perlinNoise1(x)*0.5f
       + perlinNoise1(x-1)*0.25f
       + perlinNoise1(x+1)*0.25f;
}

<span style="color: #cc6600;">float</span> perlinLerpedNoise1( <span style="color: #cc6600;">float</span> x )
{
  <span style="color: #cc6600;">long</span>  xInteger  = <span style="color: #cc6600;">long</span>(x);
  <span style="color: #cc6600;">float</span> xFraction = x - xInteger;

  <span style="color: #cc6600;">float</span> v1 = perlinSmoothedNoise1( xInteger );
  <span style="color: #cc6600;">float</span> v2 = perlinSmoothedNoise1( xInteger + 1 );

  <span style="color: #cc6600;">return</span> lerpFloat( v1, v2, xFraction );
}

<span style="color: #cc6600;">float</span> perlinNoise1D( <span style="color: #cc6600;">float</span> x )
{
  <span style="color: #cc6600;">float</span> total = 0.0f;

  <span style="color: #cc6600;">for</span>( <span style="color: #cc6600;">int</span> octave = 0; octave &lt; kPerlinOctaves; octave++ )
  {
    <span style="color: #cc6600;">int</span>   frequency = 1 &lt;&lt; octave;
    <span style="color: #cc6600;">float</span> amplitude = kaPerlinOctaveAmplitude[octave];

    total += perlinLerpedNoise1( x * frequency ) * amplitude;
  }

  <span style="color: #7e7e7e;">// map from [-1,1] to [0,1] and constrain</span>
  <span style="color: #cc6600;">return</span> <span style="color: #cc6600;">constrain</span>( (total + 1.0f) * 0.5f, 0.0f, 1.0f );
}</pre>
<p>This generates the following output, which looks pretty sweet when used as the interpolation parameter</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/perlin.png"><img class="aligncenter size-medium wp-image-95" title="perlin" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/12/perlin-300x129.png" alt="" width="300" height="129" /></a></p>
<p>With that, all of the RGB LED controlling was done <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For the web interface, I used the excellent <a title="EtherCard" href="http://jeelabs.net/projects/11/wiki/EtherCard" target="_blank">EtherCard</a> library, which made it super-easy.</p>
<p>&nbsp;</p>
<p>Job done*!</p>
<p>&nbsp;</p>
<p>*actually, I still need to build a nice jQuery&#8217;d webpage to make setting colours easier. Currently I need to go to http://192.168.1.25/hsl?i=0&amp;h=135&amp;s=90&amp;l=50, which isn&#8217;t exactly as futuristic as I&#8217;d like <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/12/ikea-dioder-custom-controller/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>nanode liiiives!</title>
		<link>http://alexmole.co.uk/2011/09/nanode-liiiives/</link>
		<comments>http://alexmole.co.uk/2011/09/nanode-liiiives/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 20:45:31 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[making]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[nanode]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=75</guid>
		<description><![CDATA[My FTDI cable arrived today! The nanode I built says this: DHCP Client test 0:4:A3:2C:28:AE Init ENC28J60 Init done ENC28J60 version 7 Requesting IP Addresse My IP: 192.168.1.69 Netmask: 255.255.255.0 DNS IP: 192.168.1.254 GW IP: 192.168.1.254 w00t Now I can &#8230; <a href="http://alexmole.co.uk/2011/09/nanode-liiiives/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://avitresearch.co.uk/usb2ttl_ftdi.htm">FTDI cable</a> arrived today!</p>
<p>The nanode I built says this:<br />
<code><br />
DHCP Client test<br />
0:4:A3:2C:28:AE<br />
Init ENC28J60<br />
Init done<br />
ENC28J60 version 7<br />
Requesting IP Addresse<br />
My IP: 192.168.1.69<br />
Netmask: 255.255.255.0<br />
DNS IP: 192.168.1.254<br />
GW IP: 192.168.1.254<br />
</code></p>
<p>w00t <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now I can get on and make &#8230; something &#8230; with it!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/09/nanode-liiiives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brighton Mini Maker Faire</title>
		<link>http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/</link>
		<comments>http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 18:07:26 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[making]]></category>
		<category><![CDATA[maker faire]]></category>
		<category><![CDATA[nanode]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=59</guid>
		<description><![CDATA[Maker Faire came to Brighton! Spent a very happy hour marvelling at all the amazing things people had made. Awesome Loads more pics and videos here: makerfairebrighton.tumblr.com]]></description>
			<content:encoded><![CDATA[<p><a href="http://makerfaire.com/" title="Maker Faire">Maker Faire</a> came to <a href="http://www.makerfairebrighton.com/" title="Maker Faire: Brighton">Brighton</a>!</p>
<p>Spent a very happy hour marvelling at all the amazing things people had made. Awesome <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0493/' title='Self-balancing skateboard'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0493-150x150.jpg" class="attachment-thumbnail" alt="Somewhere between a Segway and a skateboard" title="Self-balancing skateboard" /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0492/' title='3D Printer'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0492-150x150.jpg" class="attachment-thumbnail" alt="One of a number of RepRap 3D printers in attendance" title="3D Printer" /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0490/' title='Kinect Sculpting'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0490-150x150.jpg" class="attachment-thumbnail" alt="A Kinect that you could sculpt virtual 3D things with (before making them real with a 3D printer)" title="Kinect Sculpting" /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0489/' title='Robot Drummer'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0489-150x150.jpg" class="attachment-thumbnail" alt="Apparently this dude had a gig in Brighton after the faire" title="Robot Drummer" /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0494/' title='Project-A-Sketch'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0494-150x150.jpg" class="attachment-thumbnail" alt="Project-A-Sketch: it even had giant white knobs to draw with" title="Project-A-Sketch" /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0497/' title='Nanode in progress...'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0497-150x150.jpg" class="attachment-thumbnail" alt="Of course, I had to buy myself a toy :)" title="Nanode in progress..." /></a>
<a href='http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/img_0500/' title='Finished Nanode'><img width="150" height="150" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/09/IMG_0500-150x150.jpg" class="attachment-thumbnail" alt="A couple of hours of soldering and it&#039;s ready to rock" title="Finished Nanode" /></a>

<p>Loads more pics and videos here: <a href="http://makerfairebrighton.tumblr.com/">makerfairebrighton.tumblr.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/09/brighton-mini-maker-faire/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>more procedural cities</title>
		<link>http://alexmole.co.uk/2011/08/more-procedural-cities/</link>
		<comments>http://alexmole.co.uk/2011/08/more-procedural-cities/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 15:11:28 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[cinder]]></category>
		<category><![CDATA[city]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=55</guid>
		<description><![CDATA[(continued from here) I&#8217;ve been tweaking the secondary road generation (adding things like crossroads), and now I&#8217;ve got cities that look like this: Next up: start looking at tertiary roads and building generation. I&#8217;d love to start having curved roads &#8230; <a href="http://alexmole.co.uk/2011/08/more-procedural-cities/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>(continued from <a href="http://alexmole.co.uk/2011/08/playing-with-procedural-cities/" title="playing with procedural cities">here</a>)</p>
<p>I&#8217;ve been tweaking the secondary road generation (adding things like crossroads), and now I&#8217;ve got cities that look like this:<br />
<a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-29-at-16.02.22.png"><img src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-29-at-16.02.22.png" alt="" title="plots" width="1104" height="870" class="aligncenter size-full wp-image-56" /></a></p>
<p>Next up: start looking at tertiary roads and building generation.</p>
<p>I&#8217;d love to start having curved roads and rivers in there too, but they&#8217;ll have to wait!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/08/more-procedural-cities/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>was the weather this summer really that lame?</title>
		<link>http://alexmole.co.uk/2011/08/was-the-weather-this-summer-really-that-lame/</link>
		<comments>http://alexmole.co.uk/2011/08/was-the-weather-this-summer-really-that-lame/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 09:56:47 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=40</guid>
		<description><![CDATA[The weather in London this summer seems to have been spectacular in its mediocrity. After an exciting looking start with a really warm May, it turned cold and damp and seems to have stayed that way. I felt cheated. But! &#8230; <a href="http://alexmole.co.uk/2011/08/was-the-weather-this-summer-really-that-lame/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The weather in London this summer seems to have been spectacular in its mediocrity. After an exciting looking start with a really warm May, it turned cold and damp and seems to have stayed that way.</p>
<p>I felt cheated.</p>
<p>But! How bad was this summer in comparison to history? I couldn&#8217;t find out anything on the internets to tell me, but I did find <a title="http://tutiempo.net" href="http://tutiempo.net">tutiempo.net</a> which seemed to have loads of historical weather data. So I cracked out <a title="Beautiful Soup" href="http://www.crummy.com/software/BeautifulSoup/" target="_blank">Beautiful Soup</a> and made me a scraper: <a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/climatescraper.py">climatescraper.py</a></p>
<p>The way I have it set up, it downloads all the weather data for London Heathrow from 1949 to now (excluding the years around the 60s as they all seem to be missing). It then saves the data to a little <a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/heathrow.dat">&#8220;database&#8221;</a> (alright, it&#8217;s just a pickled python dictionary, but that&#8217;s because pickling is <em>so easy</em>!)</p>
<p>Now I have all this data, I can render it. For instance, here&#8217;s the average daily temperature for each day (this image brought to you by <a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/render.py">render.py</a>):<br />
<a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/heathrow.png"><img class="aligncenter size-full wp-image-46" title="heathrow" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/heathrow.png" alt="" width="730" height="94" /></a></p>
<p>As you can see, we haven&#8217;t been stiffed. The weather in London is just stunningly mediocre.</p>
<p>If you want to try this for another location, download these scripts and customise the sections at the top for your chosen location. You&#8217;ll probably want to tweak which years it downloads as well or you&#8217;ll end up with lots of unknown data&#8230; You&#8217;ll need <a title="Beautiful Soup" href="http://www.crummy.com/software/BeautifulSoup/" target="_blank">Beautiful Soup</a> for the scraper and <a title="Python Imaging Library" href="http://www.pythonware.com/products/pil/" target="_blank">the Python Imaging Library</a> to render the images.</p>
<ul>
<li><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/climatescraper.py">climatescraper.py</a></li>
<li><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/render.py">render.py</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/08/was-the-weather-this-summer-really-that-lame/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>playing with procedural cities</title>
		<link>http://alexmole.co.uk/2011/08/playing-with-procedural-cities/</link>
		<comments>http://alexmole.co.uk/2011/08/playing-with-procedural-cities/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 22:16:57 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[cinder]]></category>
		<category><![CDATA[city]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/?p=23</guid>
		<description><![CDATA[Procedural worlds are awesome. I started playing with Processing and making some! Unfortunately, Processing is based on Java which doesn&#8217;t have operator overloading. Ordinarily I&#8217;d be fine with that, but this is gonna get mathsy, so I switched to Cinder, which is C++. After &#8230; <a href="http://alexmole.co.uk/2011/08/playing-with-procedural-cities/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Procedural worlds are awesome. I started playing with <a href="http://processing.org/">Processing</a> and making some!</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/processing.png"><img class="alignnone size-full wp-image-25" title="processing" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/processing.png" alt="" width="552" height="308" /></a></p>
<p>Unfortunately, Processing is based on Java which doesn&#8217;t have operator overloading. Ordinarily I&#8217;d be fine with that, but this is gonna get mathsy, so I switched to <a href="http://libcinder.org/">Cinder</a>, which is C++. After a mercifully swift porting effort, we were back up:</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/cinder.png"><img class="alignnone size-full wp-image-24" title="cinder" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/cinder.png" alt="" width="552" height="435" /></a></p>
<p>It&#8217;s a promising start, but it&#8217;s way too rectilinear. I&#8217;m going to have to back up and look at generating a road network before anything&#8217;s going to look much better. After playing a bit, I found that a random Voronoi diagram seems to give me a nice starting point for the major zoning of a city:</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/zoning.png"><img class="alignnone size-full wp-image-27" title="zoning" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/zoning.png" alt="" width="552" height="435" /></a></p>
<p>Going beyond a voronoi diagram seems pretty gnarly though <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I started collecting some reference: <a href="http://byjingo.tumblr.com/">byjingo.tumblr.com</a>. Now I have some ideas on what might work, I started playing:</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/roads.png"><img class="alignnone size-full wp-image-26" title="roads" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/roads.png" alt="" width="552" height="435" /></a></p>
<p>There&#8217;s clearly still a lot of work to be done!</p>
<p>To be continued&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/08/playing-with-procedural-cities/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>digital clock</title>
		<link>http://alexmole.co.uk/2011/08/digital-clock/</link>
		<comments>http://alexmole.co.uk/2011/08/digital-clock/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 20:26:22 +0000</pubDate>
		<dc:creator>molen</dc:creator>
				<category><![CDATA[making]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[attiny]]></category>
		<category><![CDATA[clock]]></category>

		<guid isPermaLink="false">http://alexmole.co.uk/blog/?p=9</guid>
		<description><![CDATA[I saw this cool clock by Jonas Damon in magma: However, I didn&#8217;t like that the digits had wires between them. This is the 21st century etc. So I set out to make my own version where each digit was &#8230; <a href="http://alexmole.co.uk/2011/08/digital-clock/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I saw this cool clock by <a href="http://www.designpublic.com/shop/jonas-damon/8664" target="_blank">Jonas Damon</a> in <a href="http://www.magmabooks.com/" target="_blank">magma</a>:</p>
<p><a href="http://www.designpublic.com/shop/jonas-damon/8664"><img class="alignnone size-full wp-image-11" title="jonasdamon" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/jonasdamon.png" alt="" width="535" height="194" /></a></p>
<p>However, I didn&#8217;t like that the digits had wires between them. This is the 21st century etc. So I set out to make my own version where each digit was completely independent.</p>
<p>Cracking out the trusty <a href="http://arduino.cc/">Arduino</a>, I soon had a single digit&#8230;</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/onedigit.jpg"><img class="alignnone size-full wp-image-14" title="onedigit" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/onedigit.jpg" alt="" width="552" height="609" /></a></p>
<p>While I could have carried on and purchased another 3 Arduini, that would have been a bit flash, and these digits needed to be battery powered (or the no wires thing wouldn&#8217;t work). After some digging, I plumped for using the ATtiny2313V as they&#8217;re nice and low voltage (and crucially cheap). Using the Arduino to flash the firmware onto the new chip, I soon had my first independent digit!</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/oneattiny.jpg"><img class="alignnone size-full wp-image-13" title="oneattiny" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/oneattiny.jpg" alt="" width="552" height="575" /></a></p>
<p>Things got a bit Matrix and it went into replication&#8230;</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/manyattiny.jpg"><img class="alignnone size-full wp-image-12" title="manyattiny" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/manyattiny.jpg" alt="" width="552" height="411" /></a></p>
<p>Then I used some super-expensive circuit layout software to plan the schematic (I built it on <a href="http://www.maplin.co.uk/tripad-board-1922">Tri-Pad board</a>, hence the groups of 3 connected holes). I also ventured into the realms of sticking stuff on the back of the board for the first time &#8211; that&#8217;s what the bits in red are.</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/schematic.jpg"><img class="alignnone size-full wp-image-15" title="schematic" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/schematic.jpg" alt="" width="552" height="954" /></a></p>
<p>With that, it was all done bar <em>days</em> of soldering and manufacturing.</p>
<p><a href="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/built.jpg"><img class="alignnone size-full wp-image-10" title="built" src="http://alexmole.co.uk/blog/wp-content/uploads/2011/08/built.jpg" alt="" width="552" height="270" /></a></p>
<p>The <strong>8</strong> rechargeable, Lithium Ion batteries (costing as much as the entire rest of the build) last about 2 months. It&#8217;s well worth the hassle of 6 recharges per year <img src='http://alexmole.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The firmware is available here: <a href='http://alexmole.co.uk/blog/wp-content/uploads/2011/08/avr-clock.c'>avr-clock.c</a> and <a href='http://alexmole.co.uk/blog/wp-content/uploads/2011/08/Makefile.txt'>Makefile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexmole.co.uk/2011/08/digital-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
