<?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>Alex Blog</title>
	<atom:link href="http://alex.mordue.co.uk/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://alex.mordue.co.uk/blog</link>
	<description>Alex&#039;s Blog of Stuff</description>
	<lastBuildDate>Wed, 04 Apr 2012 16:28:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Bacon Jam</title>
		<link>http://alex.mordue.co.uk/blog/?p=133&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bacon-jam</link>
		<comments>http://alex.mordue.co.uk/blog/?p=133#comments</comments>
		<pubDate>Wed, 31 Aug 2011 13:50:31 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Food]]></category>
		<category><![CDATA[bacon]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[jam]]></category>
		<category><![CDATA[recipe]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=133</guid>
		<description><![CDATA[I actually made this quite a while ago, shamelessly stolen from Not Quite Nigella Ingredients Let&#8217;s see if I can remember what I used: 20 rashers of bacon (Smoked) 1 onion, finely chopped About half a bulb of garlic, minced A good heaped tablespoon of brown sugar (some might call this 2 spoons) Some Chilula [...]]]></description>
			<content:encoded><![CDATA[<p>I actually made this quite a while ago, shamelessly stolen from <a href="http://www.notquitenigella.com/2009/10/08/bacon-jam-your-wildest-dreams-come-true/">Not Quite Nigella</a></p>
<h2>Ingredients</h2>
<p>Let&#8217;s see if I can remember what I used:</p>
<ul>
<li>20 rashers of bacon (Smoked)</li>
<li>1 onion, finely chopped</li>
<li>About half a bulb of garlic, minced</li>
<li>A good heaped tablespoon of brown sugar (some might call this 2 spoons)</li>
<li>Some Chilula chipotle hot sauce (smokey tasty)</li>
<li>1/2 a cup of maple syrup (maybe a little more, maybe more like a 1/2 mug)</li>
<li>1 cup of coffee</li>
<li>1/4 of a cup of cider vinegar</li>
</ul>
<h2>Method</h2>
<p>It&#8217;s pretty easy:</p>
<ul>
<li>Fry all the bacon</li>
<li>Put the fried bacon into a pot with the onion and garlic on a medium heat, give it about 10 minutes until the onion is nice and soft</li>
<li>Add everything else to the pot and bring to a simmer</li>
<li>Leave the pot open and keep it at a low simmer for around 2 hours (You may have to add a little water if it starts to look too dry)</li>
<li>You should end up with a sticky mess, put it in a food processor and whizz to your desired consistency</li>
<li>Eat on toast, with eggs, anywhere where you might use a chutney</li>
</ul>

<a href='http://alex.mordue.co.uk/blog/?attachment_id=134' title='bacon1'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0437-150x150.jpg" class="attachment-thumbnail" alt="Starting to crisp" title="bacon1" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=135' title='bacon2'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0438-150x150.jpg" class="attachment-thumbnail" alt="Pot of bacon" title="bacon2" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=136' title='bacon3'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0439-150x150.jpg" class="attachment-thumbnail" alt="Bacon and Onions" title="bacon3" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=137' title='bacon4'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0440-150x150.jpg" class="attachment-thumbnail" alt="Bacon coffee soup" title="bacon4" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=138' title='bacon5'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0441-150x150.jpg" class="attachment-thumbnail" alt="Condensing bacon at 1hr" title="bacon5" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=139' title='bacon6'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0442-150x150.jpg" class="attachment-thumbnail" alt="Almost Ready" title="bacon6" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=140' title='bacon7'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0444-150x150.jpg" class="attachment-thumbnail" alt="Thick bacon jam" title="bacon7" /></a>
<a href='http://alex.mordue.co.uk/blog/?attachment_id=141' title='bacon8'><img width="150" height="150" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/IMG_0447-150x150.jpg" class="attachment-thumbnail" alt="Bacon in a jar" title="bacon8" /></a>

]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2008, on Xen 4, on Debian 6</title>
		<link>http://alex.mordue.co.uk/blog/?p=85&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-server-2008-on-xen-4-on-debian-6</link>
		<comments>http://alex.mordue.co.uk/blog/?p=85#comments</comments>
		<pubDate>Sat, 21 May 2011 22:22:02 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[pv]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[win2k8]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen4]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=85</guid>
		<description><![CDATA[There&#8217;s not a lot of information on the net about this particular configuration so I thought I&#8217;d put a post together that gathers what information there is, what worked for me and what didn&#8217;t. So the setup I used was: A Core i7 based server Debian 6.0.1 AMD64 (Squeeze) Xen 4.0.1 (Debian packaged version) Windows [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s not a lot of information on the net about this particular configuration so I thought I&#8217;d put a post together that gathers what information there is, what worked for me and what didn&#8217;t.<span id="more-85"></span></p>
<p>So the setup I used was:</p>
<ul>
<li>A Core i7 based server</li>
<li>Debian 6.0.1 AMD64 (Squeeze)</li>
<li>Xen 4.0.1 (Debian packaged version)</li>
<li>Windows 2008r2 Standard Edition</li>
<li>GPLPV 0.11.0.238 paravirtualized drivers for Vista/Win7/2008</li>
</ul>
<p>I&#8217;m going to start at the beginning since that&#8217;s what I did.</p>
<h2>Hardware</h2>
<p>Before you begin you&#8217;ll need to check that your processor supports virtualization extensions, and that these are enabled in your motherboards BIOS. If you have Linux on the machine (or can boot a Linux live cd) you can check for virtualization extensions in the following way:</p>
<pre class="brush: bash; ">

cat /proc/cpuinfo
</pre>
<p>You are looking for vmx (for Intel processors) or svm (for AMD processors). One caveat is that if you;ve installed the Xen hypervisor already you may not see vmx or svm listed in /proc/cpuinfo. In this case you can run:</p>
<pre class="brush: bash; ">

xm dmesg
</pre>
<p>Check for a line that looks something like</p>
<blockquote>
<pre>(XEN) HVM: VMX enabled</pre>
</blockquote>
<p>Okay, so assuming you&#8217;ve got virtualization extension support on your processor the rest of the hardware is pretty much up to you (and what the kernel will support).</p>
<h2>Debian and Xen</h2>
<p>This is fairly straightforward if you&#8217;ve installed any Linux distribution before. I had to do it the hard way, doing a bootstrap from Centos (as the server is in a datacentre somewhere and came with Centos as the only OS choice). The install should be as minimal as possible, you don&#8217;t really want much running on the host (dom0) system. The only notable thing about my setup was the partitioning:</p>
<blockquote>
<pre>/boot 256MB
/ 10GB
swap 8GB
LVM Volumegroup ManyGB</pre>
</blockquote>
<p>LVM makes managing guest disks quite straightforward and flexible.</p>
<blockquote><p><em>Note: Debian 6 uses GRUB2 as its boot manager, the easiest way to ensure the OS you want to run is booted by default is to modify /etc/default/grub and modify the GRUB_DEFAULT line to the name (with quotes) of whatever entry you want to boot by default, then to run grub-update. You can check the names of the current GRUB entries in the file /boot/grub/grub.cfg</em></p></blockquote>
<p>So once you&#8217;ve done your base Debian install, you&#8217;ll want to install Xen. The following should install most of what you need:</p>
<pre class="brush: bash; ">

apt-get install xen-linux-system-2.6-xen-amd64 lvm2 bridge-utils genisoimage
</pre>
<p>GRUB2 installed with Debian 6 knows about Xen and when you do the apt-get above your /boot/grub/grub.cfg should get updated automatically with new entries for your Xen hypervisor and appropriate kernel, if you want to make sure the update has happened just do a grub-update.</p>
<p>Okay so now you should be able to reboot and boot into your &#8220;Debian GNU/Linux, with Linux 2.6.32-5-xen-amd64 and XEN 4.0-amd64&#8243; or similar.</p>
<p>Once booted you should be able to do and see the following:</p>
<pre class="brush: bash; ">

root@vmhost:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  6928     8     r-----    697.8
</pre>
<p>In my configuration I have a number of public IPs assigned to the machine which I can assign to the virtual machines. To enable this we need to tell Xen to use bridged networking. To do this you need to edit the file /etc/xen/xend-config.sxp and make sure to uncomment the line:</p>
<blockquote>
<pre>(network-script network-bridge)</pre>
</blockquote>
<p>Once you&#8217;ve done this you&#8217;ll need to restart xend (service xend restart) or restart the machine to bring the bridge up.</p>
<h2>Windows VM, disks and DVDs</h2>
<p>First you need some installation &#8220;media&#8221;. I wanted to install Windows 2008 from an MSDN dvd iso image. The first problem, how do I get the dvd image from the MSDN site with only text based browsers that don&#8217;t support Javascript? I started by logging into MSDN and going to the downloads section in my desktop browser (I used Chrome but you should be able to use any browser that allows you to see what requests are being made to the server). Open the Chrome developer pane (the easiest way to do this is just right mouse anywhere on the site and do &#8220;Inspect element&#8221;) and then go to the Network tab. Click the download link and you should see requests to a couple of URLs on the MSDN servers. The first is to a &#8220;default.aspx&#8221; click on this and you should see more information about the request. Copy the URL parameter, you should be able to use this with wget on your Xen host to fetch the dvd iso image.</p>
<p>Okay, so now we have the DVD image, we need a &#8220;disk&#8221; to install to. I partitioned my disk so that most of the disk was free for LVM. If you haven&#8217;t used LVM before it&#8217;s worth having a read about it now, the simplest set of commands to get LVM up and running are below (replace /dev/sdx4 with whatever device(s) you want to use for storing the virtual machine images on):</p>
<pre class="brush: bash; ">

pvcreate /dev/sdx4
vgcreate vm-volgroup /dev/sdx4
</pre>
<p>Assuming you use the lines above you have an LVM volume group called vm-volgroup on which you can create logical volumes with a command something like:</p>
<pre class="brush: bash; ">

lvcreate -L 60G -n windowstest-disk vm-volgroup
</pre>
<p>So the above will create a new 60GB logical volume called windowstest-disk on the vm-volgroup. A block device will be created for this volume and symbolic links made so you can easily access it. For example using the commands above you will end up with a link at /dev/vm-volgroup/windowstest-disk, which you can use in your configuration files to refer to the disk.</p>
<p>We also need one more block device, this is going to be a CD to install the PV drivers from. Grab the PV drivers installer from <a href="http://www.meadowcourt.org/downloads/">http://www.meadowcourt.org/downloads/</a> I used gplpv_Vista2008x64_0.11.0.238.msi</p>
<p>To create a cd image with the file on it, stick that file in folder on its own, then do the following:</p>
<pre class="brush: bash; ">

genisoimage -o /opt/isos/win2k8drivers.iso drivers/
</pre>
<h2>Xen VM Configuration</h2>
<p>So we&#8217;ve now got all the block devices sorted out we need a configuration file for the machine. Here&#8217;s what I used:</p>
<pre class="brush: bash; ">

name = &#039;windowstest&#039;
kernel = &#039;/usr/lib/xen-4.0/boot/hvmloader&#039;
builder = &#039;hvm&#039;
device_model = &#039;/usr/lib/xen-4.0/bin/qemu-dm&#039;
memory = 2048
shadow_memory = 8
vcpus=1
acpi=1
apic=1

# Choose a better mac address
vif = [ &#039;bridge=eth0, mac=00:11:22:33:44:55&#039; ]

## The VM has the following block devices
#  - A boot disk with a single partition for the OS, swap, and programs
#  - The installation DVD
#  - The PV drivers CD
disk = [ &#039;phy:/dev/vm-vol/wintest-disk,hda,w&#039;,
&#039;file:/opt/isos/en_windows_server_2008_r2_standard_x64_dvd.iso,hdc:cdrom,r&#039;,
&#039;file:/opt/isos/win2k8drivers.iso,hdd:cdrom,r&#039;]

# Boot from the DVD first
boot=&#039;dc&#039;

usbdevice=&#039;tablet&#039;

## Use VNC for the console.
vnc=1
vncunused=0
vnclisten = &#039;127.0.0.1&#039;
vncdisplay=2
vncconsole=1
vncpasswd=&#039;agoodpassword&#039;

vncviewer=0
sdl=0

stdvga=0
serial=&#039;pty&#039;
ne2000 = &quot;0&quot;

on_poweroff = &#039;destroy&#039;
on_reboot   = &#039;restart&#039;
on_crash    = &#039;restart&#039;
</pre>
<blockquote><p><em>Note: Do not use a maxmem definition in the configuration file. <strong>THIS WILL CAUSE YOUR DOM0 TO CRASH</strong>.</em></p></blockquote>
<p>Okay, we should now be good to go.</p>
<h2>Connecting to your Windows VM</h2>
<p>So you&#8217;ll see in the configuration file above, the VNC server that is displaying the windowstest VM&#8217;s screen is bound to 127.0.0.1. You can specify the Xen host&#8217;s external IP, however if it&#8217;s world viewable on the internet that may not be a good idea. Running it on localhost means that you have to use ssh to forward a port on your desktop machine to the local port on the Xen host. You can use putty to do this:</p>
<div id="attachment_116" class="wp-caption aligncenter" style="width: 476px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/putty.png"><img class="size-full wp-image-116" title="Putty Tunnel" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/putty.png" alt="" width="466" height="448" /></a><p class="wp-caption-text">Port 5902 as we are using VNC screen 2</p></div>
<div id="attachment_117" class="wp-caption aligncenter" style="width: 476px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/putty2.png"><img class="size-full wp-image-117" title="Putty Tunnel Added" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/putty2.png" alt="" width="466" height="448" /></a><p class="wp-caption-text">Putty Tunnel Added to the configuration for this ssh host</p></div>
<p>Connect and log into to the host, and the tunnel should be established.</p>
<div id="attachment_118" class="wp-caption aligncenter" style="width: 362px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/vnc.png"><img class="size-full wp-image-118" title="VNC" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2011/05/vnc.png" alt="" width="352" height="145" /></a><p class="wp-caption-text">Connecting to the ssh forwarded VNC port</p></div>
<h2>Windows Installation and Paravirtualized Drivers</h2>
<p>Once you are connected via VNC you can go through the Windows install as normal. Once this is done we want to install the GPLPV drivers. The drivers are test signed, this means that Windows will not boot with them unless we explicitly tell it to boot without signed drivers (which requires setting on every boot) or by enabling test mode. Test signing mode can be enabled permanently by opening a command line on the windows machine and typing the following:</p>
<pre class="brush: bash; ">

bcdedit.exe /set TESTSIGNING ON
</pre>
<p>You will need to reboot the VM to enable test mode.</p>
<p>When the VM has rebooted and you&#8217;ve reconnected with VNC you can install the GPLPV drivers from the CD. The default install options should be fine. Rebooting the VM again after the drivers are installed should enable the PV drivers. Congratulations you&#8217;re done!</p>
<p>UPDATE: Signed PV drivers are now available take a look here: <a href="http://wiki.univention.de/index.php?title=Installing-signed-GPLPV-drivers">http://wiki.univention.de/index.php?title=Installing-signed-GPLPV-drivers</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=85</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Black Screen of SNES</title>
		<link>http://alex.mordue.co.uk/blog/?p=70&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=black-screen-of-snes</link>
		<comments>http://alex.mordue.co.uk/blog/?p=70#comments</comments>
		<pubDate>Sat, 18 Sep 2010 14:41:42 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Dreamcast]]></category>
		<category><![CDATA[Grubby]]></category>
		<category><![CDATA[SNES]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=70</guid>
		<description><![CDATA[I have a load of old consoles lying around, including a SNES with a pile of games I picked up cheaply after the N64 released. While all the games worked perfectly 15 years ago, trying them again now, some would do nothing other than display a black screen when the console was powered up.]]></description>
			<content:encoded><![CDATA[<p>I have a load of old consoles lying around, including a SNES with a pile of games I picked up cheaply after the N64 released. While all the games worked perfectly 15 years ago, trying them again now, some would do nothing other than display a black screen when the console was powered up. Figuring that the ROM chips were probably fine I guessed it was most likely the interface between the SNES and the cartridge that was at fault.</p>
<p>Taking apart one of the games I was presented with this:</p>
<div id="attachment_71" class="wp-caption aligncenter" style="width: 653px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/09/dirtycartridge.jpg"><img class="size-full wp-image-71 " title="Cartridge with dirty contacts" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/09/dirtycartridge.jpg" alt="" width="643" height="723" /></a><p class="wp-caption-text">PCB from Super Bomberman 2 cartridge, non-working</p></div>
<p>As you can see there&#8217;s quite a lot of dirt/corrosion on the contacts of the PCB. I tried removing the dirt with some cotton buds + IPA but it was fairly stubborn so I ended up giving the contacts (just the contacts leave the rest of the PCB alone) a very light sanding with some 1000 grit sandpaper (probably wet and dry, I just found a small piece of it in the top of my toolbox). I wouldn&#8217;t recommend using anything coarser as you may damage the tracks.</p>
<p>As an aside, grit is the measurement of &#8220;roughness&#8221; of sandpaper and polishing compounds. It refers to the maximum number of holes per inch in a mesh that will still allow the compound/grit through. So the larger the number, the finer the grit.</p>
<p>So after a little sanding I got this:</p>
<div id="attachment_72" class="wp-caption aligncenter" style="width: 716px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/09/cleancartridge.jpg"><img class="size-full wp-image-72" title="Clean Cartridge" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/09/cleancartridge.jpg" alt="" width="706" height="589" /></a><p class="wp-caption-text">Shiny Bomberman 2 PCB</p></div>
<p>Putting it back into its case and putting it into the SNES, success! Super Bomberman 2 lives again! Opening the cartridges isn&#8217;t really necessary but I thought I&#8217;d do it to get some better pictures of the board.</p>
<h2>Sympathetic Dreamcast</h2>
<p>As a show of support for its black screening older friend, my Dreamcast decided to start rebooting itself a few seconds after starting up, or whilst loading games. This, again, was down to corrosion of contacts. The power supply in the Dreamcast is internal and uses a pin header plus sprung contacts to transfer the power to the console&#8217;s main board.</p>
<p>Removing the power supply and again lightly sanding the pins fixed the problem. Hooray! Although that does mean I now have to finish the Nomad Soul&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manual Headlight Level Adjuster for the RX8</title>
		<link>http://alex.mordue.co.uk/blog/?p=46&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=manual-headlight-level-adjuster-for-the-rx8</link>
		<comments>http://alex.mordue.co.uk/blog/?p=46#comments</comments>
		<pubDate>Mon, 19 Jul 2010 00:25:59 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Cars]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Minor Danger]]></category>
		<category><![CDATA[Potentiometer]]></category>
		<category><![CDATA[RX8]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=46</guid>
		<description><![CDATA[Manually adjust your HID headlights on the go. ]]></description>
			<content:encoded><![CDATA[<p><strong> </strong></p>
<p><strong>Note</strong>, before you start cutting wires in your car: the internals of the headlight auto levelling system are unknown to me I&#8217;m treating it as a &#8220;black box&#8221; (how convenient that it is actually a black box) and just looking at the inputs and outputs and making assumptions about how it works. I accept no responsibility if you cause damage to your car, yourself or others from doing things detailed in this post.</p>
<h2>Background on HID lights</h2>
<p>All 231BHP versions of the RX8 (in the UK at least) have high intensity discharge headlights (HIDs).</p>
<p>One of the requirements for using HIDs in a car is that the car must have some sort of auto-levelling system to ensure that when the car is loaded unevenly front to rear that the difference in height front to back does not cause the lights to point too far up, potentially dazzling other motorists.</p>
<p>The RX8 does this by having actuators in the headlight unit to angle the beam up and down. To sense the suspension load at the front and rear it has 2 sensors, one on the left front suspension, another on the rear left suspension assembly.</p>
<h2>So what&#8217;s the problem?</h2>
<p>So you may be thinking why do you want to manually adjust the lights then? Surely this is a safety feature?</p>
<p>The sensors are, essentially, potentiometers (variable resistors) attached via a linkage to the suspension. They have a wiper that moves along a carbon track the ends of which are connected to power and ground.</p>
<div id="attachment_57" class="wp-caption aligncenter" style="width: 540px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/potentiometer.png"><img class="size-full wp-image-57" title="Potentiometer" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/potentiometer.png" alt="" width="530" height="312" /></a><p class="wp-caption-text">It costs £400to make this? Really?</p></div>
<p>By reading the voltage from the wiper connection on the front and rear sensors the auto-levelling control unit can work out if one end of the car is higher than the other and adjust the headlight angle accordingly.</p>
<p>The problem is that the sensors that are used, corrode and wear out. This wouldn&#8217;t be so much of a problem but Mazda want around £400 per sensor! For a variable resistor?!</p>
<p>So there we have it:</p>
<ol>
<li>Give £800 to Mazda for some new sensors</li>
<li>Attempt to repair the sensors (if you&#8217;re lucky you may be able to dismantle the sensors, give them a good clean, replace contact springs and they might start working again)</li>
<li>Go manual</li>
</ol>
<h2>How to do it</h2>
<p>Fortunately Mazda have made this quite simple to do as the headlight auto levelling control unit is in the cabin and not, for example say, part of the ECU, or in some inaccessible location.</p>
<p>The control unit lives just to the left of the glove box, to get best access to it, remove the glove box, this involves gently bending in the side of the glove box when it&#8217;s open to allow the end stops out, once that&#8217;s done you should just be able to lift the glove box out (there is also a soft opening mechanism, but mine died quite some time ago, as far as I know you can just unclip it from the glove box.</p>
<p>[AUTO LEVELLING CONTROL UNIT PICTURE Coming Soon!!!]</p>
<p>The auto levelling control unit is the black box that says &#8220;Auto Leveling Unit&#8221; on it. It has one connector with 24 pins, the details of which you can see below:</p>
<div id="attachment_59" class="wp-caption aligncenter" style="width: 447px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/auto-levelling-connector.png"><img class="size-full wp-image-59" title="Auto levelling control unit connector" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/auto-levelling-connector.png" alt="" width="437" height="136" /></a><p class="wp-caption-text">This is as seen from the cable side of the connector</p></div>
<p>From the RX8 wiring diagrams the cables we care about are :</p>
<ul>
<li>P &#8211; Black with a Green Stripe &#8211; Ground for sensors</li>
<li>C &#8211; Black with an Orange Stripe &#8211; Power for sensors</li>
<li>I &#8211; White with an Orange Stripe &#8211; Rear Sensor wiper output</li>
<li>K &#8211; Black with a Blue Stripe &#8211; Front Sensor wiper output</li>
</ul>
<p>So what we want to do is tell the auto levelling unit that the front suspension is at its neutral position all the time and we want to be able to adjust the &#8220;rear position&#8221; to make the unit think the boot is either lightly or heavily loaded to make it adjust the headlight level accordingly.</p>
<p>So here&#8217;s a simple little circuit to do just that, you will need:</p>
<ul>
<li>2 x 4.7k Resistors</li>
<li>2 x 1k Resistors</li>
<li>1 x 10k Linear Potentiometer</li>
</ul>
<div id="attachment_54" class="wp-caption aligncenter" style="width: 725px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/circuit-diagram.png"><img class="size-full wp-image-54" title="RX8 headlight adjustment circuit" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/circuit-diagram.png" alt="" width="715" height="361" /></a><p class="wp-caption-text">What you need to build</p></div>
<p>R3 and R4 are there to change the range output by the potentiometer, as the auto levelling control unit most likely flags a fault if the voltage is zero or maximum (implying a short or open circuit somewhere).</p>
<p>So simply build it up in whatever fashion you desire (do make sure to insulate the parts from each other) and put it on a long enough wire to locate the potentiometer somewhere you can get at it, I think the ashtray would make a fine home.</p>
<p>Before starting the install, disconnect the negative battery lead. Installing it is a matter of cutting back a bit of the massive amount of insulation tape on the cable to the auto levelling unit connector then cutting the 4 wires detailed above (check twice, cut once). Strip a short length on each of the 4 cables from the connector (insulate the other ends, they are not used, they&#8217;re just connected to your broken sensors) and then either solder, or use terminal blocks to connect your contraption.</p>
]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=46</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Got an RX8? Replace your coils!</title>
		<link>http://alex.mordue.co.uk/blog/?p=31&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=got-an-rx8-replace-your-coils</link>
		<comments>http://alex.mordue.co.uk/blog/?p=31#comments</comments>
		<pubDate>Wed, 07 Jul 2010 01:24:48 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Cars]]></category>
		<category><![CDATA[Coils]]></category>
		<category><![CDATA[Grubby]]></category>
		<category><![CDATA[RX8]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=31</guid>
		<description><![CDATA[Really! Your rotary mechanical marvel may be dying]]></description>
			<content:encoded><![CDATA[<p>I own a Mazda RX8. It&#8217;s quite an unusual car in many ways, but it&#8217;s most unique feature is probably its engine. The engine is a Wankel rotary type, this means that instead of pistons and a crank it has an eccentric shaft (essentially a crank) about which two rotors rotate, each in its own elipsoid chamber. Anyway I wont go into the details of it here this video explains it much better and is jolly spiffing since it&#8217;s from the 60s:</p>
<p><object style="height: 344px; width: 425px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/lyItjvs8nvI" /><param name="allowfullscreen" value="true" /><embed style="height: 344px; width: 425px;" type="application/x-shockwave-flash" width="100" height="100" src="http://www.youtube.com/v/lyItjvs8nvI" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Anyway, the engine requires oil in the combustion chamber(s) to lubricate the rotors. Petrol dissolves the oil and which can lead to the rotors failing and you being left with a large bill. But what does this have to do with ignition coils?</p>
<h3>The Problem</h3>
<p>Due to the way rotary engines operate the coils are worked very hard. At 9000rpm the coils and spark plugs are sparking 150 times a second. This leads to them running rather hot which causes the insulation on the coil to break down which means a shorter path for the electricity to arc to where it&#8217;s not supposed to (somewhere other than the spark gap of the plug). Eventually the coil will fail and stop providing enough voltage to the spark plug, which means the spark plug is going to stop sparking.</p>
<ul>
<li>Less sparks = Less petrol being burned.</li>
<li>Less petrol being burned = More petrol on the rotor</li>
<li>More petrol on the rotor = Less oil on the rotor</li>
<li>Less oil on the rotor = More engine wear</li>
<li>More engine wear = Less happy owner</li>
</ul>
<h3>Solution</h3>
<p>Change your coils regularly, at the same frequency as your spark plugs (about every 3 years). My car had 28,000 miles on the clock and was just over 5 years old when I changed mine. They are fairly easy to change yourself, the main pain is removing the airbox and bellows to get at them, once that&#8217;s out of the way it&#8217;s just the matter of getting them connected up to the right leads.</p>
<p>They are very expensive from Mazda UK. Happily, however, you can buy a set of 4 of them from <a title="RotaryFX" href="http://www.rotaryfx.com/product_p/per1006.htm" target="_blank">Rotary FX</a> for the same price as Mazda UK will charge you for a single coil.</p>
<h3>What mine looked like</h3>
<p>All 4 looked like the picture below, 2 of them had failed completely when tested with a multimeter(both trailing plug coils). Since the replacement there&#8217;s not a lot of difference at low revs but higher up the rev range the difference is a lot more noticeable.</p>
<div id="attachment_34" class="wp-caption aligncenter" style="width: 624px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/rx8-badcoil.jpg"><img class="size-full wp-image-34" title="rx8-badcoil" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/rx8-badcoil.jpg" alt="" width="614" height="819" /></a><p class="wp-caption-text">Yuck, white spot on the coil where it has overheated</p></div>
]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Shift Registers to expand your output</title>
		<link>http://alex.mordue.co.uk/blog/?p=5&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-shift-registers-to-expand-your-output</link>
		<comments>http://alex.mordue.co.uk/blog/?p=5#comments</comments>
		<pubDate>Wed, 07 Jul 2010 00:40:10 +0000</pubDate>
		<dc:creator>alm</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Shift Register]]></category>

		<guid isPermaLink="false">http://alex.mordue.co.uk/blog/?p=5</guid>
		<description><![CDATA[Shift registers are fantastically useful little chips to use when you need a few more I/O pins than your microcontroller offers you. They essentially allow you to turn 3 output pins into 8!]]></description>
			<content:encoded><![CDATA[<p>Shift registers are fantastically useful little chips to use when you need a few more I/O pins than your microcontroller offers you.</p>
<p>They essentially allow you to turn 3 output pins into 8. So let&#8217;s have a look at a fairly normal shift register chip the ON MC74HC595A:</p>
<div id="attachment_12" class="wp-caption aligncenter" style="width: 645px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/MC74HC595-logic1.png"><img class="size-full wp-image-12" title="MC74HC595 Logic" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/MC74HC595-logic1.png" alt="" width="635" height="501" /></a><p class="wp-caption-text">Logical layout from the datasheet</p></div>
<h3>Inputs</h3>
<p>The inputs we&#8217;re interested in if we want to use this to expand the output of our microcontroller are:</p>
<ul>
<li>The Serial Data line</li>
<li>The Shift Clock</li>
<li>The Latch Clock</li>
</ul>
<p>Now you may be thinking what about the Reset line, what about Output Enable? Well we don&#8217;t really need to use these.</p>
<ul>
<li>Reset: Each time we shift data into the shift register we&#8217;ll be doing 8-bits at a time &#8220;overwriting&#8221; the previous values so reset isn&#8217;t really very valuable to us (we&#8217;d much rather that extra I/O pin on our uC). You&#8217;ll notice that the Reset line is an inverted input (see the little circle at the end of the line?) so we want our chip to always be not in the reset state so we just tie that pin high (to 5V in the case of this chip).</li>
<li>Output Enable: We want the chip to always have its outputs enabled. I&#8217;m guessing you&#8217;d rather have an extra uC I/O line than worry about the tiny amount of time at start up when the shift register has not been fed any values and so all its output are on. The line is again an inverted input so it&#8217;s really not Enable so we tie it to ground to have our outputs always on.</li>
</ul>
<h3>How do you work this thing?</h3>
<p>Well it&#8217;s pretty simple, whenever the chip detects a rising edge (i.e. from ground to +5V) on its shift clock input it shifts the bits current stored in the shift register along one (so the highest bit drops off the end to be lost forever) and the lowest bit of the shift register becomes whatever the serial data input line is currently set at. So we fill up our shift register one bit at a time until we have all 8 bits, once all of our new 8-bits are into the shift register we want to send a rising edge to the latch input, this will transfer the bits in the shift register onto our output pins (QA-QH) on the chip.</p>
<p>So in in pseudo code:</p>
<blockquote>
<pre>ShiftRegisterPort = 8bit value we want on the output of our shift register
for(bit=0;bit&lt;8;bit++){
  uC Shift Clock Pin = 0;
  uC Serial Data Pin = RegisterPort Bit (7-bit);
  uC Shift Clock Pin = 1;
}
uC Shift Clock Pin = 0;
uC Latch Clock Pin = 1;
uC Latch Clock Pin = 0;</pre>
</blockquote>
<p>The timing diagram looks a bit like this:</p>
<div id="attachment_13" class="wp-caption aligncenter" style="width: 791px"><a href="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/MC74HC595-timing1.png"><img class="size-full wp-image-13" title="MC74HC595 Timing" src="http://alex.mordue.co.uk/blog/wp-content/uploads/2010/07/MC74HC595-timing1.png" alt="" width="781" height="184" /></a><p class="wp-caption-text">Rough timing for writing to the chip</p></div>
<h3>That&#8217;s it</h3>
<p>And that&#8217;s pretty much it. If you are not too fussy about the state of your outputs you can even run this from 2 pins by tying the shift and latch clock lines together, this does give you a ripple effect as the bits are output as they are shifted into the shift register. If you do this you also have to clock 9 times (with the last data bit being ignored) as otherwise the 8th data bit is not latched from the shift register. For slowly changing outputs,  this could work quite well, however if you want to do PWM, for example, then you don&#8217;t really want your outputs rippling all the time as values are shifted along.</p>
]]></content:encoded>
			<wfw:commentRss>http://alex.mordue.co.uk/blog/?feed=rss2&#038;p=5</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

