<?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>Spice World! &#187; Electronics</title>
	<atom:link href="http://www.cyberspice.org.uk/blog/category/geek/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberspice.org.uk/blog</link>
	<description>The life and times of a jet setting software engineer!</description>
	<lastBuildDate>Fri, 02 Dec 2011 14:52:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>The BBC Model B Microcomputer keyboard &#8211; How it works</title>
		<link>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/</link>
		<comments>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 19:06:14 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BBC Micro PC]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=485</guid>
		<description><![CDATA[As part of my BBC Micro PC project (more about this later) I need to turn the keyboard in a BBC Micro in to a USB hid device. I could just rip the insides out of a PC USB keyboard and solder wires on to the back off all the key switches but that seems [...]]]></description>
			<content:encoded><![CDATA[<p>As part of my BBC Micro PC project (more about this later) I need to turn the keyboard in a BBC Micro in to a USB hid device. I could just rip the insides out of a PC USB keyboard and solder wires on to the back off all the key switches but that seems somewhat messy. So I decided to design a micro-controller circuit to read the keyboard and to appear as a standard USB HID device. The neatest solution is to have the micro-controller drivng the keyboard circuitry the same was as the BBC Micro main board does. This post explains how the keyboard circuit works.<span id="more-485"></span>The BBC Model B keyboard circuit board is more than just a grid of key-switches. It comprises some circuitry to reduce the number of connections between it and the main circuit board to 8 lines and to generate interrupts on key presses. Its a very neat design. Below is the keyboard circuit diagram taken from the BBC Model B service manual. The diagram also includes a bit of circuitry for the speech ROM expansion which I will ignore.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5660684665" title="View 'BBC Model B Keyboard Circuit' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="337" src="http://farm6.static.flickr.com/5188/5660684665_b5af5c664b.jpg" alt="BBC Model B Keyboard Circuit" width="500" title="BBC Model B Keyboard Circuit"/></a><br />
<center><br />
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th>IC1</th>
<td>74xx161/163</td>
<td>Synchronous 4 bit binary counter</td>
</tr>
<tr>
<th>IC2</th>
<td>74xx45</td>
<td>BCD to decimal decoder</td>
</tr>
<tr>
<th>IC3</th>
<td>74xx251</td>
<td>3 state 1 of 8 line data selector</td>
</tr>
<tr>
<th>IC4</th>
<td>74xx30</td>
<td>Octal NAND gate</td>
</tr>
</table>
<p></center></p>
<p>At the core is the traditional key matrix. It is a grid of rows and columns with momentary push switches that connect a row to a column when pressed. All of the rows are tied high by resistors to the 5v supply rail. The rows are inputs to an octal NAND gate (IC4), which, in this case is better thought of as an OR gate with inverting inputs. I.e. but default the output of the NAND gate is low but if one of the rows is pulled low the NAND output goes high. The rows are also inputs in to the line data selector (IC2).</p>
<p>The synchronous 4 bit binary counter (IC1) is driven by the BBC Micro&#8217;s 1MHz clock and when the KB EN is high is in free running mode. The 4 bit outputs (outputs QA-QD) are decoded by the BCD to decimal decoder (IC3) such that the decoder&#8217;s outputs go low in turn. The outputs of the decoder form the columns of the grid. I.e. column 0 is low on the first clock pulse, column 1 on the second and so on. If a key is pressed the row the key is on will go low when the column goes low.  This in turn makes the output of the NAND gate go high indicating a key is pressed. The output of the NAND gate is used to generate an interrupt in the BBC Micro&#8217;s CPU.</p>
<p>So normally the keyboard is being scanned by the hardware without any software influence.  This is a good thing as it takes a lot of loading off of the BBC Micro&#8217;s CPU.  When the key press interrupt is triggered the key scanning software takes over. As I said normally the 4 bit binary counter (IC1) is free running however if the LOAD pin (pin 9) is taken low the 4 bit input value (inputs A-D) are latched through to the outputs (QA-QD) and hence control the columns provided by the decoder (IC3). IC1&#8242;s load pin is connected to KB EN.</p>
<p>The S line of the data line selector (IC2) is the select line and is also connected to KB EN. The output of IC2 is 3 state meaning it either reflects the appropriate data input line when select is low or is high impedance. The data input lines are the row lines of the keyboard matrix. The input line is chosen using the three bit &#8216;address&#8217; value on A-C. The row state is output via pin W. </p>
<p>So the keyboard is normally hardware scanning. If the user presses a key, the interrupt is triggered. The CPU enables the keyboard by setting KB EN low and then manually scans the key board by setting the columns in turn via IC1 and checking the state of the rows in turn via IC2.  Once the scan is complete KB EN is set high and the hardware scanning continues.</p>
<p>There are three keys on the keyboard which are exceptions. The two SHIFT and CTRL keys are on a row that does not trigger an interrupt. This means that shift is only scanned manually or when another key is pressed.  The BREAK key (labled RST) is completely separate from the matrix and triggers the CPU&#8217;s reset line. On boot the CPU scans the keyboard manually to see if any of the modifiers are held down to do a cold reset or mount the disk for example.</p>
<p>The BBC Micro keyboard can be easily interfaced with say an ATMEL ATMega328 (like in an Arduino).  The micro-controller can drive a pin directly from one of the timers generating a square wave output to scan the keyboard. The interrupt can be connected to one of interrupt inputs and the rest connected to general purpose IO pins set as outputs or inputs as appropriate.  Dick Streefland&#8217;s <a href="http://www.xs4all.nl/%7Edicks/avr/usbtiny/">USBtiny</a> code provides the functionality to support the USB protocol in software utilising three IO pins on the micro-controller and a few discrete components. All that is required by me is to write the keyboard scanning code and provide the missing bits of the HID device profile.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading your UK T-Mobile Google G1 (HTC Dream) to Android 2.x</title>
		<link>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 15:33:22 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Google G1]]></category>
		<category><![CDATA[HTC Dream]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=480</guid>
		<description><![CDATA[I&#8217;m currently developing a new project. Its a bluetooth enabled bracelet. I wanted to write an iPhone app to control it. However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks. So I then looked at writing an Android application for my G1. The problem with that is that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently developing a new project.  Its a bluetooth enabled bracelet.  I wanted to write an iPhone app to control it.  However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks.  So I then looked at writing an Android application for my G1.  The problem with that is that bluetooth support only arrived in Android 2.0 and T-Mobile/HTC ceased upgrades at 1.6 on the G1.  Since my G1 is two years old and out of contract I decided to be brave and upgrade it to Android 2.2.  Note the G1 is called the HTC Dream in many markets.</p>
<p><span id="more-480"></span><br />
<h2>Overview</h2>
<p>In order to install kind of new operating system I needed to have root access on the device.  This meant I had to <em>root</em> it.  Since Android 1.6 (Release R10) on the G1 doesn&#8217;t have any useful exploits I had to downgrade the OS to Release R7 first.  Once it is downgraded it you can use the rooting exploit in R7 to get root access and install a recovery image that will allow the installation of an updated radio software and the new operating system.</p>
<h2>Preliminaries</h2>
<p>Firstly read all of this blog post and all of the pages linked to from this blog post.  There is at least one point in this process where you can &#8220;brick your phone&#8221;.  I.e. you can put it in a state where by a regular user cannot make it usable.</p>
<p>Secondly you will be wiping your phone and replacing the software on it.  Back anything up you want to keep.  This includes purchased applications, data, contacts, whatever.</p>
<p>Make sure the phone is fully charged.  You don&#8217;t want it running out of power mid-flash!</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<h2>Downgrading and rooting</h2>
<p>Downgrading, rooting the phone, and installing a recovery image is described in the link below.  However since there are specific requirements for upgrading to Android 2.X I&#8217;ll explain each stage here.</p>
<p><a href="http://forum.xda-developers.com/showthread.php?t=442480">http://forum.xda-developers.com/showthread.php?t=442480</a></p>
<h3>Downgrading</h3>
<p>Before you do anything take note of the radio version string in the boot-loader.  Its the fourth line down.  You get the boot-loader screen up by holding down the camera button when powering on the phone.  With the original loader you should have multi-coloured bars with yellow text in the top left hand corner.  On my phone the radio version string read <em>&#8220;RADIO-2.22.19.26I&#8221;</em>.  Write down the string and store it somewhere safe.  You&#8217;ll need it later.</p>
<p>Now download the appropriate older image for your phone.  The links to the image downloads are on the page above however here&#8217;s the link for <a href="http://koushikdutta.blurryfox.com/G1/DREAMIMG-RC7.zip">RC7</a> for those with UK phones.  Download the image, unzip it, and save the <em>DREAMIMG.nbh</em> file in the root of your SD card.  While you&#8217;re at it also download <a href="http://www.androidspin.com/downloads.php?dir=amon_ra/RECOVERY/&#038;file=recovery-RA-dream-v1.5.2.img">recovery-RA-dream-v1.5.2.img</a> which is a recovery image and will be used later.  Save this in the root of your SD card also.</p>
<p>Turn off your phone, insert the SD card, and turn it back on again holding down the camera key as before.  It should now re-flash your phone.  There should be a progress bar.  When its all complete you can restart your phone normally (without the camera key held down).  This will result in some old school Android graphics and you wondering how anyone ever coped with that software.  Once the phone has booted find the phone details in settings and check the software build version number.  It should appear as something like <em>TC5-RC7 112931</em>.</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135008" title="View 'Initial bootloader' on Flickr.com"><img height="240" alt="Initial bootloader" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4113/5075135008_1492d33db5_m.jpg" width="162"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074536617" title="View 'Installing an image from SD card' on Flickr.com"><img height="240" alt="Installing an image from SD card" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4012/5074536617_0f606f44e1_m.jpg" width="172"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135512" title="View 'Software information screen' on Flickr.com"><img height="240" alt="Software information screen" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4111/5075135512_f439d0d7e8_m.jpg" width="168"/></a></td>
</tr>
</table>
<p></center></p>
<h3>Rooting the phone</h3>
<p>Now you have exploitable image installed it is time to root the phone.  This can be done using a back door.  Go to the home screen then type&#8230;</p>
<pre>
&lt;return&gt;
&lt;return&gt;
telnetd
&lt;return&gt;
</pre>
<p>&#8230;on the slide out keyboard.  This will look like a search in contacts for the name of <em>telnetd</em>.  In fact <em>telnetd</em> is the telnet daemon which allows you to connect to shell on the phone via telnet.  So now you need a telnet client.  Use the Android Market to download a telnet client.  Once installed you should be able to telnet to <em>localhost</em> and get a telnet prompt.</p>
<p>If all is well you have shell access as root (a &#8216;#&#8217; prompt).  Yay!</p>
<h3>Installing a recovery image</h3>
<p>Now we are going to install the recovery image we downloaded earlier. This will also give us permanent root access.  In the shell type&#8230;</p>
<pre>
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd sdcard
flash_image recovery recovery-RA-dream-v1.5.2.img
cat recovery-RA-dream-v1.5.2.img > /system/recovery.img
</pre>
<p>For those who are interested the lines do the following:</p>
<ol>
<li>Remounts the flash memory in read/write mode.  This allows you to save to the flash in the phone.</li>
<li>Navigate to the sdcard (which is mounted at /sdcard)</li>
<li>Flashes the recovery-RA-dream-v1.5.2.img image file in to the special recovery partition in the flash.</li>
<li>Copies the recovery-RA-dream-v1.5.2.img as /system/recovery.img (The Android busybox doesn&#8217;t have the copy command but cat with a pipe works just as well!).</li>
</ol>
<p>Once you&#8217;ve done this and have a prompt again you can reboot the phone.  This time if you hold down the home and power buttons when you power on the phone it will boot in to the recovery image.  You can use the short cuts or the track ball to select a menu item.</p>
<p>Now we are ready to install the new software.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537061" title="View 'Custom recovery image menu' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Custom recovery image menu" border="0" src="http://farm5.static.flickr.com/4071/5074537061_048eed984f_m.jpg" width="166"/></a></p>
<h2>New radio software and DangerSPL</h2>
<p>Now we have to repartition the flash to give enough room for the new platform.  This is the scary bit.  As I said before&#8230;</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<p>Read this page thoroughly <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL">http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL</a>.  If you&#8217;ve gotten this far you fulfil the prerequisites to install Danger/SPL.  You now need to download the appropriate radio image, place it in the root of your SD card and flash it.  Remember that number we noted down from the boot-loader screen at the start (<em>&#8220;RADIO-2.22.19.26I&#8221;</em> or similar).  You will need it now.</p>
<p>Boot in to recovery by holding down the home and power buttons. Select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Select <em>update.zip</em> (if that&#8217;s the name of the file) from the file menu.  The image should be flashed and will then reboot the phone.  Reboot the phone again.</p>
<p>Take out the SD card and boot back in to the boot loader.  It should now appear as below.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537429" title="View 'Updated Google G1 bootloader' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Updated Google G1 bootloader" border="0" src="http://farm5.static.flickr.com/4043/5074537429_0bebc5256a_m.jpg" width="179"/></a></p>
<h2>Upgrading to FROYO and installing Google Apps</h2>
<p>All the hard work is now done.  You have a rooted phone with a nice recovery menu which allows you to flash anything that will fit.</p>
<p>To install the latest Android read this link: <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B">http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B</a>.</p>
<p>Clear out your SD card and download <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#DreamCM6">Froyo for the G1/Dream</a> and the <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#Google_Apps">Google <strong>Tiny</strong> Apps</a> (The G1 is a bit short on flash space so wont fit the all singing all dancing versions of the Google apps).  Boot in to recovery as before (home and power buttons) and again select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Flash first Froyo and then the apps.</p>
<p>Finally reboot your phone.  You should now have Android 2.2 installed!</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074537651" title="View 'Cyanogen's Froyo (Android 2.2) booting' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) booting" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4068/5074537651_fd8dc6e0e7_m.jpg" width="179"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075136748" title="View 'Cyanogen's Froyo (Android 2.2) home screen.' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) home screen." border="0" style="display: inline;" src="http://farm5.static.flickr.com/4089/5075136748_9bb89e6b2c_m.jpg" width="179"/></a></td>
</tr>
</table>
<p></center></p>
<h2>Issues</h2>
<p>The only issue I had was an exception from the keyboard software the first time I used Froyo.  This can be solved using the <em>&#8220;Wipe&#8221;</em> menu in the recovery image.  I wiped data, cache and delvik cache (The latter generated an error I ignored) and then re-installed Froyo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing http://projects.cyberspice.org.uk/</title>
		<link>http://www.cyberspice.org.uk/blog/2010/09/29/announcing-httpprojects-cyberspice-org-uk/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/09/29/announcing-httpprojects-cyberspice-org-uk/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 14:03:23 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Acorn]]></category>
		<category><![CDATA[BBC Micro]]></category>
		<category><![CDATA[BBC Microcomputer]]></category>
		<category><![CDATA[Beebthernet]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=478</guid>
		<description><![CDATA[I am pleased to say that I have finally gotten around to starting to publish details of the hardware projects I have been working on. I have created a new site http://projects.cyberspice.org.uk/ which contains all the details of these projects. Over the next few days I will be updating it with the details of Beebthernet, [...]]]></description>
			<content:encoded><![CDATA[<p>I am pleased to say that I have finally gotten around to starting to publish details of the hardware projects I have been working on.  </p>
<p>I have created a new site <a href="http://projects.cyberspice.org.uk/">http://projects.cyberspice.org.uk/</a> which contains all the details of these projects.  Over the next few days I will be updating it with the details of Beebthernet, my programmable earrings and so on.  Each of the projects will be described in detail and links to software and schematic downloads provided.</p>
<p>The first documented project is my ethernet for a BBC Microcomputer project known as <a href="http://projects.cyberspice.org.uk/beebthernet/">Beebthernet</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/09/29/announcing-httpprojects-cyberspice-org-uk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maker Faire UK 2010</title>
		<link>http://www.cyberspice.org.uk/blog/2010/04/22/maker-faire-uk-2010/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/04/22/maker-faire-uk-2010/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 01:14:33 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Crafty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Beads]]></category>
		<category><![CDATA[Knitting]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Maker]]></category>
		<category><![CDATA[Makerfaire]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=438</guid>
		<description><![CDATA[So in the middle of March I was panicking about whether I would get everything ready in time for Maker Faire UK. Like last year Maker Faire UK was held at the Life Science&#8217;s Centre in Newcastle-upon-Tyne as part of the Science Week there. Unlike last year, this year I had been accepted as an [...]]]></description>
			<content:encoded><![CDATA[<p>So in the middle of March I was panicking about whether I would get everything ready in time for Maker Faire UK.  Like last year Maker Faire UK was held at the Life Science&#8217;s Centre in Newcastle-upon-Tyne as part of the Science Week there.  Unlike last year, this year I had been accepted as an exhibitor and was going to display a variety of projects, so I took the Friday as vacation for final preparation and I needed it.<span id="more-438"></span></p>
<hr />
The theme of my exhibit was the mix of tech and craft.  Basically it was a collection of projects I had been working on and thought were good enough to display.</p>
<table>
<tr>
<td>
<h2>&#8216;Programmable&#8217; Earrings</h2>
<p><span style="float: left; margin-top: 10px; margin-right: 10px; margin-bottom: 10px;"><a href="http://www.flickr.com/photos/39013214@N03/4406446524" title="View 'Programmable earrings' on Flickr.com"><img border="0" width="240" align="right" alt="Programmable earrings" src="http://farm5.static.flickr.com/4022/4406446524_0813f246dc_m.jpg" height="160"/></a></span></p>
<p>Recently I started doing bead work, making necklaces and earrings and so on.  One day when doing some electronics I realised that components would make awesome earrings.  I then thought if you&#8217;re using components why not make them actually do something.  So I prototyped up a design based around an ATTiny part that I thought would work and thought about scaling the design down to something that could actually be worn on the ears.</p>
<p>This turned out to be a bit of a learning curve.  The only way I could do it was to resort to surface mount.  Something I had never done before.  Also I needed to product the PCBs professionally for the project to have any chance of working.  Also something I had never done before.  So this required me to learn to use a PCB CAD package.  Yet more learning curve.  And to add to the pressure because of the turn-round time on the PCBs I had one chance to get it right.  I waited with baited breath for them to return from <a href="http://www.olimex.com/pcb/index.html">Olimex</a>.</p>
<p>There were two issues with the board.  The holes for the LED leads were too narrow.  I fixed that with a pillar drill.  Also the outline for the battery (which is mounted on the bottom of the board) was printed on the top of the board.  That was my mistake since I created the batter holder component in the CAD package.  I fixed that with judicious use of a craft knife to scrape away the print.  I soldered everything up, programmed the micro-controller, and they worked.</p>
<p>They are light and wearable.  The software carries out PWM on three RGB channels varying the colour of the LED.  The colour pattern and speed of flashing changes with light level.  The size is limited by the clearance of the LED and LDR leads and the battery.  They were very popular and I may have to make more due to interest.</p>
</td>
</tr>
<tr>
<td>
<h2>Knitted Cthulhu</h2>
<p><span style="float: right; margin-top: 10px; margin-left: 10px; margin-bottom: 10px;"><a href="http://www.flickr.com/photos/39013214@N03/4403933882" title="View 'Cthulhu' on Flickr.com"><img border="0" width="240" alt="Cthulhu" src="http://farm5.static.flickr.com/4034/4403933882_f3f37fbf86_m.jpg" height="160"/></a></span></p>
<p>This was a fun little project.  I found a pattern for a knitted Cthulhu on the web.  Unfortunately I&#8217;ve mislaid the link right now but I do want to acknowledge the author so when I&#8217;ve found it I will update this post.  The knit was fun in itself and included knitting in the round, adding and removing stitches, and i-cord. </p>
<p>However because I am me I wanted to stuff electronics in to it.  So rather than using beads for eyes I used LEDs.  I built a small circuit on strip board based around the ATTiny part which drove the two LEDs and used a mechanical tilt switch as an input.  Additional output was via a piezo-electric sounder.  The tilt switch was mounted upside down so that it was normally off.  However shaking the cthulhu would activate it.</p>
<p>A software algorithm carried out key de-bounce and counts the number of &#8216;shakes&#8217; within a set time and drives a state machine that flashes the eyes and makes noises dependent upon the speed of the shaking.  The children loved my cthulhu.</p>
</td>
</tr>
<tr>
<td>
<h2>Beebthernet</h2>
<p><span style="float: left; margin-top: 10px; margin-right: 10px; margin-bottom: 10px;"><a href="http://www.flickr.com/photos/39013214@N03/4403934984" title="View 'Beebthernet' on Flickr.com"><img border="0" width="240" align="right" alt="Beebthernet" src="http://farm5.static.flickr.com/4042/4403934984_3221138977_m.jpg" height="160"/></a></span></p>
<p>A while I go i wrote a blog post about my <a href="http://www.cyberspice.org.uk/blog/2009/09/03/beebthernet/">Beebthernet</a> project.  Well since I was getting PCBs made anyway I thought I&#8217;d use the space space available to get a PCB for the parallel port/SPI version of the Beebthernet circuit.</p>
<p>I was hoping to have written a twitter client in time for Makefaire but all I&#8217;d gotten was basic sockets working.  However having a stand with a BBC Microcomputer connected to a flat screen monitor and a network was interesting to many people who attended the fair.  In many cases parents would tell their children how the BBC micro was the computer they used at school.</p>
</td>
</tr>
<tr>
<td>
<h2>Temperature Sensing Hat</h2>
<p><span style="float: right; margin-top: 10px; margin-left: 10px; margin-bottom: 10px;"><a href="http://www.flickr.com/photos/39013214@N03/4405682295" title="View 'Work in progress - Temperature sensing hat' on Flickr.com"><img border="0" width="240" align="left" alt="Work in progress - Temperature sensing hat" src="http://farm3.static.flickr.com/2712/4405682295_cfa4df6fa4_m.jpg" height="160"/></a></span></p>
<p>This project turned out to be a work in progress so I took it anyway together with some tools in order to continue to work on the electronics.  The hat itself is based upon a design in <a href="http://www.amazon.com/Stitch-N-Bitch-Knitters-Handbook/dp/0761128182">Stitch &#8216;N Bitch</a> which is an excellent book.  It is the sequinned hat but without sequins however unlike the hat in the book mine has a long i-cord &#8216;tail&#8217; from the top of the hat than hangs down the back.  The tail houses a temperature sensor in the end. </p>
<p>The rest of the hat is intended to be covered in small LED beads but they were not finished for Makerfaire.  The beads are an idea from <a href="http://thehighlowtech.com/projects/LED_clothing/tank.html">Leah Buechley</a> and are constructed from a surface mount LED and two beading crimp rings solder to each terminal.  I chose gold and silver rings so that I could tell the polarity.  They are awfully small and fiddly to make.</p>
</td>
</tr>
</table>
<hr />
<div  style="display:block">
My exhibits seemed to go down well with the public.  I ended up being <a href="http://www.flickr.com/photos/37996583811@N01/4444428820/in/photostream/">interviewed by the BBC</a> for their <a href="http://www.bbc.co.uk/blogs/podsandblogs/">Pods and Blogs</a> show on Radio 5 Live.  And then I was filmed by the reporter&#8217;s colleague for a YouTube project.</p>
<p><center><object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/d9gRklnJqjE&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;color1=0x402061&#038;color2=0x9461ca&#038;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/d9gRklnJqjE&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;color1=0x402061&#038;color2=0x9461ca&#038;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object></center></p>
<p>I have to admit I don&#8217;t look my best since I was stressed and this was early on the Saturday not long after the faire opened and I hod gotten up early that morning to drive up to the event and set up my things.</p>
<p>The faire was very enjoyable and it would be great to be back there again next year.  Hopefully I would be more organised this time.  There were people I knew there but many more I didn&#8217;t and I made some new friends among the exhibitors.  I would like to thank Molly and Kat who were my support team and who took over talking to the public when I needed a break, food, etc.  I did get a chance to look around the faire and I have to admit the stars of the show were the musical tesla coils they were both awesome and loud!</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/39013214@N03/4435866764" title="View 'Musical Tesla Coils' on Flickr.com"><img border="0" width="500" alt="Musical Tesla Coils" src="http://farm5.static.flickr.com/4040/4435866764_82030f986e.jpg" height="333"/></a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/04/22/maker-faire-uk-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manchester Geek Girl Afternoon Tea</title>
		<link>http://www.cyberspice.org.uk/blog/2010/01/11/manchester-geek-girl-afternoon-tea/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/01/11/manchester-geek-girl-afternoon-tea/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 17:24:41 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Women In Technology]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[mggd]]></category>
		<category><![CDATA[mggt]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=418</guid>
		<description><![CDATA[While I&#8217;m announcing appearances I am excited to announce that I am presenting an Arduino workshop at Manchester Geek Girl Afternoon Tea this month at Madlab, Manchester&#8217;s Hackspace in the Northern Quarter. I will be bringing a long several Arduino-a-likes together with a variety of components and CDs of the IDE so that we can [...]]]></description>
			<content:encoded><![CDATA[<p>While I&#8217;m announcing appearances I am excited to announce that I am presenting an <a href="http://www.arduino.cc/">Arduino</a> workshop at <a href="http://girlgeektea.eventbrite.com/">Manchester Geek Girl Afternoon Tea</a> this month at <a href="http://madlab.org.uk/content/girl-geek-afternoon-tea-2/">Madlab</a>, Manchester&#8217;s Hackspace in the Northern Quarter.</p>
<p>I will be bringing a long several Arduino-a-likes together with a variety of components and CDs of the IDE so that we can get together in groups, code and play.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/01/11/manchester-geek-girl-afternoon-tea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Newcastle Maker Faire 2010</title>
		<link>http://www.cyberspice.org.uk/blog/2010/01/11/newcastle-maker-faire-2010/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/01/11/newcastle-maker-faire-2010/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 17:08:44 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Crafty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Makerfaire]]></category>
		<category><![CDATA[Newcastle]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=416</guid>
		<description><![CDATA[I am delighted to announce that I have been selected to exhibit at Newcastle Maker Faire. The theme of my display will be crafty geekery. I am intending to take along items which are a mix of traditional crafts such as knitting and jewellery making combined with tech. For example programmable earrings, a temperature sensing [...]]]></description>
			<content:encoded><![CDATA[<p>I am delighted to announce that I have been selected to exhibit at <a href="http://www.makerfaire.com/newcastle/2010/">Newcastle Maker Faire</a>.  The theme of my display will be crafty geekery.  </p>
<p>I am intending to take along items which are a mix of traditional crafts such as knitting and jewellery making combined with tech.  For example programmable earrings, a temperature sensing hat and a bag that has a proximity detector and RFID tag so it can detect its owner.  </p>
<p>I am also going to show off a couple of my other projects like an ethernet adapter for a BBC microcomputer and a &#8220;Mood Wall&#8221; (It analyses twitter tweets for the mood of the content displaying patterns and colours which reflect the prevailing mood).</p>
<p>Hopefully I will see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/01/11/newcastle-maker-faire-2010/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Boarduino vivarium temperature monitor</title>
		<link>http://www.cyberspice.org.uk/blog/2009/10/29/boarduino-vivarium-temperature-monitor/</link>
		<comments>http://www.cyberspice.org.uk/blog/2009/10/29/boarduino-vivarium-temperature-monitor/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 14:56:01 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[BoArduino]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=336</guid>
		<description><![CDATA[I like snakes. This weekend I will be collecting my new snake, he&#8217;s a baby Royal Python. I have been worried about the temperature in the vivarium I will be housing him so I built an ethernet enabled monitoring device to do a science!]]></description>
			<content:encoded><![CDATA[<p>I like snakes.  This weekend I will be collecting my new snake, he&#8217;s a baby Royal Python.  I have been worried about the temperature in the vivarium I will be housing him so I built an ethernet enabled monitoring device to do a science!</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/4053539738" title="View 'Vivarium Temperature Monitor' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2501/4053539738_31c7203c09.jpg" alt="Vivarium Temperature Monitor" border="0" width="500@ height="333" /></div>
<p></a></p>
<p><span id="more-336"></span><br />
Its a <a href="http://www.ladyada.net/make/boarduino/">BoArduino</a>, an <a href="http://www.oomlout.co.uk/lcd-display-16-x-2-p-212.html">HD4470 compatible LCD display</a>, a <a href="http://www.saelig.com/BRD/ETH027.htm">WIZ810MJ</a> ethernet module (in an <a href="http://www.nkcelectronics.com/wiznet-wiz810mj-module-to-breadboard-spi-adap.html">adapter board</a>) and some discrete components with a <a href="http://www.oomlout.co.uk/temperature-sensor-tmp36-p-210.html">TMP36</a> for temperature monitoring.  </p>
<p>This is the result set for the last day.  The live graph is <a href="http://www.cyberspice.org.uk/projects/vivmonitor">here</a>.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/4055151155" title="View 'The Generated Graph' on Flickr.com">
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3479/4055151155_d13347aafd.jpg" alt="The Generated Graph" border="0" width="500" height="260" /></div>
<p></a></p>
<p>The circuit uses nearly all of the digital pins (it would use them all if the ethernet library supported interrupts).  The LCD is connected using digital pins 3 to 8.  Pins 3 to 6 are the data lines, 7 is the enable pin and 8 is RS.  The ethernet module is connected using digital pins 9 to 13 being Reset, SS, MOSI, MISO and SCLK.  The temperature sensor is connected to Analog pin 0.  It outputs 10mV per degree Celcius with a 500mV offset so that 0C is 500mv, 50C is 1V etc.  The code sketch is below.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;string.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Required for the LCD</span>
<span style="color: #339933;">#include &lt;LiquidCrystal.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Required for ethernet</span>
<span style="color: #339933;">#include &lt;Client.h&gt;</span>
<span style="color: #339933;">#include &lt;Ethernet.h&gt;</span>
<span style="color: #339933;">#include &lt;Server.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Required for the IINCHIP macros</span>
<span style="color: #339933;">#include &lt;utility/spi.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The ethernet reset control pin</span>
<span style="color: #993333;">int</span> resetPin  <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// The temperature analog input pin</span>
<span style="color: #993333;">int</span> tempAnPin <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// String buffer</span>
<span style="color: #993333;">char</span> buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">256</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Hardcoded MAC, IP and gateway</span>
byte mac<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #208080;">0xDE</span><span style="color: #339933;">,</span> <span style="color: #208080;">0xAD</span><span style="color: #339933;">,</span> <span style="color: #208080;">0xBE</span><span style="color: #339933;">,</span> <span style="color: #208080;">0xEF</span><span style="color: #339933;">,</span> <span style="color: #208080;">0xFE</span><span style="color: #339933;">,</span> <span style="color: #208080;">0xED</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
byte ip<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000dd;">192</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">168</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">140</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
byte gw<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000dd;">192</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">168</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">254</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Create an LCD control object.  Doesn't use regular pins as</span>
<span style="color: #666666; font-style: italic;">// we need some of them for the Ethernet SPI.</span>
LiquidCrystal lcd<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">8</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">7</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">6</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Hardcoded server and port</span>
byte svr<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000dd;">192</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">168</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">128</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span>  port  <span style="color: #339933;">=</span> <span style="color: #0000dd;">80</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// A client class for connecting to a remote server to send data</span>
Client client<span style="color: #009900;">&#40;</span>svr<span style="color: #339933;">,</span> port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Writes a byte to a register in the W5100 chip used by the 
 * WIZ810MJ ethernet board. 
 *
 * @param addr The address in the W5100 controller to write.
 * @param data The byte to write.
 */</span>
<span style="color: #993333;">void</span> writeByte<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> addr<span style="color: #339933;">,</span> byte data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  IINCHIP_ISR_DISABLE<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_SpiInit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_CSoff<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  IINCHIP_SpiSendData<span style="color: #009900;">&#40;</span><span style="color: #208080;">0xf0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_SpiSendData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>addr <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0xff00</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_SpiSendData<span style="color: #009900;">&#40;</span>addr <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0xff</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_SpiSendData<span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  IINCHIP_CSon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  IINCHIP_ISR_ENABLE<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The four IP addres bytes (we're not IP6 compatible here)</span>
byte ip0<span style="color: #339933;">,</span> ip1<span style="color: #339933;">,</span> ip2<span style="color: #339933;">,</span> ip3<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Initialise the hardware
 */</span>
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Reset the ethernet board</span>
  pinMode<span style="color: #009900;">&#40;</span>resetPin<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>resetPin<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 1ms</span>
  digitalWrite<span style="color: #009900;">&#40;</span>resetPin<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 1ms</span>
  digitalWrite<span style="color: #009900;">&#40;</span>resetPin<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
  <span style="color: #666666; font-style: italic;">// Start ethernet</span>
  Ethernet.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span>mac<span style="color: #339933;">,</span> ip<span style="color: #339933;">,</span> gw<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Enable ping.  Useful for debugging.</span>
  writeByte<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x0000</span><span style="color: #339933;">,</span> <span style="color: #208080;">0x00</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Read the IP address (Check to see its working right) </span>
  ip0 <span style="color: #339933;">=</span> readByte<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x000f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ip1 <span style="color: #339933;">=</span> readByte<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x0010</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ip2 <span style="color: #339933;">=</span> readByte<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x0011</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ip3 <span style="color: #339933;">=</span> readByte<span style="color: #009900;">&#40;</span><span style="color: #208080;">0x0012</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Form the output string (Adds about a K to the code size)</span>
  sprintf<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%d.%d.%d.%d&quot;</span><span style="color: #339933;">,</span> ip0<span style="color: #339933;">,</span> ip1<span style="color: #339933;">,</span> ip2<span style="color: #339933;">,</span> ip3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Display it</span>
  lcd.<span style="color: #202020;">home</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">#ifdef DEBUG</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#endif</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The value of the temperature analog pin</span>
<span style="color: #993333;">int</span> tempAnValue<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The temperature</span>
<span style="color: #993333;">int</span> temperature<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The temperature components;</span>
<span style="color: #993333;">int</span> tempInt<span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> tempFrac<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// A counter for sychronization.  Allows server to work out if a</span>
<span style="color: #666666; font-style: italic;">// 'packet' is missing</span>
<span style="color: #993333;">int</span> count <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Main processing thread
 */</span>
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Read the temperature</span>
  tempAnValue <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span>tempAnPin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Fixed point math to calculate the temperature (multiply then divide</span>
  <span style="color: #666666; font-style: italic;">// to reduce rounding issues) Gives temperature in 100ths of degree C</span>
  <span style="color: #666666; font-style: italic;">// 5000 millivolts is the maximum voltage</span>
  <span style="color: #666666; font-style: italic;">// 1024 is the maximum ADC value</span>
  <span style="color: #666666; font-style: italic;">// 500mv is 0 degrees C</span>
  temperature <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>tempAnValue <span style="color: #339933;">*</span> <span style="color: #0000dd;">50000</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #0000dd;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #0000dd;">5000</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Since we're only going to report to 1 decimal place, add 5 for correct</span>
  <span style="color: #666666; font-style: italic;">// rounding</span>
  tempInt  <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>temperature <span style="color: #339933;">+</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #0000dd;">100</span><span style="color: #339933;">;</span>
  tempFrac <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>temperature <span style="color: #339933;">+</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Form the output string</span>
  sprintf<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Temp: %d.%d C&quot;</span><span style="color: #339933;">,</span> tempInt<span style="color: #339933;">,</span> tempFrac<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Display it</span>
  lcd.<span style="color: #202020;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">#ifdef DEBUG</span>
<span style="color: #009900;">&#123;</span>
    sprintf<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> 
            <span style="color: #ff0000;">&quot;HEAD /newtemp.php?count=%d&amp;temp=%d.%d HTTP/1.1&quot;</span><span style="color: #339933;">,</span> 
            count<span style="color: #339933;">,</span> tempInt<span style="color: #339933;">,</span> tempFrac<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Host: my.host.org&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Connection: close&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">#endif</span>
&nbsp;
<span style="color: #339933;">#ifndef NO_ETHERNET</span>
  <span style="color: #666666; font-style: italic;">// Send to server</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>client.<span style="color: #202020;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// If connected send the packet count and temperature</span>
    sprintf<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> 
            <span style="color: #ff0000;">&quot;HEAD /newtemp.php?count=%d&amp;temp=%d.%d HTTP/1.1&quot;</span><span style="color: #339933;">,</span> 
            count<span style="color: #339933;">,</span> tempInt<span style="color: #339933;">,</span> tempFrac<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    client.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Host: my.host.org&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Connection: close&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #202020;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// If failed sad face</span>
    lcd.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; :-(&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">#endif</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Update packet counter</span>
  count<span style="color: #339933;">++;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Sleep for a minute</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">60000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>A couple of things to note are:</p>
<ul>
<li>I use integer math.  avrgcc, the compiler, supports floats but its just more efficient and requires less memory to use fixed point integer math when its just one or two values you need to represent.</li>
<li>I use a count value sent with each data packet so that if one goes missing you can tell,  Currently the code at the other end doesn&#8217;t use it though.</li>
<li>I send a HEAD request with a query string containing the values.  My request is not technically valid HTTP but the server doesn&#8217;t have a problem.  A HEAD request returns the headers for a request but no body.  Since I&#8217;m ignoring the whole response anyway I don&#8217;t need the body!
</li>
<p>The script on the web server that receives the data is below.  It is very simple PHP.  Since PHP doesn&#8217;t support HEAD requests directly in its super-globals (watch this space <img src='http://www.cyberspice.org.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I process the query string by hand.  As I know the format of the data since I control the client I&#8217;m not worried about URL decoding the data.  It writes three values (the time in seconds since the UNIX epoch, the packet count and the temperature), colon separated, as a line to a text file.  It returns nothing.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'HEAD'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$keyval</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$keyval</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$keyval</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/path/to/tempdata.txt'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'a+'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">':'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">':'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Another script generates a graph as a PNG file based on the data.  This code is below.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WIDTH'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HEIGHT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">520</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FONT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get the temperature data</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/path/to/tempdata.txt&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keyval</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keyval</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keyval</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span>       <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keyval</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$keyval</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get the number of data points</span>
<span style="color: #000088;">$datapoints</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Lines are chronological</span>
<span style="color: #000088;">$mintime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$maxtime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$datapoints</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Temperatures need to be processed.</span>
<span style="color: #000088;">$mintemp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$maxtemp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$datapoint</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$mintemp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mintemp</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$datapoint</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span> ? 
	           <span style="color: #000088;">$mintemp</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$datapoint</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$maxtemp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$maxtemp</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$datapoint</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span> ? 
	           <span style="color: #000088;">$maxtemp</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$datapoint</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get the axis dimensions.  Round up and down to the nearest</span>
<span style="color: #666666; font-style: italic;">// degree C and hour.</span>
<span style="color: #000088;">$lowtime</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mintime</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3600</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hightime</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$maxtime</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3600</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$difftime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$hightime</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtime</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$lowtemp</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mintemp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hightemp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$maxtemp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$difftemp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$hightemp</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtemp</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Create the image</span>
<span style="color: #000088;">$image</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreate</span><span style="color: #009900;">&#40;</span>WIDTH<span style="color: #339933;">,</span> HEIGHT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$background</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$black</span>      <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$red</span>        <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$blue</span>       <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Draw the axes</span>
	<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">485</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">980</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">980</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">980</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">485</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3600</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$difftime</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">960</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">483</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$difftemp</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">480</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">460</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftemp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">17</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Draw the labels</span>
	<span style="color: #990000;">imagestring</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> FONT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">490</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H:i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lowtime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagestring</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> FONT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">970</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">490</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H:i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hightime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagestringup</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> FONT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">485</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lowtemp</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'C'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagestringup</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> FONT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">25</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hightemp</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'C'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Draw the points</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Position of the first point</span>
	<span style="color: #000088;">$prevx</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtime</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">960</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftime</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$prevy</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtemp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">460</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftemp</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Draw line from previous point to current point</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$datapoints</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtime</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">960</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftime</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'temperature'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$lowtemp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">460</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$difftemp</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prevx</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$prevy</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">480</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$y</span><span style="color: #339933;">,</span> <span style="color: #000088;">$red</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$prevx</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$prevy</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$y</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Finally time and date stamp</span>
	<span style="color: #000088;">$generated</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Generated: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagestring</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> 
	            FONT<span style="color: #339933;">,</span>
	            WIDTH <span style="color: #339933;">-</span> <span style="color: #cc66cc;">15</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">imagefontwidth</span><span style="color: #009900;">&#40;</span>FONT<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$generated</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	            HEIGHT <span style="color: #339933;">-</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> 
	            <span style="color: #000088;">$generated</span><span style="color: #339933;">,</span>
	            <span style="color: #000088;">$blue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Output the image</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type: image/png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Destroy it</span>
	<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This was a fun little project and as can be seen from the snap shot of the graph changing the bulb significantly changes the maximum temperature of the vivarium.  I will be running with the smaller wattage bulb.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2009/10/29/boarduino-vivarium-temperature-monitor/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Breadboard power supply</title>
		<link>http://www.cyberspice.org.uk/blog/2009/09/14/breadboard-power-supply/</link>
		<comments>http://www.cyberspice.org.uk/blog/2009/09/14/breadboard-power-supply/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 12:17:53 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Crafty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=283</guid>
		<description><![CDATA[Last Sunday I woke early so I started on a project I&#8217;ve had in mind for a while but not gotten around to doing. I built a power supply module that plugs in to a breadboard. There are a few kits for these kind of things around from Adafruit and others but I had slightly [...]]]></description>
			<content:encoded><![CDATA[<p>Last Sunday I woke early so I started on a project I&#8217;ve had in mind for a while but not gotten around to doing.  I built a power supply module that plugs in to a breadboard.  There are a few kits for these kind of things around from <a href="http://www.adafruit.com/">Adafruit</a> and others but I had slightly different requirements.</p>
<p><span id="more-283"></span><br />
My basic requirements were 5V and 3.3V supplies with the unregulated supply coming from a power adapter plug.  I built the circuit on strip board as I had some available, it saved me designing a circuit board, and the holes lined up.  The size of the board was set by the width of the breadboard together with how much of the breadboard I wanted to obscure.  I also wanted indicators for the unregulated supply, the 5V supply and 3.3V supply so that I could spot any faults.  And I wanted it to look relative tidy.  This is what I came up with&#8230;</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/39013214@N03/3916465538" title="View 'Breadboard Power Supply' on Flickr.com">
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3484/3916465538_565fa9474c_m.jpg" alt="Breadboard Power Supply" border="0" width="240" height="159" /></div>
<p></a></div>
<p>I kind of put the cart before the horse since I didn&#8217;t have a circuit when I started.  It was built basically from a design I had in my head.  Its a fairly text book design with a diode to protect the circuit from reverse current, smoothing capacitors in to the regulators and smoothing capacitors on the outputs.  LEDs and current control resistors make up the rest of the circuit.  The electrolytic capacitor values were basically based on what I had available.  I suspect a 100uF on the input smoothing would be better.  The schematic is below.</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/39013214@N03/3919404124" title="View 'Schematic' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2581/3919404124_b2614e8d3d_m.jpg" alt="Schematic" border="0" width="240" height="110" /></div>
<p></a></div>
<p>I like my electronics to look neat so I laid out the major components to ensure the board was symmetrical, the LEDs lined up and it plugged in to the breadboard without issue.  Everything else was fitted around those components.  There are no breaks in the tracks on this circuit although there are a couple of wires underneath to provide the GND &#8216;plane&#8217;.</p>
<p>Finally here&#8217;s a close up of the board.  This is <a href="http://www.flickr.com/photos/39013214@N03/3915679643" title="View 'Breadboard Power Supply Close Up' on Flickr.com">annotated on Flickr</a> so you can see what does what.</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/39013214@N03/3915679643" title="View 'Breadboard Power Supply Close Up' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2480/3915679643_7ef7e140cf_m.jpg" alt="Breadboard Power Supply Close Up" border="0" width="159" height="240" /></div>
<p></a></div>
<p>All in all a nice way to spend a couple of hours on a Sunday.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2009/09/14/breadboard-power-supply/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Fun with a BoArduino</title>
		<link>http://www.cyberspice.org.uk/blog/2009/09/03/fun-with-a-boarduino/</link>
		<comments>http://www.cyberspice.org.uk/blog/2009/09/03/fun-with-a-boarduino/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 12:20:44 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Crafty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[BoArduino]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=270</guid>
		<description><![CDATA[In March I went to the first Makerfaire in the UK. The Newcastle-upon-Tyne Makerfaire was part of Newcastle Sciencefest. Its not that far from where I live so I drove up there for the day. There were lots of kewl stuff as you&#8217;d expect. I particularly liked the electro-mechanical fire breathing horse robot. Amusingly I [...]]]></description>
			<content:encoded><![CDATA[<p>In March I went to the first Makerfaire in the UK. The <a href="http://makerfaire.com/newcastle/2009/">Newcastle-upon-Tyne Makerfaire</a> was part of Newcastle Sciencefest.  Its not that far from where I live so I drove up there for the day.  </p>
<p>There were lots of kewl stuff as you&#8217;d expect.  I particularly liked the electro-mechanical fire breathing horse robot.  Amusingly I met one of the Microsoft guys who&#8217;d demonstrated the Microsoft interactive table at PHP London.  He was there with his cheap, home brew, version of the table which used back projection of the image and a camera to detect the finger position.  The guy with the UK101s who I&#8217;d met at Techadventure was also there.</p>
<p>Naturally there was an O&#8217;Reilly stand as they are publishers of both <a href="http://makezine.com/">Make</a> and <a href="http://craftzine.com/">Craft</a> magazines.  They had a pile of kits from <a href="http://www.adafruit.com/">Adafruit</a> including the <a href="http://www.adafruit.com/index.php?main_page=product_info&#038;cPath=19&#038;products_id=72">boArduino</a>.  This is an <a href="http://www.arduino.cc/">Arduino</a> clone designed to plug in to a breadboard.  There are two versions.  One with a USB to Serial adapter on board and one which has a power supply onboard but requires TTL level serial which can be easily supplied by an <a href="http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&#038;prodCategoryID=47&#038;title=Cables%3A+TTL-232R+and+variants">FTDI lead</a>.  I bought one of the latter.</p>
<p>The kit languished on the shelves at my computer workstation until about a month ago when I decided to solder it together and play with it.  Its a through hole double sided board which is relatively packed and so requires some experience of soldering.  Apart from stupidly soldering in a LED the wrong way around and then having to desolder it and obtain a new one I had no problems.  It worked first time! <a href="http://www.ladyada.net/">Limor aka Ladyada</a>, who designed it and runs Adafruit makes good stuff.</p>
<p>I videoed it using my G1 phone (hence the poor quality due to low light).  I have the Arduino IDE running on my MacBook.  The FDTI lead is based around a common part with easily obtainable drivers for Windows, OS X and Linux.</p>
<p><center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/POZGLScjPp4&#038;hl=en&#038;fs=1&#038;color1=0x402061&#038;color2=0x9461ca"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/POZGLScjPp4&#038;hl=en&#038;fs=1&#038;color1=0x402061&#038;color2=0x9461ca" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2009/09/03/fun-with-a-boarduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

