<?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>Project Gus</title>
	<atom:link href="http://projectgus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://projectgus.com</link>
	<description>Might even work.</description>
	<lastBuildDate>Thu, 16 May 2013 02:14:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Unlocking an encrypted rootfs over ssh with Debian wheezy</title>
		<link>http://projectgus.com/2013/05/encrypted-rootfs-over-ssh-with-debian-wheezy/</link>
		<comments>http://projectgus.com/2013/05/encrypted-rootfs-over-ssh-with-debian-wheezy/#comments</comments>
		<pubDate>Thu, 16 May 2013 01:51:53 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1496</guid>
		<description><![CDATA[Problem: You have a computer running Debian 7.0 wheezy with an encrypted root filesystem. At startup you&#8217;d like to be able to unlock the disk over ssh, maybe because it runs headless. There are some existing solutions to this: early-ssh worked on previous Debian versions. There are other blog posts showing some methods but I [...]]]></description>
				<content:encoded><![CDATA[<p>Problem: You have a computer running Debian 7.0 wheezy with an encrypted root filesystem. At startup you&#8217;d like to be able to unlock the 
disk over ssh, maybe because it runs headless.</p>

<p><span id="more-1496"></span> 
There are some existing solutions to this: <a href="http://dev.kakaopor.hu/early-ssh/">early-ssh</a> worked on previous Debian versions. There are other <a href="http://blog.nguyenvq.com/2011/09/13/remote-unlocking-luks-encrypted-lvm-using-dropbear-ssh-in-ubuntu/">blog posts</a> showing some methods but I found them unwieldy (ie a 35 second delay before you can type your passphrase.)</p>

<p>Here&#8217;s how I&#8217;m doing it. Unless otherwise mentioned, all of the following commands need to be run as root. The server name in the examples is &#8220;debian_headless&#8221;</p>

<p>At time of writing I was using versions Debian 7.0 Wheezy with packages cryptsetup 2:1.4.3-4, initramfs-tools 0.109.1 and dropbear 2012.55-1.3.</p>

<p>These steps may work on recent Ubuntu versions as well, please let me know if you try them out.</p>

<h2>Overview</h2>

<p>The very first thing a Debian system runs at startup is a minimal <a href="http://wiki.debian.org/initramfs">initramfs</a> ramdisk which performs basic initialisation, mounts the main filesystem and starts the rest of the boot process.</p>

<p>This is the stage when an encrypted rootfs gets mounted. We need to customise it so we can ssh in and unlock the rootfs.</p>

<h2>Install prerequisites</h2>

<pre><code>apt-get install dropbear initramfs-tools busybox
</code></pre>

<p>Dropbear is a slimline SSH server. This package installs into the initramfs and runs during early boot only, allowing you to log in remotely.</p>

<h2>Authorise the user(s) you want to be able to login as root and unlock</h2>

<p>Hopefully you&#8217;re already using <a href="http://www.debian-administration.org/articles/530">SSH Key Authentication</a>, otherwise have a read about it and why it&#8217;s a good idea. Set it up for the user(s) on the client systems by having them run <code>ssh-keygen</code>.</p>

<p>You have to add the public keys for these users to Dropbear&#8217;s list of <code>authorized_keys</code> for login.</p>

<p>For each client user you want to allow to unlock, take their public key file <code>~/.ssh/id_rsa.pub</code> and append it to <code>/etc/initramfs-tools/root/.ssh/authorized_keys</code></p>

<p>One way of doing it:</p>

<pre><code>scp ~/.ssh/id_rsa.pub myuser@debian_headless:id_rsa.pub
ssh myuser@debian_headless
sudo sh -c "cat id_rsa.pub &gt;&gt; /etc/initramfs-tools/root/.ssh/authorized_keys"
rm id_rsa.pub
</code></pre>

<h3>Alternative: Have a unique key for root/unlock</h3>

<p>If you don&#8217;t want to use your usual user-level ssh key and passphrase to provide potential root-level access to your headless machine, generate a separate key (with a different passphrase) and then copy it across to authorized_keys instead:</p>

<pre><code>ssh-keygen -f ~/.ssh/id_rsa_headlessunlock
scp ~/.ssh/id_rsa_headlessunlock.pub myuser@debian_headless:id_rsa.pub
(etc, as above.)
</code></pre>

<h2>Add network hardware module</h2>

<p>The initramfs doesn&#8217;t usually load network hardware modules, so you should add the name of the network hardware module directly to <code>/etc/initramfs-tools/modules</code></p>

<p>You can find the module name via sysfs. For example:</p>

<pre><code>$ grep DRIVER /sys/class/net/eth0/device/uevent
DRIVER=e1000
</code></pre>

<p>So to enable <em>eth0</em> in this case, you&#8217;d add <em>e1000</em> to <code>/etc/initramfs-tools/modules</code>.</p>

<p>(This may not be necessary on &#8220;normal&#8221; x86 machines with built-in ethernet, it&#8217;s definitely necessary using USB Ethernet on my ARM-based GK802 stick and it&#8217;s probably necessary on Raspberry Pi.)</p>

<h2>Configure early boot IP Address</h2>

<p>Initramfs needs to know the IP address to come up on. You could do this by passing the &#8216;ip=&#8217; kernel command line parameter, but you can also just set it in an initramfs-tools config file:</p>

<p>Create <code>/etc/initramfs-tools/conf.d/network_config</code> with contents like this:</p>

<pre><code>export IP=&lt;client-ip&gt;:&lt;server-ip&gt;:&lt;gw-ip&gt;:&lt;netmask&gt;:&lt;hostname&gt;:&lt;device&gt;:&lt;autoconf&gt;
</code></pre>

<p><code>&lt;server-ip&gt;</code> can be left blank. Some possible examples:</p>

<pre><code>export IP=dhcp
</code></pre>

<p>or</p>

<pre><code>export IP=10.0.0.2::10.0.0.1:255.0.0.0:myserver:eth0
</code></pre>

<p>See the <a href="https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt">nfsroot kernel docs</a> for full details. Remember if using DHCP that you&#8217;ll need a static DHCP entry configured so you can predict what IP your headless machine is going to have on startup.</p>

<h3>Annoyance: Interface doesn&#8217;t reconfigure</h3>

<p>It seems that after the main system boots, the network interface won&#8217;t automatically change to whatever is set in <code>/etc/network/interfaces</code> (because the interface is seen to be already &#8220;up&#8221; it gets left alone.) To work around this you could put a line <em>ifdown eth0; ifup eth0</em> in <code>/etc/rc.local</code>, or just keep the initramfs network settings the same as the ones in <code>/etc/network/interfaces</code>.</p>

<h2>Unlock Script</h2>

<p>I&#8217;ve written a little initramfs-tools hook that generates scripts for easy unlocking of the rootfs.</p>

<p><a href="/files/headless_cryptroot/mount_cryptroot">Download this script file</a>, then <em>read it to make sure you&#8217;re not suspicious about what it&#8217;s going to do</em>. Then copy it to <code>/etc/initramfs-tools/hooks/mount_cryptroot</code> and mark it executable:</p>

<pre><code>chmod +x /etc/initramfs-tools/hooks/mount_cryptroot
</code></pre>

<p>There&#8217;s a section at the top of mount_cryptroot that allows you to set an ALLOW_SHELL variable if you want to be able to drop to a remote root shell for diagnostics. Note that this explicitly allows a remote root shell to anyone with an authorised SSH private key. I can&#8217;t guarantee it&#8217;s impossible to get to a root shell otherwise, but it&#8217;s at least not explicitly welcomed.</p>

<h2>Update the initramfs</h2>

<p>Update the initramfs so it includes all your changes:</p>

<pre><code>update-initramfs -u
</code></pre>

<h2>Add client SSH config entry</h2>

<p>Because Dropbear has a different SSH host key to the normal system, OpenSSH will (rightly) complain if you try connecting to it on the same IP. The solution is to create a special host definition for the initramfs environment. A custom section in <code>~/.ssh/config</code>:</p>

<pre><code>Host headless_unlock
HostName &lt;IP of headless&gt;
User root
HostKeyAlias headless_unlock
</code></pre>

<p>Now you can log in to the unlock stage by simply typing <em>ssh headless_unlock</em>. (Replace headless with whatever name you want to use.)</p>

<p>If you authorized a unique private key to use for unlocking, you can add another line <code>IdentityFile ~/.ssh/id_rsa_headless</code> or similar.</p>

<h2>Putting it all together</h2>

<p>Here&#8217;s what it looks like to connect to my headless host and unlock the disk:</p>

<pre><code>$ ssh headless_unlock

BusyBox v1.20.2 (Debian 1:1.20.0-7) built-in shell (ash)
Enter 'help' for a list of built-in commands.

Unlocking rootfs...
Enter passphrase: 
Success
Connection to 192.168.56.101 closed.
</code></pre>

<p>Easy!</p>

<h1>Final word about security</h1>

<p>When dealing with remote access and with encryption, it&#8217;s always worth thinking about security tradeoffs.</p>

<p>There&#8217;s the obvious risk that enabling Dropbear in the initramfs means allowing remote root logins to your system. Even with ALLOW_SHELL turned off there&#8217;s no guarantee that someone with access to an authorized SSH key (or Dropbear exploit) can&#8217;t log in, pop a root shell somehow, and cause havoc.</p>

<p>In addition, when I was looking for existing techniques to do this I came across a post exclaiming ssh unlocking was a terrible idea, because someone with physical access to your machine can then impersonate you remotely and you&#8217;ll never know.</p>

<p>I think this is worth considering, but it&#8217;s not as bad as it might seem. All encrypted disk access, with local or remote unlocking, relies on physical security of your device. Yes, if someone gets physical or root access they can steal your Dropbear host key and set up another server that pretends to be you and steals your keys. However, they already have <em>physical or root access</em>. They can just as easily insert malware in the initramfs that quietly captures your passphrase as you type it in in locally.</p>

<p>In either case, you have to be sufficiently sure noone is messing with you. With remote access that&#8217;s maybe more likely, but I&#8217;m not too worried. I&#8217;m using this on a USB stick PC that fits in my pocket, and I don&#8217;t want a burglar walking out my door with all my personal data. If some very dedicated person comes after my data, <a href="http://xkcd.com/538/">there would be easier ways to get it</a>.</p>

<p>(Also, an obvious disclaimer &#8211; all the advice/scripts on this page is worth what you paid for it. I&#8217;m not a security professional. Please tell me if it seems broken/unsafe, but don&#8217;t blame me if you use it for something important and it isn&#8217;t safe enough.)</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2013/05/encrypted-rootfs-over-ssh-with-debian-wheezy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LG USB Hub</title>
		<link>http://projectgus.com/2013/05/lg-usb-hub/</link>
		<comments>http://projectgus.com/2013/05/lg-usb-hub/#comments</comments>
		<pubDate>Wed, 15 May 2013 02:51:03 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[quick post]]></category>
		<category><![CDATA[warranty voiding]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1498</guid>
		<description><![CDATA[I bought this LG branded USB 2.0 Hub for $10 from PCDIY. Seems to be an LG promotional item that PCDIY decided to resell. (I don&#8217;t mind, it works properly in Linux unlike most cheap hubs.) However, the form factor is kinda big and the LG logo is pretty bright. A popular alternative to security [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-1.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-1-300x225.jpg" alt="LG cube hub, rubber duck shown for scale" width="300" height="225" class="size-medium wp-image-1499" /></a></p>

<p>I bought this LG branded USB 2.0 Hub for $10 from PCDIY.</p>

<p>Seems to be an LG promotional item that PCDIY decided to resell. (I don&#8217;t mind, it works properly in Linux unlike most cheap hubs.)</p>

<p>However, the form factor is kinda big and the LG logo is pretty bright.</p>

<p><span id="more-1498"></span> 
<a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-2.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-2-300x251.jpg" alt="Base screws" width="300" height="251" class="size-medium wp-image-1500" /></a></p>

<p>A popular alternative to security bits: screws so soft they attempt to disintegrate when you unscrew them.</p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-3.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-3-300x230.jpg" alt="Hub important part" width="300" height="230" class="size-medium wp-image-1501" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-5.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-5-300x226.jpg" alt="PCB Top" width="300" height="226" class="size-medium wp-image-1503" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-4.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-4-300x248.jpg" alt="PCB Bottom" width="300" height="248" class="size-medium wp-image-1502" /></a>
Eck.</p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-6.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-6-300x272.jpg" alt="Leftover cube inner" width="300" height="272" class="size-medium wp-image-1504" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-7.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-7-300x264.jpg" alt="Repackaged base" width="300" height="264" class="size-medium wp-image-1505" /></a></p>

<p>Screwed back together&#8230;</p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-8.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-8-300x257.jpg" alt="Base with LED on" width="300" height="257" class="size-medium wp-image-1506" /></a></p>

<p>Bit bright&#8230;</p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-9.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-9-300x238.jpg" alt="Base with sticker" width="300" height="238" class="size-medium wp-image-1507" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2013/05/lghub-10.jpg" rel="shadowbox[sbpost-1498];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/05/lghub-10-300x233.jpg" alt="LED on with sticker" width="300" height="233" class="size-medium wp-image-1508" /></a></p>

<p>Much nicer. Sticker was from <a href="http://thisisnotart.org/">This Is Not Art</a> Festival a few years ago.</p>

<p>Next week: Turning an Macbook Pro into a Macbook Air via clever application of sew-on patches.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2013/05/lg-usb-hub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anatomy of a cheap USB to Ethernet adapter</title>
		<link>http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/</link>
		<comments>http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 01:00:49 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shanzhai]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1431</guid>
		<description><![CDATA[Taking apart a very cheap USB to Ethernet adapter and pondering on the parts found inside.]]></description>
				<content:encoded><![CDATA[<p>Taking apart a very cheap USB to Ethernet adapter and pondering on the parts found inside.</p>
<p>Here are two USB to Ethernet adapters:</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9473.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9473-150x150.jpg" alt="More side by side" width="150" height="150" class="size-thumbnail wp-image-1409" /></a><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9472.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9472-150x150.jpg" alt="More side by side. In the defence of the cheap adapter, it&#039;d been apart 3 times by this point." width="150" height="150" class="size-thumbnail wp-image-1408" /></a><br />
<a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9470.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9470-300x198.jpg" alt="Adapters side by side" width="300" height="198" class="size-medium wp-image-1407" /></a>
</p>
<p>One of them is sold on ebay for $3.85 AU ($3.99 US), including postage to Australia. The other is sold at Apple Stores for $29.<sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_0_1431" id="identifier_0_1431" class="footnote-link footnote-identifier-link" title="Model MC704ZM / A1277">1</a></sup></p>
<p><span id="more-1431"></span></p>
<p>In Linux they both use the driver for an &#8220;ASIX AX88772A&#8221; USB to Ethernet converter, even though the Apple one reports as &#8220;Apple&#8221; and is sold only for the MacBook Air.<sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_1_1431" id="identifier_1_1431" class="footnote-link footnote-identifier-link" title="Internet lore seems to agree that any Mac running OS X 10.5.2 or later can use it.">2</a></sup></p>
<p>The cheap adapter comes with drivers for OS X &amp; Windows, as well.</p>
<p>When I ran a TCP throughput test with <a href="http://iperf.sourceforge.net/">iperf</a>, they both performed well. The Apple adapter measured throughput of 94.3Mbps. The cheap adapter measured 87.4Mbps. By comparison, the builtin ethernet on my laptop measured 94.8Mbps (after being set from gigabit to 100Mbps.)</p>
<h1>Oddities</h1>
<p>There are a few unusual things about the cheap adapter, though. The Linux kernel log says:</p>
<pre><code>usb 3-2.1.2: New USB device found, idVendor=0b95, idProduct=772a
usb 3-2.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-2.1.2: Product: AX88x72A
usb 3-2.1.2: Manufacturer: ASIX Elec. Corp.
usb 3-2.1.2: SerialNumber: 000002
eth1: register 'asix' at usb-0000:0e:00.0-2.1.2, ASIX AX88772 USB 2.0 Ethernet, 00:8a:8d:8a:39:2b
</code></pre>
<p>Serial number &#8220;000002&#8243;? Hmm&#8230;</p>
<p>Also, the hardware MAC address prefix (00:8a:8d) isn&#8217;t any known <a href="http://standards.ieee.org/develop/regauth/oui/public.html">vendor OUI</a> (organisationally unique identifier.) Seems odd, although chipset vendors (like ASIX) often require the device manufacturer to register their own OUI (for instance the Apple adapter uses an Apple prefix.) For a no-name vendor, it makes sense to just make one up.</p>
<h1>Spot the difference</h1>
<p>Here&#8217;s a view inside the cheap adapter:</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9489.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9489-300x101.jpg" alt="PCB Top - Marked RD6877-V1.0-20121025" width="300" height="101" class="aligncenter size-medium wp-image-1415" /></a></p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9490.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9490-300x105.jpg" alt="PCB Bottom" width="300" height="105" class="aligncenter size-medium wp-image-1416" /></a></p>
<p>Inside the Apple adapter:</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9477.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9477-300x115.jpg" alt="Apple adapter with EMI shielding" width="300" height="115" class="aligncenter size-medium wp-image-1411" /></a></p>
<p>It seems $29 buys you shielding from interference. Underneath the cover:</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9487.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9487-300x101.jpg" alt="Apple adapter - PCB Top" width="300" height="101" class="aligncenter size-medium wp-image-1413" /></a></p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9488.jpg" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-9488-300x99.jpg" alt="Apple adapter - PCB bottom" width="300" height="99" class="aligncenter size-medium wp-image-1414" /></a></p>
<p>Some similarities are visible:</p>
<ul>
<li>Both adapters have a 512 byte EEPROM onboard (Atmel AT93C66B.)<sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_2_1431" id="identifier_2_1431" class="footnote-link footnote-identifier-link" title="Actually the part markings on the cheap adapter&rsquo;s EEPROM don&rsquo;t match Atmel&rsquo;s datasheet, so it&rsquo;s possible that one is a clone, rebadged, or old stock.">3</a></sup></li>
<li>Both adapters have an Ethernet transformer to isolate the ethernet signals from the rest of the board (MEC TM1701M &amp; LFE8423, respectively.)</li>
</ul>
<p>The biggest difference is this: the Apple adapter contains a clearly labelled ASIX AX88772ALF USB to Ethernet bridge, the other adapter has an unmarked chip that is not made by ASIX.</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-asics-e1363733599184.png" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-asics-e1363733599184-300x143.png" alt="Two ICs side by side" width="300" height="143" class="aligncenter size-medium wp-image-1438" /></a></p>
<p>ASIX don&#8217;t make any USB/Ethernet devices in a 32 pin package, their smallest package has <a href="http://www.asix.com.tw/products.php?op=ProductList&amp;PLine=71&amp;PSeries=101">64 pins</a>, same as the genuine one above.</p>
<p>It&#8217;s a clone!</p>
<h1>A clever clone</h1>
<p>Cloning <a href="https://en.wikipedia.org/wiki/Application-specific_integrated_circuit">ASIC</a>s isn&#8217;t new to the computer world. They&#8217;ve been around since <a href="http://www.applelogic.org/ABitABouttheClonerASICs.html">the early 80s, maybe earlier</a>.</p>
<p>This is not a simple copy, though. It&#8217;s been modified to make it much cheaper to produce. It might even be a brand new ASIC, created from scratch to be compatible.</p>
<p>To know if it is a modified knockoff or made from scratch we could dissolve the chip packages in acid (&#8220;decapping&#8221; them) and then look at the exposed silicon die under a microscope. Not quite that keen yet, though.</p>
<h1>Clock Sync</h1>
<p>The genuine AX88772A requires two crystal oscillators for accurate timing &#8211; a 25MHz oscillator for the ethernet interface clock, and a 12MHz oscillator for the USB interface clock. The cheap adapter only has a single 25MHz crystal.</p>
<p><a href="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-oscillators.png" rel="shadowbox[sbpost-1431];player=img;"><img src="http://projectgus.com/wp-content/uploads/2013/03/usbethernet-oscillators-300x192.png" alt="Oscillators" width="300" height="192" class="aligncenter size-medium wp-image-1439" /></a></p>
<p>How much does this save? A lot. The Apple adapter has two &#8220;TXC&#8221; brand oscillators (the shiny silver packages.) <del>These cost around $1.33 each if you buy 15,000</del><sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_3_1431" id="identifier_3_1431" class="footnote-link footnote-identifier-link" title="Not the same oscillators but the same brand, meeting the spec that ASIX requires: 25MHz &amp; 12MHz. Of course both Apple and our noname manufacturer would pay less than Digikey&rsquo;s prices, but it gives you some idea.">4</a></sup>. <del>This wholesale cost alone is nearly the <a href="http://item.taobao.com/item.htm?spm=a230r.1.14.99.axQ750&amp;id=20028812096">retail price of the cheap adapter on taobao.com</a>.</del></p>
<p>By comparison, a single large crystal resonator like the one on the cheap adapter costs <a href="http://www.digikey.com/product-detail/en/9B-25.000MAAI-B/887-1621-ND/2811958">$0.16</a> from the same source (<del>6%</del> <em>20%, see below,</em> of the cost.)</p>
<p><em>EDIT: Someone on <a href="http://www.reddit.com/r/electronics/comments/1an0bj/anatomy_of_a_cheap_usb_to_ethernet_adapter/">reddit</a> pointed out that I was using &#8216;oscillator&#8217; incorrectly to refer to the large crystal, which is only the resonator part of an oscillator circuit. Fixed!</em></p>
<p><em>EDIT 2: Gerard points out in the comments that the two TXC chips are probably just crystal resonators (not full oscillators) as well. I checked the reference schematic for <a href="http://www.asix.com.tw/products.php?op=pItemdetail&amp;PItemID=97;71;101&amp;PLine=71">ASIX&#8217;s Demoboard</a> and he&#8217;s right. Thanks Gerard! So the cheapest ones they could be are around $0.40 each (<a href="http://www.digikey.com/product-detail/en/7V-12.000MAAE-T/887-1458-2-ND/2626974">12MHz</a>/<a href="http://www.digikey.com/product-detail/en/7V-25.000MAAE-T/887-1467-2-ND/2626983">25MHz</a>), the cheaper board&#8217;s single crystal is then closer to 20% of the cost.</em></p>
<p>In the genuine chip, the 12MHz frequency would be used to derive 480MHz for USB 2.0 High Speed by using a <a href="https://en.wikipedia.org/wiki/Frequency_multiplier#Phase-locked_loops_with_frequency_dividers">PLL frequency multipler circuit</a>. 12 x 40 = 480.</p>
<p>In the cheap one, I&#8217;m guessing the host&#8217;s <a href="http://www.beyondlogic.org/usbnutshell/usb3.shtml">packet sync</a> must be used to synchronise the 480MHz clock. Without a high speed oscilloscope or a USB 2.0 logic analyser it&#8217;d be hard to tell how well this goes at meeting the 480MHz +/-500ppm requirement of the USB High Speed spec.<sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_4_1431" id="identifier_4_1431" class="footnote-link footnote-identifier-link" title="I think the Linux kernel could know the raw USB bit error rate, giving some idea of how precise the timing was, but the kernel doesn&rsquo;t record it anywhere">5</a></sup> ASIX themselves warn that if their precision 12MHz clock source has an incorrect capacitor it &#8220;<a href="http://www.asix.com.tw/download.php?sub=applicationdetail&amp;PItemID=86">can cause some problem during USB High Speed mode enumeration. For example, during the 100 times of repeatedly plug-and-unplug test, there may be 1 time that AX88772 may not be initialized properly</a>&#8220;. You&#8217;d imagine this kind of problem is potentially much worse in the cheap adapter, although I haven&#8217;t yet noticed anything.</p>
<h1>Parts Count</h1>
<p>The Apple adapter also has many more small components – two inductors (the cheap adapter has none), over twenty five capacitors (the cheap adapter has only nineteen), more resistors. For the cheap adapter design, every fraction of a cent saved is important!</p>
<p>One thing that surprised me is that the cheap adapter has a functioning blue activity LED, that glows through the enclosure. The Apple adapter actually has a space on the PCB for this, but no LED in place (Apple&#8217;s designers presumably nixed it for aesthetic reasons.) I&#8217;m surprised the manufacturer paid the few cents to add this feature.</p>
<h1>Software</h1>
<p>For the manufacturer of cloned/compatible ASICs, an interesting bonus<sup><a href="http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/#footnote_5_1431" id="identifier_5_1431" class="footnote-link footnote-identifier-link" title="Assuming you can ignore copyright law, and have no qualms about reproducing other companies&rsquo; intellectual property for profit">6</a></sup> is driver support. The CD that came with the cheap adapter contains ASIX&#8217;s own drivers for Windows and OS X.</p>
<p>The Windows drivers are the exact same digitally signed ones that Microsoft distributes through Windows Update, meaning the adapters appear to have &#8220;passed&#8221; Windows Hardware Quality Labs testing. Something the actual device manufacturer surely couldn&#8217;t have afforded.</p>
<h1>Reliability</h1>
<p>In my simple tests both adapters seemed perfectly reliable, moving data back and forth quickly without any measurable errors. I ran an eight hour two-way ping flood (assuring plenty of collisions) with zero lost packets.</p>
<p>However, the cheap adapter is probably susceptible to (and a producer of) electrical noise. The Apple adapter is protected from an electrically noisy environment by its metal shielding, and extra decoupling capacitors on the board.</p>
<p>On the other hand, both USB and Ethernet contain mechanisms for dealing with errors introduced by interference. It&#8217;s possible the protocols are well engineered enough that you&#8217;ll never notice the difference.</p>
<p>It is also possible that the cloned ASIC will display hardware bugs that aren&#8217;t in the legitimate adapter. So far I haven&#8217;t found any (I tested some of the uncommon features like forcing 10Mbps, forcing half duplex, adjusting MTU.) I&#8217;d be interested to hear of any, though.</p>
<h1>Conclusion</h1>
<p>I&#8217;m probably unusual in that I find this world of cheap clone &#8220;shanzhai&#8221; hardware amazing. I&#8217;m fascinated that someone is out there redesigning existing silicon to make a knockoff that is smaller, cheaper but otherwise near-equivalent &#8211; to be used in devices that retail for less than $3.</p>
<p>I&#8217;d love to learn more about these secretive industries and the engineers who work in them.</p>
<p>How about you? Do you have any experience with dirt cheap hardware devices? How do you feel about shanzhai competing with regular firms&#8217; R&amp;D by cloning their hardware? Please leave a comment and let me know what you think.</p>
<p><br/><br/>
<ol class="footnotes">
<li id="footnote_0_1431" class="footnote">Model MC704ZM / A1277</li>
<li id="footnote_1_1431" class="footnote">Internet lore seems to agree that any Mac running OS X 10.5.2 or later can use it.</li>
<li id="footnote_2_1431" class="footnote">Actually the part markings on the cheap adapter&#8217;s EEPROM don&#8217;t match Atmel&#8217;s datasheet, so it&#8217;s possible that one is a clone, rebadged, or old stock.</li>
<li id="footnote_3_1431" class="footnote">Not the same oscillators but the same brand, meeting the spec that ASIX requires: <a href="http://www.digikey.com/product-detail/en/7X-25.000MBB-T/887-1219-2-ND/2118903">25MHz</a> &amp; <a href="http://www.digikey.com/product-detail/en/7X-12.000MBB-T/887-1214-2-ND/2118898">12MHz</a>. Of course both Apple and our noname manufacturer would pay less than Digikey&#8217;s prices, but it gives you some idea.</li>
<li id="footnote_4_1431" class="footnote">I think the Linux kernel could know the raw USB bit error rate, giving some idea of how precise the timing was, but the kernel <a href="http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg39337.html">doesn&#8217;t record it anywhere</a></li>
<li id="footnote_5_1431" class="footnote">Assuming you can ignore copyright law, and have no qualms about reproducing other companies&#8217; intellectual property for profit</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2013/03/anatomy-of-a-cheap-usb-ethernet-adapter/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Rep Rap Pro Huxley Extruder Upgrade</title>
		<link>http://projectgus.com/2012/10/rep-rap-pro-huxley-extruder-upgrade/</link>
		<comments>http://projectgus.com/2012/10/rep-rap-pro-huxley-extruder-upgrade/#comments</comments>
		<pubDate>Wed, 31 Oct 2012 11:02:22 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[3d printing]]></category>
		<category><![CDATA[make hack void]]></category>
		<category><![CDATA[reprap]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1329</guid>
		<description><![CDATA[At Make, Hack, Void we&#8217;ve had a Rep Rap Pro Huxley 3d printer since the beginning of the year. Unfortunately we&#8217;ve also struggled with a couple of long-standing problems. One of them is the PTFE &#8220;bowden tube&#8221; that encloses the filament between the extruder drive and the hot end. In the stock design, the tube [...]]]></description>
				<content:encoded><![CDATA[<p>At <a href="http://www.makehackvoid.com/">Make, Hack, Void</a> we&#8217;ve had a Rep Rap Pro Huxley 3d printer since the beginning of the year.</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9099.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9099-225x300.jpg" alt="" title="Jess printing a Domo-kun cookie cutter" width="225" height="300" class="size-medium wp-image-1347" /></a></p>

<p>Unfortunately we&#8217;ve also struggled with a couple of long-standing problems. <span id="more-1329"></span>One of them is the PTFE &#8220;bowden tube&#8221; that encloses the filament between the extruder drive and the hot end. In the stock design, the tube is screwed into two threaded brass fittings at each end. Forcing the tube into the fitting makes a thread, it&#8217;s kind of &#8220;self-tapping.&#8221;</p>

<p>On some Huxleys this seems to hold firm, but ours popped out at the drive end repeatedly. Rethreading, glue, epoxy all failed. Ryan&#8217;s clever stop-gap worked for a while but put a lot of load on the extruder drive motor:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9242-2.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9242-2-225x300.jpg" alt="Ryan&#039;s stop-gap extruder fix" title="IMG_9242-2" width="225" height="300" class="aligncenter size-medium wp-image-1330" /></a></p>

<p>This is a modification of the Rep Rap Pro Huxley design to use push-to-fit pneumatic connectors instead of the brass fittings:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/temp.png" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/temp-300x97.png" alt="OpenSCAD render of new parts" title="OpenSCADrender" width="300" height="97" class="aligncenter size-medium wp-image-1369" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9909.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9909-223x300.jpg" alt="" title="Upgraded extruder components" width="223" height="300" class="aligncenter size-medium wp-image-1360" /></a></p>

<p>The design is inspired by <a href="http://www.thingiverse.com/thing:17234">DeuxVis&#8217; Bowden cable push-fit connectors</a>, but DeuxVis&#8217; part doesn&#8217;t fit the Rep Rap Pro variant of the Huxley.</p>

<h1>Better Alternative?</h1>

<p>While writing this post just now (isn&#8217;t this always the way) I&#8217;ve found that eMaker is furnishing their Huxleys with <a href="http://www.emakershop.com/browse/listing?l=237">pneumatic fittings that you can buy individually from them</a>. They look like they&#8217;re small enough to not require a redesigned hot end. I hope these weren&#8217;t available when I started this project back in August, I searched a lot! If you&#8217;re looking at options you may do well with those smaller fittings and less other changes, depending on what availability &amp; your requirements are.</p>

<p>Nevertheless, here are the instructions if you want to go the Make, Hack, Void way:</p>

<h1>New Parts Required</h1>

<ul>
<li><p>2 printed parts, M6-Block &amp; nozzle-mounting. You can <a href="http://www.thingiverse.com/thing:33337">get them from Thingiverse</a>.</p></li>
<li><p>2 40mm M3 screws, which replace the <a href="http://www.reprap.org/wiki/RepRapPro_Huxley_hot_end_assembly#Step_2:_The_cooling_system">the original 25mm vertical screws holding the nozzle-mounting to the aluminium heat block</a>.</p></li>
<li><p>2 20mm M3 screws, these replace the 2 16mm screws that are used to mount the blue heatsink to the aluminium heat block. I think 25mm screws should also fit.</p></li>
<li><p>Heat sink thermal compound (may be unnecessary, see below.)</p></li>
<li><p>1 small piece (no smaller than 38x8mm) of 2mm thick copper plate, or 2mm thick aluminium if copper isn&#8217;t available. You can go a bit thinner than 2mm if you like, down to about 1.1mm, but you&#8217;ll need to be more careful when assembling (see below.)</p></li>
<li><p>2 push-to-fit connectors. I used Parker Prestolok F8PB4M5, RS Components part number <a href="https://australia.rs-online.com/web/p/pneumatic-straight-threaded-to-tube-adaptors/2873490">287-3490</a> (link goes to the Australian RS site.) These are specified to hold 4mm PTFE tubing against up to 300psi of pneumatic pressure, at temperatures up to 100°C.</p></li>
<li><p>1 M5 nut, standard height.</p></li>
<li><p>30cm or so of PTFE tubing, 2mm ID 4mm OD. Our Huxley came with 3mm OD tubing, so we needed to swap. This is hard to get in Australia, easy to get in the US from places like McMaster-Carr. I was lucky that Andrew from the Campbell (Sydney) hackerspace was ordering a big lot from Aliexpress, so I paid for a 3m share in his order.</p></li>
</ul>

<h1>Cold end &#8211; extruder drive</h1>

<p>Preparing the extruder drive is exactly the same as the <a href="http://www.reprap.org/wiki/RepRapPro_Huxley_extruder_drive_assembly">stock RepRap Pro extruder drive assembly</a>, only swapping out the &#8220;M6 Block&#8221; (ie the main body of the extruder drive) for the new printed one.</p>

<p>When you&#8217;re done, drop the M5 nut into the nut recess and then screw one of the two push-to-fit connectors into it:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/extruderdrive.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/extruderdrive-280x300.jpg" alt="Complete Extruder Drive" title="extruderdrive" width="280" height="300" class="aligncenter size-medium wp-image-1331" /></a></p>

<p>The hot end preparation varies quite a bit from the <a href="http://www.reprap.org/wiki/RepRapPro_Huxley_hot_end_assembly">standard instructions</a>, however. Here it is step by step:</p>

<h1>Making the copper spacer</h1>

<p>When you screw the push-to-fit fitting into the aluminium heat block, it will foul on the blue heatsink. The 2mm copper (or aluminium) plate is a spacer to sit behind the heatsink.</p>

<p>You&#8217;re looking to make a plate that matches this face from the heat block, 38x8mm with 2 3mm holes placed, centered 3mm from each end:</p>

<div id="attachment_1332" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/10/Screenshot-291012-214420.png" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/Screenshot-291012-214420-300x205.png" alt="Detail from &quot;heatsink block.pdf&quot; Huxley design" title="heatsink block detail" width="300" height="205" class="size-medium wp-image-1332" /></a><p class="wp-caption-text">Detail from &#8220;heatsink block.pdf&#8221; in original Huxley plans</p></div>

<p>I used a piece of 2mm copper scrap with the drill press and hacksaw in the hackerspace:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9816.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9816-300x146.jpg" alt="Copper spacer plate" title="IMG_9816" width="300" height="146" class="aligncenter size-medium wp-image-1334" /></a></p>

<p>As you can see it doesn&#8217;t need to be too exact, there&#8217;s quite a bit of room at each side. The most important thing is getting the hole spacing correct (centres should be 32mm apart.)</p>

<p>Of course, if you were machining the Huxley parts from scratch then you could just modify the whole &#8220;heatsink block&#8221; part to use 10mm bar stock instead of 8mm bar stock, and adjust the drill hole offsets accordingly.</p>

<h1>Preparation</h1>

<p>Start by filing any irregularities on the printed nozzle mounting. In particular, the pathways for the two tall vertical screws need to be perfectly parallel so they can screw into the aluminium heater block as shown:</p>

<div class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9835.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9835-250x300.jpg" alt="Push to fit connector installed!" title="IMG_9835" width="250" height="300" class="aligncenter size-medium wp-image-1338" /></a><p class="wp-caption-text">This is what it looks like fully assembled, note the parallel long vertical bolts.</p></div>

<p>Filing the printed material in-situ is a real pain, so if possible line all these parts up on the bench and make sure they&#8217;ll fit.</p>

<p>Take care not to file too much material, though, because those bolt pathways have to hold the hot end tight against the mounting.</p>

<h1>Assembling the nozzle mounting</h1>

<p>After removing the old nozzle mounting, start by screwing the new printed piece into the X carriage, using the same 4 self-tapper screws that held on the old piece:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9831.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9831-300x285.jpg" alt="Installed nozzle mounting" title="IMG_9831" width="300" height="285" class="aligncenter size-medium wp-image-1335" /></a></p>

<h2>Connector</h2>

<p>Next, remove the machined brass fitting from the aluminium heat block and screw in the push-to-fit connector:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9827.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9827-300x267.jpg" alt="Push to fit connector pushed in" title="IMG_9827" width="300" height="267" class="aligncenter size-medium wp-image-1336" /></a></p>

<p>To tighten the connector against the nozzle, use the same technique as the original hot end: First, screw in the two parts until they touch. Then unscrew the push to fit connector by 1/4 turn, screw in the nozzle to match it again, and finally tighten the push to fit connector down against the nozzle. You can use a 10mm spanner for this.</p>

<p>If your spacer is less than 2mm thick then it&#8217;s a good idea to check now that the push-to-fit connector doesn&#8217;t stick out any further than it. If it does, you&#8217;ll need to tweak the angle of the nozzle so the connector ends up flatter when you tighten it down (when fully flat it only sits 1mm proud of the aluminium block.)</p>

<p>With a 2mm spacer there should be heaps of room regardless of angle, as you can see:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9830.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9830-246x300.jpg" alt="Push-to-fit and spacer, showing lots of room" title="IMG_9830" width="246" height="300" class="aligncenter size-medium wp-image-1337" /></a></p>

<h2>PTFE Spacer</h2>

<p>At this point, you&#8217;ll need to take a sharp knife to the white PTFE spacer that sits on top of the heater block. Cut it into 3 pieces, cutting as close as you can to each of the two small holes while leaving them intact:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9833.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9833-300x139.jpg" alt="Chopped up PTFE" title="IMG_9833" width="300" height="139" class="aligncenter size-medium wp-image-1340" /></a></p>

<p>The middle piece is no longer needed, but the two end pieces are.</p>

<h2>Attach hot end</h2>

<p>Now you can use the two long vertical bolts to screw in the push-to-fit connector against the printed nozzle mounting, sandwiching in the two ends of the white PTFE spacer:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9835.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9835-250x300.jpg" alt="Push to fit connector installed!" title="IMG_9835" width="250" height="300" class="aligncenter size-medium wp-image-1338" /></a></p>

<p>At this point you&#8217;ll want to hope that your pre-installation filing went well, or (like me) you&#8217;ll be awkwardly filing the bolt passageways in-situ so they come out parallel.</p>

<p>Once the mounting bolts are tightened, you can push in the filament tube:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9836.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9836-300x297.jpg" alt="Filament tube installed" title="IMG_9836" width="300" height="297" class="aligncenter size-medium wp-image-1339" /></a></p>

<p>Nearly done!</p>

<h2>Heatsink Install</h2>

<p>Finally, install the blue heatsink and spacer, using new M3 mounting bolts because the old ones aren&#8217;t quite long enough:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9838.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9838-186x300.jpg" alt="Heatsink ready for installation" title="IMG_9838" width="186" height="300" class="aligncenter size-medium wp-image-1341" /></a></p>

<p>The whole thing should fit up snugly as shown:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9839.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9839-289x300.jpg" alt="Heatsink bolted on" title="IMG_9839" width="289" height="300" class="aligncenter size-medium wp-image-1342" /></a></p>

<h1>A note about cooling</h1>

<p>When I installed the heatsink, I made a point of cleaning the old mounting tape off the mating surface and then applying a very thin layer of good quality thermal heatsink compound between each mating face. I was quite worried that the push-to-fit connector might get too warm if the heat block wasn&#8217;t cooled efficiently enough.</p>

<p>Turns out I over-compensated and the newly assembly hot end was too effectively cooled! It couldn&#8217;t reach 240° for printing ABS, it would reach equilibrium at about 230°. I had to take the heatsink back off and remove some of the thermal compound! An alternative might have been to turn the fan speed down so the heatsink stayed warmer.</p>

<p>Whatever you do, make sure the aluminium heat block isn&#8217;t getting too hot. The push-to-fit connector is only rated to 100°C, and the surrounding ABS can also melt if the heat isn&#8217;t bled off effectively.</p>

<p>Running the hot end at 240° for an extended time, I measured the ends of aluminium block at no more than 40°. Which I think is a very safe temperature, I can&#8217;t see the middle of the block being significantly hotter than the ends.</p>

<h1>It works!</h1>

<p>The printer has done more than 5 hours of printing now, and I think this design is a success:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9841.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9841-297x300.jpg" alt="" title="Printing a part using a large bed area" width="297" height="300" class="aligncenter size-medium wp-image-1350" /></a></p>

<div id="attachment_1351" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9863.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9863-300x234.jpg" alt="" title="Printing a business card holder at the Art, Not Apart festival" width="300" height="234" class="size-medium wp-image-1351" /></a><p class="wp-caption-text">On display printing a business card holder at the Art, Not Apart festival</p></div>

<h1>Source Code</h1>

<p>The <a href="http://www.thingiverse.com/thing:33337">OpenSCAD files are available on Thingiverse</a>, but there is also a full <a href="https://github.com/projectgus/huxley/tree/feature-extruder-pushfit">fork of the Huxley design on github</a> with the changes in it.</p>

<h1>Prior Designs</h1>

<p>This wasn&#8217;t my first attempt at upgrading the extruder:</p>

<h2>Tracing</h2>

<p>The first thing I needed to do was redraw the two printed parts. The originals were made with Solidworks, which I&#8217;m sure is an excellent CAD program but it&#8217;s not Free Software and costs a bit more than my hobby budget can bear!</p>

<p>Instead, I retraced the STLs from the Huxley repository into OpenSCAD, the <a href="https://github.com/projectgus/huxley/tree/remake-extruder-openscad">results are available in a different branch on github</a>.</p>

<h2>First draft</h2>

<p>The first redesign mounted the push-to-fit connector on top of the nozzle bracket:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9240-2.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9240-2-300x217.jpg" alt="" title="First redesign pre-installation" width="300" height="217" class="aligncenter size-medium wp-image-1352" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9264-2.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9264-2-243x300.jpg" alt="" title="First redesign printing fan mounts" width="243" height="300" class="aligncenter size-medium wp-image-1353" /></a></p>

<p>You can&#8217;t see it in these photos, but the original redesign needed a lot of filing &amp; drilling before it actually matched the Huxley parts. All mistakes in my understanding of the design. Thanks to Adam to MHV for helping me with this part of the install, and getting the new extruder on the printer.</p>

<p>However, once installed this version worked fine for over a week, with several prints.</p>

<h2>Second draft</h2>

<p>The second design draft was a cleanup of the first, fixing dimensions to minimise drilling &amp; filing and also beefing up the push-to-fit mount at the top of the nozzle mounting:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9770.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9770-185x300.jpg" alt="" title="Draft 2 pre-installation" width="185" height="300" class="aligncenter size-medium wp-image-1354" /></a></p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_9796.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_9796-213x300.jpg" alt="" title="Draft 2, nozzle closeup" width="213" height="300" class="aligncenter size-medium wp-image-1355" /></a></p>

<p>This redesign worked fine until I tried to print something that took up a large area of the 140x140mm bed. Turns out that the push-to-fit connectors, though sturdy when held statically, will eventually bend their way out if flexed back and forth. Having the X axis travel all the way back and forth, over and over, eventually worked it loose:</p>

<div id="attachment_1356" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_2260.resized.jpg" rel="shadowbox[sbpost-1329];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_2260.resized-300x200.jpg" alt="Moment of destruction photo" title="IMG_2260.resized" width="300" height="200" class="size-medium wp-image-1356" /></a><p class="wp-caption-text">Moment of destruction photo, courtesy Chris Lee</p></div>

<p>Hence the final redesign with the push-to-fit connector recessed low behind the heatsink, with a collar at the top to hold the tube straight and fast.</p>

<h1>Conclusion</h1>

<p>Hopefully this redesign is the last one for the extruder. The MHV Huxley is broken again(!) right now, although this time it&#8217;s one of the Y Axis mounts and nothing to do with the bowden tube.</p>

<p>Hopefully someone will be able to repair that failure successfully without requiring a whole part redesign, though!</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2012/10/rep-rap-pro-huxley-extruder-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flatdrier</title>
		<link>http://projectgus.com/2012/10/flatdrier/</link>
		<comments>http://projectgus.com/2012/10/flatdrier/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 10:19:12 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[433mhz]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[coffeescript]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1262</guid>
		<description><![CDATA[<p><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9345-150x150.jpg" alt="" title="Completed (scrappy) Arduino shield" width="120" height="120" class="alignright size-thumbnail wp-image-1273" /><img src="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-close-up-150x150.png" alt="" title="flatdrier close up" width="120" height="120" class="alignleft size-thumbnail wp-image-1295" /> <img src="http://projectgus.com/wp-content/uploads/2012/10/IMGP9356-150x150.jpg" alt="" title="Dehumidifier" width="120" height="120" class="aligncenter size-thumbnail wp-image-1282" /> </p>


The Flatdrier project is my overblown personal project to monitor &#038; control our dehumidifier.]]></description>
				<content:encoded><![CDATA[<p><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9345-150x150.jpg" alt="" title="Completed (scrappy) Arduino shield" width="120" height="120" class="size-thumbnail wp-image-1273" /><img src="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-close-up-150x150.png" alt="" title="flatdrier close up" width="120" height="120" class="size-thumbnail wp-image-1295" /> <img src="http://projectgus.com/wp-content/uploads/2012/10/IMGP9356-150x150.jpg" alt="" title="Dehumidifier" width="120" height="120" class="size-thumbnail wp-image-1282" /> </p>

<p><a href="http://chainxor.org/flatdrier-demo">Demo page with data from the last week in September</a></p>

<p>A few months ago, in the dead of Canberra winter, we discovered our flat had a mould problem. Insidious disgusting mould had crept in around our walls. Much scrubbing ensued.</p>

<span id="more-1262"></span>

<div id="attachment_1289" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/10/IMG_0800.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMG_0800-300x225.jpg" alt="" title="Black mould" width="300" height="225" class="size-medium wp-image-1289" /></a><p class="wp-caption-text">Black mould found behind a cupboard &#8211; eww!</p></div>

<p>We bought a dehumidifier in order to keep our flat dry and hopefully mould-free. The more advanced model had a humidistat and could automatically maintain a given humidity level. That model wasn&#8217;t in stock, though. Besides, surely I could build something better (famous last words!)</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMGP9356.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMGP9356-300x215.jpg" alt="" title="Dehumidifier" width="300" height="215" class="aligncenter size-medium wp-image-1282" /></a></p>

<p>The Flatdrier project is my overblown personal project to monitor &amp; control our dehumidifier.</p>

<h1>Data Acquisition</h1>

<p>The first step was monitoring temperature &amp; humidity. We&#8217;d seen signs of mould in a couple of rooms, so I wanted to be able to keep track of several rooms plus outdoors.</p>

<p>The cheapest and easiest solution was this ebay weather station. $43 and it came with 3 remote units:</p>

<div id="attachment_1272" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/09/OT372+OT263-1m.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/OT372+OT263-1m-300x300.jpg" alt="Weather Station - photo courtesy marcmart.ukau" title="Weather Station" width="300" height="300" class="size-medium wp-image-1272" /></a><p class="wp-caption-text">Photo courtesy of ebay seller <a href="http://myworld.ebay.com.au/marcmart.ukau">marcmart.ukau</a> &#8211; fine purveyors of weather stations, DC solenoids, off-brand Rubik&#8217;s cubes, and men&#8217;s wool jackets!</p></div>

<p>The weather station is pretty average quality. With the remote sensors all next to each other the readings vary by 1-2 degrees &amp; 10-20% humidity. However each sensor seems consistent with itself, I think this is accurate enough for my purposes.</p>

<h2>Hacking the weather station</h2>

<p>The first step was pulling the weather station apart. The remote modules use a 433Mhz transmitter (the blue module in the photo marked &#8220;SL-TX583 WWW.HH.COM&#8221;) to send digital data back to a matching receiver in the base station:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9100.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9100-244x300.jpg" alt="" title="Weather Station Transmitter PCB" width="244" height="300" class="aligncenter size-medium wp-image-1278" /></a></p>

<p>With the data pin patched from a transmitter module into my Arduino, I wrote a quick Arduino sketch (later an MHVLib program) to sniff the signals so I could interpret them.</p>

<p>Turns out the protocol is very simple, with short &amp; long pauses for 0s and 1s. To verify data it doesn&#8217;t use a checksum, it just repeats the same message multiple times.</p>

<h2>Base Station</h2>

<p>The base station had its own thermistor &amp; humidity sensor onboard. I figured this was too good to waste, so I tried to reverse engineer it as well:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9103.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9103-300x225.jpg" alt="" title="Weather Station Receiver PCB" width="300" height="225" class="aligncenter size-medium wp-image-1277" /></a></p>

<p>Both the thermistor and the humidity sensor are resistive sensors. The resistance varies with temperature &amp; relative humidity, respectively. After &#8220;buzzing out&#8221; the circuit with my multimeter and sketching it, it seemed that instead of using ADCs the base station was using a comparator and timer to measure resistance.</p>

<p>This method measures the time taken to charge or discharge a capacitor through the sensor it is measuring. The time is proportional to the resistance (more resistance means less current flows to/from the capacitor, so it takes longer to fully charge or discharge.)</p>

<p>I found a good description of this technique on page 10 of TI&#8217;s publication <a href="http://www.ti.com/lit/an/slaa071/slaa071.pdf">Economic Measurement Techniques with the Comparator A Module (PDF)</a>.</p>

<p>I had a tiny microcontroller board lying around, the TI MSP430 F2013 evaluation board, so I loosely mounted it in the base station to measure the time between charge/discharge of the capacitor.</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9113.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9113-300x228.jpg" alt="" title="Weather Station board w/ MSP430 attached" width="300" height="228" class="aligncenter size-medium wp-image-1276" /></a></p>

<p>Unfortunately I didn&#8217;t notice that the F2013 has no onboard comparator (the next model down does, this one has a high-precision ADC!), so I was stuck using the high impedance digital inputs to detect &#8220;high&#8221; &amp; &#8220;low&#8221; instead of specific threshold voltages. I think either the digital high/low thresholds are not consistent enough, or I misunderstood the circuit, because I never managed to take consistent readings.</p>

<p>After a few nights of poking the circuit and being confused, I abandoned the base station. I pulled the 433Mhz receiver module out of the base station, to connect directly to my Arduino.</p>

<p>Not wanting to lose a temperature input completely, I went to ebay and bought a $2 DHT-11 temperature/humidity sensor. This sensor is pretty crummy, the humidity values seem totally wrong (though I think maybe I cooked it during soldering), but the temperature readout provides useful data points.</p>

<p>Once I had all the hardware pieces together, I wrote a C program (plain AVR C) to run on the Arduino and monitor the temperatures.</p>

<h1>Control Logic</h1>

<p>I wanted to be able to track the temperature &amp; humidity, so I could recall recent changes. I also wanted control &#8211; to switch the dehumidifier on and off by comparing the dew point to the temperature.</p>

<p>I also needed to stop the dehumidifier turning on in the middle of the night!</p>

<p>All these tasks could probably be accomplished by a single high-end microcontroller, but at the time I had an Arduino and the tiny MSP430 board. So I decided to make a client/server architecture, using our existing home wireless router (which runs <a href="http://www.openwrt.org">the OpenWRT Linux distribution</a>.)</p>

<p>A Python script on the router runs regularly to poll the latest values from the Arduino. It also makes decisions about when to turn the dehumidifier on and off.</p>

<p>Rather than managing a long-running process, the Python script just gets executed by cron every minute. It runs, takes a new sample from the Arduino, saves it to a CSV file, then sends either an &#8220;On&#8221; or an &#8220;Off&#8221; signal to the dehumidifier based on the recent sensor history (filtered to avoid hysterisis and midnight surprises.)</p>

<h2>Dehumidifier Control</h2>

<p>The dehumidifier is switched on and off by a wireless remote control powerpoint (Powertran A0342) that was left over from an older project:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/IMGP9359.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/IMGP9359-300x186.jpg" alt="" title="Remote Control Power Point" width="300" height="186" class="aligncenter size-medium wp-image-1283" /></a></p>

<p>This also communicates on 433Mhz. I already had a <a href="http://www.jaycar.com.au/productView.asp?ID=ZW3100">Jaycar ZW-3100</a> transmitter module, so I used this to transmit the on/off signals.</p>

<p>Conveniently I didn&#8217;t have to reverse engineer the switch protocol, there was an existing <a href="http://arduino.cc/forum/index.php/topic,38075.0.html">Arduino remote switch library</a> and I just translated the &#8220;Blokkerswitch&#8221; signals into plain AVR C.</p>

<h1>Putting it together</h1>

<p>The PCB engraver at <a href="http://www.makehackvoid.com/">Make Hack Void</a> made it easy to throw together a custom Arduino shield:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9219.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9219-300x224.jpg" alt="" title="PCB Engraver at Make Hack Void" width="300" height="224" class="aligncenter size-medium wp-image-1274" /></a></p>

<p>Realistically, a protoboard could have done this pretty easily. But it&#8217;s fun to use a new toy like the PCB Engraver, and it took less than an hour to make the board!</p>

<p>The PCB routing itself is a bit quick and nasty. For starters, I got the receiver module pinout backwards so it sticks out the side of the PCB! That&#8217;s since been fixed, but I think the existing board looks a bit like a sailboat!</p>

<div id="attachment_1273" class="wp-caption aligncenter" style="width: 310px"><a href="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9345.jpg" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/09/flatdrier-9345-300x210.jpg" alt="" title="Completed (scrappy) Arduino shield" width="300" height="210" class="size-medium wp-image-1273" /></a><p class="wp-caption-text">Scrappy breakout shield &#8211; left-to-right is 433Mhz receiver, DHT-11 sensor, 433Mhz transmitter.</p></div>

<h1>Web Interface</h1>

<p>There&#8217;s a web page to view the temperature, humidity &amp; the history of  the dehumidifier state:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-one-day-screenshot.png" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-one-day-screenshot-265x300.png" alt="" title="Flatdrier Web Interface - showing one day" width="265" height="300" class="aligncenter size-medium wp-image-1284" /></a></p>

<p>The date range picker control (thanks <a href="https://github.com/dangrossman/bootstrap-daterangepicker">Dan Grossman</a>!) lets you view any date range:</p>

<p><a href="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-one-week.png" rel="shadowbox[sbpost-1262];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/10/flatdrier-one-week-267x300.png" alt="" title="Flatdrier web interface - showing one week" width="267" height="300" class="aligncenter size-medium wp-image-1285" /></a></p>

<p><a href="http://chainxor.org/flatdrier-demo">Here&#8217;s a demo page, using data from the last week in September</a>. Looking over the history you&#8217;ll notice some inconsistencies with the dehumidifier coming on and off, this was caused by me tuning the algorithm sensitivity during the week.</p>

<p>Rather than make a server-side program to run on the router, I made the web page run entirely in client-side JavaScript. The script running in the web page downloads CSV files containing each day&#8217;s raw sample data (created by the Python script), parses them, and then displays the data.</p>

<p>I tried out <a href="http://www.coffeescript.org">CoffeeScript</a> for the web programming. The program doesn&#8217;t need to be &#8220;production ready&#8221;, so it uses the in-browser compiler to compile inline CoffeeScript to JavaScript as the page loads.</p>

<p>To draw the graphs I used the very nice <a href="http://flotcharts.org">Flot</a> charting framework.</p>

<p>An early version used the d3.js charting functions from <a href="http://nvd3.com/">NVD3.js</a>, instead of Flot, but the browser rendering times were much slower and there were glitches with the rendering output. I didn&#8217;t spend much time trying to tune or fix D3, though. D3 is a very powerful framework and I&#8217;m sure I could make it work well, but this time I really only needed a simple &#8220;cookie cutter solution&#8221;, something NVD3 explicitly says it avoids.</p>

<h1>Code</h1>

<p>The <a href="https://github.com/projectgus/flatdrier">project code is all up on github</a>, with a README describing the structure.</p>

<p>It&#8217;s unlikely anyone else will have this same problem or exact same hardware, but the code is pretty modular so some parts will hopefully come in handy.</p>

<h1>Irony</h1>

<p>The ironic thing about this project is that we got the dehumidifier in early July but I only got the controller up and running in the second week of September, just in time for (hopefully) warmer weather and less condensation problems.</p>

<p>Maybe waiting a few days for the &#8220;smart&#8221; dehumidifier model to come back into stock wouldn&#8217;t have been such a bad idea, after all&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2012/10/flatdrier/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Huawei Sonic U8650 &#8211; 10 months on</title>
		<link>http://projectgus.com/2012/06/huawei-sonic-u8650-10-months-on/</link>
		<comments>http://projectgus.com/2012/06/huawei-sonic-u8650-10-months-on/#comments</comments>
		<pubDate>Mon, 18 Jun 2012 11:43:27 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[huawei]]></category>
		<category><![CDATA[moore's law]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1215</guid>
		<description><![CDATA[This is a follow-up to the review I wrote last August of the Huawei Sonic U8650 $189AU Android smartphone. Someone posted a comment last week: How is this phone holding up since you bought it last August? Are you still happy with it? Ten months on and I&#8217;m still using the phone, so here&#8217;s my [...]]]></description>
				<content:encoded><![CDATA[<p>This is a follow-up to the review I wrote last August of the <a href="http://projectgus.com/2011/08/huawei-sonic-review/">Huawei Sonic U8650 $189AU Android smartphone</a>.</p>

<p><img src="http://projectgus.com/wp-content/uploads/2011/08/IMG_8253-164x300.jpg" alt="" title="Huawei boot logo" width="164" height="300" class="size-medium wp-image-921" /></p>

<p><span id="more-1215"></span>Someone posted a comment last week:</p>

<blockquote>How is this phone holding up since you bought it last August? Are you still happy with it?</blockquote>

<p>Ten months on and I&#8217;m still using the phone, so here&#8217;s my follow-up.</p>

<h2>Build Quality</h2>

<p>So far the Sonic has held up pretty well. I don&#8217;t give it any special care, apart from trying not to leave it in the same pocket as my keys.</p>

<p>The screen has developed some light scratches (key-pocket regime not strict enough), but I hadn&#8217;t really noticed them until I came to write this post.</p>

<p>The cover for the earpiece &amp; notification LED fell off a couple of months ago. Didn&#8217;t seem to change anything.</p>

<p><img src="http://projectgus.com/wp-content/uploads/2012/06/IMG_9083-300x225.jpg" alt="Huawei Sonic without earpiece cover" title="Huawei Sonic sans Cover" width="300" height="225" class="aligncenter size-medium wp-image-1231" /></p>

<p>The phone locks up and stops responding maybe once every 8 weeks, sometimes it comes back but sometimes I have to take the battery out. It&#8217;s not really enough to be a problem.</p>

<h2>Performance</h2>

<p>Back in August I said:</p>

<blockquote>
The Sonic runs Android 2.3 Gingerbread extremely well – performance is snappy, apps open quickly.
</blockquote>

<p>Today I&#8217;m a little less upbeat. Things have changed in ten months. Many app updates have come. It&#8217;s clear that developers are now focusing on newer models. Consequently, the Sonic feels like it has been getting fractionally slower over time.</p>

<p>One of the most obvious culprits was the Facebook app, although I actually uninstalled that one a few months ago. Updates brought many nifty features that didn&#8217;t work particularly well on a lower-RAM lower-processor smaller-screen device.</p>

<p>Similarly, the Swype keyboard (which I still use and love) seems to have become mildly more ponderous with each increment (although still lightning-fast if you&#8217;re using it on last year&#8217;s flagship phone.)</p>

<p>As a consumer, this kind of upgrade cycle seems to be the real downside to the &#8220;Android Fragmentation&#8221; problem.</p>

<p>In some cases you can get around this by seeking out sleeker app alternatives. For example, the Twitter client &#8220;Twicca&#8221; is much faster than any alternative I&#8217;ve tried.</p>

<p>Overall, the Sonic is still usable, but the difference will only get more pronounced. At least until all new development shifts to Android 4 or newer, which the Sonic will never run.</p>

<h2>As a Phone</h2>

<p>As I said in the original review, the Sonic has decent ringer and call volume. However, I&#8217;ve since had people tell me the call quality on their end is poor.</p>

<h2>Music Player</h2>

<p>I haven&#8217;t used &#8220;Huawei Player&#8221; since I wrote the review. PowerAMP is a very good music player, well worth paying for.</p>

<p>I also haven&#8217;t really noticed the sound quality issues that I wrote about in the first review. There is a contributing factor to that &#8211; I nearly always listen to music on my little Sennheiser in-ear headphones while walking somewhere outdoors, or on speakers plugged into the stereo at the Hackerspace where music competes with the sounds of angle grinders and mitre saws.</p>

<h2>Battery Life</h2>

<p>Battery is still good for a smartphone. Recently I turned off email and Twitter notifications<sup><a href="http://projectgus.com/2012/06/huawei-sonic-u8650-10-months-on/#footnote_0_1215" id="identifier_0_1215" class="footnote-link footnote-identifier-link" title="I did this after reading The Information Diet and trying to build more conscious information consumption habits. With mixed success.">1</a></sup>, and in combination with dropping Facebook a few months ago I now easily go more than two full days without charging (but still with some online use.)</p>

<h2>Camera</h2>

<p>This is the one feature that makes me regularly dislike the Sonic. As I said in the original review, image quality is poor especially in bad light. Worse, the camera app is quite buggy &#8211; on my phone it sometimes takes a long time to start, and one in every few launches it crashes outright. Grabbing a quick snap is not really an option.</p>

<h2>&#8220;Rooting&#8221; &#038; &#8220;Custom ROMs&#8221;</h2>

<p>Even though the factory Android 2.3 install is pretty good, I was really hoping for a port of Cyanogenmod. If only to get past some of the niggly bugs in Android 2.3.3 (Huawei haven&#8217;t released any official updates, to my knowledge.)</p>

<p>As it happens some unofficial <a href="http://forum.xda-developers.com/showthread.php?t=1292647">Cyanogenmod 7.1 ports</a> have surfaced, done by some Spanish developers.</p>

<p>Unfortunately they&#8217;re the kind of no-source-code no-guarantees dodgy-upload-site affair that seems to be pretty common in the Android modding community. It really jars me, coming from the broader FOSS community where there&#8217;s so much emphasis on trust, identity, and source code transparency. There&#8217;s just no way I trust these kind of ROMs enough to install them on my own phone, I want to be able to see what it&#8217;s built from (and by whom, and whether anyone is supporting the releases) and repeat the process myself if I feel like it.</p>

<p>Not that I think this is something to blame the developers for, it just keeps me from embracing it as an option. It&#8217;s up to you to decide whether that makes a paranoid free software zealot or merely fussy!</p>

<p>In a world where I had infinite time I&#8217;d love to try and work on more open, inclusive, Android development for the Sonic. Along with the trillion other things on my backburner.</p>

<h2>Other Alternatives</h2>

<p>There are a lot more alternatives now, especially given the Sonic price hasn&#8217;t gone down in 10 months (still AU$188.) I haven&#8217;t researched any of the cheaper options this time around. I did notice that now the Samsung Galaxy S3 is out, the Galaxy S2 (which eclipses the Sonic in every measurable way) is available cheaply on carrier-subsidised plans.</p>

<p>For that reason it&#8217;s really hard to recommend the Sonic or any other budget smartphone, unless you absolutely don&#8217;t want a 24-month contract.</p>

<h2>Bottom Line Revisited</h2>

<p>I don&#8217;t regret buying the Sonic. I&#8217;m not planning to replace it in the near future, despite the annoying camera.</p>

<p>However, if I was looking to buy today then I&#8217;d seriously consider signing a cheap 24-month contract for a Galaxy S2, or I&#8217;d look for something like the S2 on the used market.</p>

<p>That said, I wouldn&#8217;t be surprised to hear soon that Huawei have dropped the price of the Sonic. If it comes down closer to $100 then it might be too cheap to pass up!</p>
<br/><br/><ol class="footnotes"><li id="footnote_0_1215" class="footnote">I did this after reading <a href="http://www.informationdiet.com/">The Information Diet</a> and trying to build more conscious information consumption habits. With mixed success.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2012/06/huawei-sonic-u8650-10-months-on/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Debian on Flexiview FV-1</title>
		<link>http://projectgus.com/2012/02/debian-on-flexiview-fv-1/</link>
		<comments>http://projectgus.com/2012/02/debian-on-flexiview-fv-1/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 12:31:00 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[androidtv]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fv-1]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shanzhai]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1074</guid>
		<description><![CDATA[This post is about running Debian GNU/Linux on the Mesada/Flexiview FV-1 &#8220;AndroidTV&#8221; unit. This post has been a bit delayed, I got very sidetracked with other things this month! By following these steps, you should be able to use the FV-1 a bit like a normal desktop Linux computer. However, it&#8217;s still a long way [...]]]></description>
				<content:encoded><![CDATA[<p>This post is about running Debian GNU/Linux on the <a href="http://projectgus.com/2012/01/mesada-flexiview-fv-1-androidtv-technical-review/">Mesada/Flexiview FV-1 &#8220;AndroidTV&#8221; unit</a>. This post has been a bit delayed, I got very sidetracked with other things this month!</p>
<p>By following these steps, you should be able to use the FV-1 a bit like a normal desktop Linux computer. However, it&#8217;s still a long way from my dream goal of running <a href="http://xbmc.org/">XBMC for Linux</a>.</p>
<p><a href="http://projectgus.com/files/fv1/images/androidtv-large-1.jpg" rel="shadowbox[sbpost-1074];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-small-1.jpg" alt="Android TV front" /></a></p>
<p><span id="more-1074"></span>(Edit 11 March &#8211; added a couple more notes about exactly how poor the UI graphics performance is.)</p>
<h1>What This Is</h1>
<p>A lightly customised installation of <a href="http://wiki.debian.org/DebianWheezy">Debian Wheezy</a>, set up initially with a minimal &#8220;LXDE core.&#8221; Kernel is 3.3rc from linux-samsung-soc, plus some <a href="https://github.com/projectgus/linux-samsung-fv1">minor patches for FV-1 hardware support</a>.</p>
<h1>Debian Installation</h1>
<p>This configuration has the kernel loaded into the internal flash of the FV-1. However, the root filesystem with Debian is external &#8211; on either a USB device or an SD card.</p>
<p>If you want to reverse back to Android after testing Debian, you should be able to perform a normal FV-1 firmware upgrade using their &#8220;SDtool&#8221; to prepare an SD card.</p>
<p>In theory, it should also be possible to install Debian into the internal flash. However, the m-boot bootloader is quite peculiar so I haven&#8217;t tried.</p>
<h1>How to install</h1>
<p>1) Download an SD card image to flash the kernel &#8211; <a href="/files/fv1/debian/kernel-boot-sdcard.img">use this one if you to boot Debian from an SD card</a>, and <a href="/files/fv1/debian/kernel-boot-usb.img">this one to boot Debian from a USB device</a>. The only difference between the two is the kernel commandline in the config, you can see the <a href="/files/fv1/debian/">configs here</a>.</p>
<p>2) Work out what device name your SD card reader in your computer has. It will probably look like /dev/sd<i>X</i> (for USB card readers) or /dev/mmcblk<i>X</i> (for built-in card readers). I&#8217;ll be using /dev/sdX for the sample commands here. You can probably work this out by inserting an SD card, waiting for it to mount on the desktop, and then typing &#8220;mount&#8221; to see what is mounted.</p>
<p>3) Flash your SD card with the kernel upgrade. This will erase any content already on the card.<br />
<code>umount /dev/sdX1<br />
dd if=kernel-boot-usb.img of=/dev/sdX<br />
sync<br />
</code></p>
<p>4) Remove the SD card and insert it into the FV-1. Power on the FV-1. The red light will come on, followed by the green light. After 1 minute or so the green light will start blinking. This means the new kernel has finished flashing.  Power off the FV-1 and remove the SD card.</p>
<p>5) <a href="/files/fv1/debian/rootfs.tgz">Download the rootfs tarball</a>. This is the filesystem that the kernel will boot into.</p>
<p>6) You then unpack the rootfs, to your SD card or USB device. If you only have one SD card, you can reuse the one which you just used for the kernel (although you&#8217;ll need to repartition and reformat it.) I suggest formatting as ext3.</p>
<p>7) Once your SD card is ready, unpack the rootfs:<br />
<code><br />
cd /media/[path-to-my-SD-card-mountpoint]<br />
sudo tar zxvf ~/path/to/rootfs.tgz<br />
sync<br />
cd ..<br />
eject [path-to-my-SD-card-mountpoint]<br />
</code></p>
<p>8) Insert the card back to the FV-1, and power on.</p>
<p>9) The FV-1 will boot to a login screen, using the lightdm login manager. Alternatively, if you don&#8217;t have a screen then you can connect an ethernet cable &#8211; the FV-1 will establish a connection using DHCP and you will be able to ssh into it.</p>
<p>10) The default username is &#8216;user&#8217; and the password is &#8216;android&#8217;</p>
<p>11) The stock image only has a very basic LXDE GUI desktop (lxde-core.) When you first log in, go to the LXDE menu (bottom-left) and choose Accessories -> LXTerminal.</p>
<p>12) Use &#8220;passwd&#8221; to change the default password.</p>
<p>13) Optionally, use &#8220;sudo adduser (username)&#8221; to add a new user then &#8220;sudo usermod -aG sudo (username)&#8221; to give them sudo. Then reboot and login as your new user, and &#8220;sudo deluser user&#8221; to remove the initial user.</p>
<p>14) If you&#8217;re not in the US, edit /etc/apt/sources.list and change to a <a href="http://www.debian.org/mirror/list">local mirror for packages</a>.</p>
<p>15) To install a full GUI LXDE environment, run &#8220;sudo apt-get update&#8221; then &#8220;sudo apt-get install lxde&#8221;. It may also be possible to remove lxde-core and install other desktop environments like Xfce4, GNOME, KDE &#8211; as described in the Debian documentation.</p>
<p>16) When installing LXDE (or any other environment), the gdm3 package may prompt you to choose a default login manager. Keep the current &#8220;lightdm&#8221;. Any new manager will need to be preconfigured to use Xwrapper.sh to launch X (see below.)</p>
<p>17) Happy computing! From now on, everything should behave like a standard Debian Wheezy system.</p>
<p>Keep reading for the status of the hardware support.</p>
<h1>Things That Work</h1>
<h3>X11 graphics</h3>
<p>Up to 1920&#215;1080 over HDMI, 16-bit colour.</p>
<h3>USB, ethernet, SD card slot.</h3>
<h1>Things That Might Work</h1>
<h3>HDMI audio output</h3>
<p>I&#8217;m using an HDMI->DVI cable and a computer monitor, so I haven&#8217;t been able to test audio output.</p>
<h1>Things That Don&#8217;t Work</h1>
<h3>Wifi &amp; Bluetooth</h3>
<p>This is another case where having the actual GPL source release would be very helpful. The wl12xx_sdio driver detects the chip correctly, sometimes successfully uploads firmware, and very occasionally I&#8217;ve managed to get it to associate and send/receive packets. More commonly it just crashes with MMC read/write errors.</p>
<p>My vague theories for why it is not working include:</p>
<ul>
<li>An incorrectly set clock frequency (if I force lower the SDIO frequency it becomes more reliable but not 100% reliable.)</li>
<li>Samsung HSMMC driver bug of some kind.</li>
<li>A floating GPIO line that I don&#8217;t know about.</li>
<li>Unpublished differences between Samsung&#8217;s SWB-T37 chip and the original TI WL1271.</li>
</ul>
<h3>Changing screen resolution normally</h3>
<p>The X server is launched via a custom wrapper script, /usr/local/bin/Xwrapper.sh, that sets the screen resolution for the HDMI output before X starts. Out of the box it is set for 720p (1280&#215;720), but you can edit that file to get 1080p (1920&#215;1080) or 480p (720&#215;480.)</p>
<h3>Detecting available screen resolutions</h3>
<p>The mainline kernel has no support for DDC/EDID (receiving monitor identification data) over HDMI on the Samsung S5PV210 SoC.</p>
<h3>Blanking/unblanking the screen</h3>
<p>This includes restarting the X server &#8211; any time HDMI output is disabled and then reenabled it hard locks the system. I&#8217;ve committed a <a href="https://github.com/projectgus/linux-samsung-fv1/commit/475e03fe6d5858ad593ec41fd2c9a919d72fcfd4">note on the fv1_hacks branch</a> showing where the system locks the second time around, but I haven&#8217;t worked anything else out yet.</p>
<p>To work around the issue there&#8217;s also a custom xorg.conf installed, disabling all screen blanking functions.</p>
<p>I think the lockup may be related to the fact that (unlike fancier hardware) the FV-1 has no system-controlled voltage regulators. This means some HDMI subsystems that would otherwise be disabled when HDMI output stops stay running, and cause problems. This is only a theory, though.</p>
<h3>Video acceleration</h3>
<p>This is the big one. Currently single buffered, software acceleration only &#8211; means any graphics-intensive or interactive operations tend to use a lot of CPU time and can be very jerky.</p>
<p>The <a href="http://lwn.net/Articles/436033/">videobuf2-fb driver</a> that the XServer runs on (ie a framebuffer driver that maps to a V4L2 output device) is only a proof of concept, made by Samsung. It would be possible to add some more features, at least in principle. Or alternatively to write an Xorg driver that outputs directly to v4l2 (this is how Android does it.)</p>
<h3>3D acceleration</h3>
<p>I&#8217;ve been messing with the PowerVR drivers for the SGX540 core, but it&#8217;s all a closed-source restricted mess and very unlikely it can be made to work. Hopefully the FSF will get some traction behind their goal of <a href="http://libreplanet.org/wiki/Group:PowerVR_drivers">open source PowerVR SGX drivers</a>.</p>
<h3>SD card plugging &#038; unplugging</h3>
<p>For some reason the Card Detect interrupt doesn&#8217;t work on the SD card slot. An SD card will work fine if its inserted at boot time, but not if it&#8217;s plugged/unplugged later on. I&#8217;ve committed what I think <i>should</i> work <a href="https://github.com/projectgus/linux-samsung-fv1/commit/39d6c591d3cd7bead04f1f6c4efd58ffa1dd0a4b">to a branch</a> (can even see the CD line changing state and attach the interrupt to it), but I can&#8217;t make it actually work.</p>
<h3>RF remote control</h3>
<p>I spotted data from this coming in over the i2c bus but I haven&#8217;t tried to decode it, or work out functions like pairing, or discover if it has its own GPIO interrupt line. There&#8217;s a kernel driver for the remote in the vendor&#8217;s kernel, but due to GPL violation that&#8217;s not of any help.</p>
<h3>Restarting</h3>
<p>The system won&#8217;t reboot, you have to shutdown and then cycle the power by plugging/unplugging the cord!</p>
<h1>That&#8217;s All</h1>
<p>I hope this is of some use. Patches are very welcome if anyone works any of the issues out. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2012/02/debian-on-flexiview-fv-1/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Mesada Flexiview FV-1 &#8220;AndroidTV&#8221; Technical Review</title>
		<link>http://projectgus.com/2012/01/mesada-flexiview-fv-1-androidtv-technical-review/</link>
		<comments>http://projectgus.com/2012/01/mesada-flexiview-fv-1-androidtv-technical-review/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 10:13:22 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[fv-1]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[shanzhai]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1084</guid>
		<description><![CDATA[First part: a general review of the "Mesada Flexiview FV-1" cheap "Android TV" box. Second part: in-depth technical teardown, and discussion.]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m calling this a &#8220;technical review&#8221; because I&#8217;m not going to spend much time talking about using Android on this device. The reason for that will become apparent.</p>
<p>I recently purchased two &#8220;Android TV&#8221; boxes from aliexpress, for investigation and general hackery.</p>
<p><a href="http://projectgus.com/files/fv1/images/androidtv-large-1.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-small-1.jpg" alt="Android TV front" /></a><br />
<a href="http://projectgus.com/files/fv1/images/androidtv-large-2.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-small-2.jpg" alt="Android TV back" /></a><br />
<img src="http://projectgus.com/files/fv1/images/androidtv-small-6.jpg" alt="Android TV remote" /></p>
<p>You can buy these from various online vendors (<a href="http://www.dealextreme.com/p/fv-1-google-tv-box-android-2-2-internet-tv-box-w-wifi-usb-rj45-hdmi-sd-4gb-samsung-s5pv210-1ghz-66302">dealextreme</a>, aliexpress, etc.) Also under other names &#8211; for instance it&#8217;s sold here in Australia as the Kogan Agora TV.</p>
<p>The &#8220;original&#8221; product is the Flexiview FV-1, made by <a href="http://www.mesada.com.cn/ch/ProductView.asp?ID=63">Mesada Technology</a>, Shenzhen.</p>
<p><span id="more-1084"></span><br />
<h1>High-Level Specifications</h1>
<ul>
<li>Cortex-A8 1Ghz CPU (Samsung S5PV210 SoC)</li>
<li>512Mb RAM</li>
<li>Hardware supports 1080p video decoding, 2d/3d acceleration</li>
<li>HDMI output</li>
<li>Wifi, bluetooth, ethernet connectivity</li>
<li>3 USB 2.0 ports</li>
<li>RF remote with wiimote-like infared pointing feature</li>
</ul>
<p>Price varies between $130 &amp; $150 online.</p>
<p>Bear in mind that like most of these &#8220;<a href="http://www.bunniestudios.com/blog/?p=284">shanzhai</a>-esque&#8221; products, what&#8217;s advertised on the web page may be different to what you get. There are a few similar-looking products out there &#8211; I&#8217;ve seen ones with SoCs from Rockchip and Amlogic. Also, specs and build quality can vary widely depending on vendor.</p>
<h1>First Impressions</h1>
<p>The hardware is cheap &amp; cheerful. The marks and scratches visible in the photos weren&#8217;t me, it was like that out of the box. <i>EDIT June 2012: Tony points out in the comments that there&#8217;s a thin film covering the piano finish, and he&#8217;s absolutely right. Here&#8217;s a quick photo, the top-left corner is a reflection.</i></p>
<p><a href="http://projectgus.com/wp-content/uploads/2012/01/IMG_9084.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/wp-content/uploads/2012/01/IMG_9084-150x150.jpg" alt="FV-1 showing reflective piano finish" title="FV-1 with piano finish" width="150" height="150" class="aligncenter size-thumbnail wp-image-1239" /></a></p>
<p>Nevertheless, things mostly work and the build quality seems OK. One thing I did notice is that the video output can be a bit picky on the stock firmware &#8211; only some of my monitors worked, and I saw reports of some TVs not working. I think the requirement may possibly be supporting a 720p YPbPr video mode.</p>
<p>The other cheap and nasty bit is the little plastic &#8220;door&#8221; on the front covering 2 USB ports. It&#8217;s hard to open and close, and I doubt any serious user would leave it there for long.</p>
<h1>Android TV?</h1>
<p>Three word review of the &#8220;Android TV&#8221; experience: &#8220;really, don&#8217;t bother.&#8221;</p>
<p>If you&#8217;ve never heard of &#8220;Android TV&#8221;, that&#8217;s because it doesn&#8217;t really exist. There is a thing called &#8220;Google TV&#8221;, but those products are relatively rare and closed-source and not available for $130.</p>
<p>&#8220;Android TV&#8221; really means &#8220;the plain vanilla phone operating system, with a remote control that emulates a mouse &amp; keyboard which you then use to control an interface designed for touch-screens.&#8221;</p>
<p>Sound nearly unusable? It is. A touchscreen interface is not a PC, which is in turn not a remote control interface. It&#8217;s horrid.</p>
<p>The device works pretty well with a wireless keyboard and/or mouse. Which is fine, but you&#8217;d be just as well off buying a tablet with an HDMI port (for less money) or even just hooking up an old PC.</p>
<p>I didn&#8217;t use Android much &#8211; I can confirm the browser works quite nicely. However, looking around the internet I saw a lot of reports of patchy video playback. Which is disappointing.</p>
<h1>Firmware Updates</h1>
<p>As usual for these devices, the vendor offers no after-sales support. <a href="http://yoomon.net/drivers/Flexiview/">Firmware updates</a> are scattered around the net in strange places (others are hidden in various giant forum threads!)</p>
<h1>So why did you buy two?</h1>
<p>I bought these because I have a weakness for cheap low-power ARM hardware. I wanted to see how easy it was to port GNU/Linux, and maybe have a stab at porting XBMC. I&#8217;ll put details about running GNU/Linux in a follow-up blog post.</p>
<p>Of course, to get hacking, you need to open the cover:</p>
<p><a href="http://projectgus.com/files/fv1/images/androidtv-large-5.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-large-5.jpg" alt="Top of FV-1 board" /></a></p>
<p>Here&#8217;s the board. The sloppily attached cable is the serial console. Thanks to <a href="http://www.ediy.co.nz/fv-1">eDIY NZ</a> for posting the serial cable pinout online &#8211; it&#8217;s a 3.3v lvTTL port, 115200bps. Looking top-to-bottom in this photo the pinout is 3.3v/TX/RX/GND. The hot glue was originally for strain relief!</p>
<p>For a serial link, I used my favourite source &#8211; a mobile phone USB<->Serial cable that I got for $2 at an op shop<sup><a href="http://projectgus.com/2012/01/mesada-flexiview-fv-1-androidtv-technical-review/#footnote_0_1084" id="identifier_0_1084" class="footnote-link footnote-identifier-link" title="&ldquo;thrift store&rdquo;">1</a></sup>.</p>
<p>Also note the unpopulated USB port, some unpopulated front &amp; rear connectors, and the button cell battery. The battery surprised me, I wonder why they didn&#8217;t drop it to save on BoM (bill-of-materials) cost.</p>
<p>The large clear LEDs at the front are the IR LED beacon for the &#8220;wiimote-style&#8221; remote. The red LED is for power (amusingly, HDMI standby power can come from the monitor and light it even when the unit is off!) The green LED is connected to a GPIO.</p>
<h1>Under the covers</h1>
<p>Pry off the RF shielding and things are a bit more interesting. &#8220;Open in New Tab&#8221; on the images if you want to be able to read chip names.</p>
<p><a href="http://projectgus.com/files/fv1/images/androidtv-large-3.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-large-3.jpg" alt="Naked top of FV-1 board" /></a></p>
<p>Left hand area contains:<br />
* Power regulation.</p>
<p>Middle area contains:<br />
* Asix AX88772A USB to 10/100 Ethernet adapter<br />
* RAM<br />
* System-On-A-Chip (Samsung S5PV210)<br />
* Sandisk flash memory. I believe this is an &#8220;embedded MMC&#8221; interface &#8211; it shows up as an SD card to the kernel.</p>
<p>Right area contains:<br />
* TI WL1271 combined Wifi &amp; Bluetooth adapter, packaged by Samsung as the SWB-T37 and connected via SDIO.</p>
<p><a href="http://projectgus.com/files/fv1/images/androidtv-large-4.jpg" rel="shadowbox[sbpost-1084];player=img;"><img src="http://projectgus.com/files/fv1/images/androidtv-large-4.jpg" alt="Naked base of FV-1 board" /></a></p>
<p>On the underside, the most interesting thing is the <a href="http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24LE1">Nordic Semiconductor nRF24LE1</a> 2.4Ghz digital transceiver under the left-hand shield. This is connected via SPI and talks to a similar model IC in the remote control. I haven&#8217;t looked at the protocol yet.</p>
<p>Under the main cover, it looks like there is an unpopulated LCD interface. Plus something else totally unpopulated on the bottom left. Given that Mesada also make many GPS devices, maybe there is a car GPS that uses this board?</p>
<p>PCB identifier for this batch is 9000J-MSD-SACC-PCB-110107. Which I guess makes it just over one year old!</p>
<h1>GPL? What&#8217;s a GPL?</h1>
<p><a href="http://projectgus.com/2010/07/open-source-in-android-tablets/">As I&#8217;ve written before</a>, GPL compliance for these kinds of products is generally poor. The FV-1 is no exception, as far as I know it is impossible to get source for the exact Linux kernel running on the device.</p>
<p>It is possible that distributors outside China, like Kogan here in Australia or &#8220;Flexiview NZ&#8221;, are able to supply GPL source code &#8211; they have more reasons to act ethically and not break the license, and potentially severe consequences if they are distributing a violating product. I don&#8217;t have any more information either way.</p>
<p>In the meantime, I bought this device anyhow because Samsung are generally proactive with open source development, and S5PV210 SoC support is part of the mainline Linux kernel. In practice, it was much more work than I anticipated to get a <a href="http://github.com/projectgus/linux-samsung-fv1">kernel building from source that runs on the device</a>.</p>
<p>This is partially because of differences between the FV-1 and any available reference board. Partially because not all S5PV210 support has made it to the official linux-samsung-soc kernel. Partially because embedded development is always a bit of a pain&#8230;</p>
<h1>Vendor Kernel on Device</h1>
<p>The device comes with a 2.6.32 Android kernel loaded. Here&#8217;s a <a href="http://projectgus.com/files/fv1/logs/initial.txt">dump of the boot messages and dmesg</a>, plus some interactions from the Android side &#8211; /proc entries, mount points, etc.</p>
<p>Among the custom additions in this kernel are:<br />
* The TI vendor WL1271 driver (open source, but different to the Linux kernel one)<br />
* The PowerVR SGX540 3D accelerator drivers<br />
* In-kernel driver (it seems) for the RF remote, via SPI.</p>
<p>Also of note is that Android isn&#8217;t using a Framebuffer device for the HDMI output (the framebuffer in that kernel is for the LCD only.) Android must be using an earlier revision of the v4l2-based <a href="http://lwn.net/Articles/449661/">s5p-tv interface</a>.</p>
<h1>3.2 Kernel</h1>
<p>As I said, it seems like no source exists for the 2.6.32 &#8220;vendorkernel&#8221; that ships on the device.</p>
<p>I now have a 3.2rc kernel that boots and can run a normal GNU/Linux, with xorg over framebuffer, <a href="github.com/projectgus/linux-samsung-fv1">available here on github</a>. Not everything works yet, though. Some of the fixes are a bit hacky and need to be cleaned up. Hopefully, soon some of the support can go upstream to the mainline kernel. More on this kernel in a follow-up post.</p>
<h1>Other Reference Kernels</h1>
<p>After much searching, I found two other helpful S5PV210/S5PC110 kernel sources (not that I ever successfully booted them on the FV-1.)</p>
<p>The Samsung Galaxy GT-I9000 source code, available from <a href="http://opensource.samsung.com">opensource.samsung.com</a>, is for very similar hardware.</p>
<p>A Chinese development board called the RealARM <a href="http://www.real6410.com/realarm/Orders106.html">Realv210</a>. This looks to be very similar to Samsung&#8217;s SMDKV210 development board. I think the FV-1&#8242;s reference board was either the Realv210 or the SMDKV210.</p>
<p>RealARM are distributing a number of useful resources, including <a href="http://down.realarm.cn/Real210%E5%9B%BD%E5%86%85%E6%9C%80%E5%BC%BA%E5%8F%91%E5%B8%83%E5%85%89%E7%9B%98/LINUX%E7%B3%BB%E7%BB%9F/">a Linux 2.6.32 kernel for the Realv210 board</a>. This reference has been very helpful in getting 3.2 up and running.</p>
<h1>Mesada mboot</h1>
<p>The last vendor surprise is the bootloader. &#8220;Mesada mboot&#8221; is the strangest embedded bootloader I&#8217;ve ever seen &#8211; among its features it appears to be able to both read and format EXT3 filesystems! Unfortunately, mboot is also closed source and no documentation is available.</p>
<p><a href="http://projectgus.com/files/fv1/logs/upgrade.txt">Here&#8217;s a dump of mboot performing a full system update for an Android firmware</a></p>
<p>The good news is I&#8217;ve managed to reverse engineer enough of the format to &#8220;unpack&#8221; and &#8220;repack&#8221; mesada&#8217;s .osk firmware update files. This allows the flashing of a new kernel, or new system partitions, or even a new bootloader. <a href="https://github.com/projectgus/mboot-tools">The project is called mboot-tools and is up on github</a>. There are some usage instructions in the README there, and lots of comments in the header file.</p>
<p>It should also be possible to use mboot_unpack &amp; mboot_pack to make &#8220;custom Android ROMs&#8221; or possibly even as a first step to porting a newer version of Android (after all the hardware is very similar to Galaxy/Nexus S, which can run ICS.)</p>
<h1>What&#8217;s Next</h1>
<p>I&#8217;ll put a post up soon explaining how to boot Debian on the FV-1, explaining what currently works and what doesn&#8217;t.<br />
<br/><br/>
<ol class="footnotes">
<li id="footnote_0_1084" class="footnote">&#8220;thrift store&#8221;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2012/01/mesada-flexiview-fv-1-androidtv-technical-review/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Notes using scratchbox2 with debian multiarch</title>
		<link>http://projectgus.com/2011/12/notes-using-scratchbox2-with-debian-multiarch/</link>
		<comments>http://projectgus.com/2011/12/notes-using-scratchbox2-with-debian-multiarch/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 08:20:45 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[cross-compilation]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scratchbox]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1053</guid>
		<description><![CDATA[I'm a very recent (3 days) user of scratchbox2 for cross-compiling. I have found that scratchbox2 (as of 2.3.3) is a bit fiddly when targeting Debian multiarch (wheezy/sid aka testing/unstable.) Here are my notes about what I tweaked...]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m a very recent (3 days) user of scratchbox2 for cross-compiling. My initial response was &#8220;this is crazy magic&#8221; awe, followed shortly by &#8220;this is a crazy mountain of hacks&#8221; skepticism. However, after some use &#038; success now, it seems to be a really neat tool.</p>
<p><span id="more-1053"></span>The best introductions to scratchbox2 that I&#8217;ve found are <a href="http://www.plugcomputer.org/plugwiki/index.php/Scratchbox2_based_cross_compiling">this wiki page from the plugcomputing people</a>, and this <a href="http://www.daimi.au.dk/~cvm/sb2.pdf">nice succinct set of presentation slides from Riku Voipi</a>.</p>
<p>One of the big annoyances has been seeking information, Google likes to replace sb2 (the main scratchbox2 command) with db2 and scratchbox2 with scratchbox.</p>
<h2>Multiarch</h2>
<p>I have found that scratchbox2 (as of 2.3.3) is a bit fiddly when targeting Debian wheezy or sid (testing or unstable.) This is due to the new <a href="http://wiki.debian.org/Multiarch/Implementation">Debian Multiarch</a> support. </p>
<p>In a nutshell, multiarch means libraries and tools are moving from locations like /usr/lib to arch-specific locations like /usr/lib/[triplet] where triplet identifies the architecture, ie arm-linux-gnueabi for ARM systems.</p>
<p>The symptoms I saw were linking errors (or configuration failures) due to missing libraries, when you know they are installed on the target. The crucial test is whether &#8220;sb2 [some-simple-command]&#8221; fails while &#8220;sb2 -e [same-simple-command]&#8221; passes &#8211; this implies that the problem is in the host translation, not in the target (otherwise it would fail in the -e qemu&#8217;d environment, as well.)</p>
<p>Here&#8217;s what worked for me. In the file <i>~/.scratchbox2/[TARGETNAME]/gcc.config.lua</i>, I sought out and changed the following two config items as follows, to add linker search paths:</p>
<pre>
extra_cross_compiler_args="   -L@SBOX_TARGET_ROOT@/usr/lib -L@SBOX_TARGET_ROOT@/usr/lib/arm-linux-gnueabi -L@SBOX_TARGET_ROOT@/lib  -L@SBOX_TARGET_ROOT@/lib/arm-linux-gnueabi",

extra_cross_ld_args="-rpath-link @SBOX_TARGET_ROOT@/usr/lib/arm-linux-gnueabi:@SBOX_TARGET_ROOT@/usr/lib:@SBOX_TARGET_ROOT@/lib:@SBOX_TARGET_ROOT@/lib/arm-linux-gnueabi",
</pre>
<p>I also ran the command</p>
<pre>
sb2-config setenv PKG_CONFIG_PATH /usr/lib/pkgconfig/:/usr/lib/arm-linux-gnueabi/pkgconfig/
</pre>
<p>(In all the above, replace <i>arm-linux-gnueabi</i> with your target architecture&#8217;s &#8220;triplet&#8221; of choice.)</p>
<p>As always, the solutions are simple and easy to follow once you know what they are. :) Please bear in mind also that this may not be the best solution, I&#8217;m still a scratchbox2 newbie.</p>
<h2>Distro Versions</h2>
<p>The other major gotcha, hinted at in the presentation I linked to, is that the host and the target distros must match exactly. If you have different library versions on each then you are headed for problems.</p>
<p>This can be tricky even when the distros match. At time of writing debian wheezy uses libc6-dev 2.13 on amd64 but <i>emdebian</i> wheezy uses libc6-dev-armel-cross 2.11 for the cross-compiler. The header files are different enough to cause builds to fail. To get matching headers I had to change to emdebian sid, which currently has libc6-dev-armel-cross 2.13.</p>
<p>An alternative, also hinted at in the presentation, is to set up a &#8220;tools&#8221; distro. This is a directory with a complete host-arch distribution, matching perfectly the target&#8217;s distro except for the architecture. It seems the idea there is to create a  controlled single-purpose environment, instead of just sharing the host&#8217;s tools. Maybe that&#8217;s a cleaner path, especially if it lets you sandbox a stable distro release with predictable versions.</p>
<h2>(Extended Rant, Feel Free to Ignore)</h2>
<p>The header-mismatch problem seems to be caused because programs compiled under sb2 can search for headers in both the host directory /usr/include/, and also in the cross-compiler directory (ie /usr/arm-linux-gnueabi/include/), -and- in the target rootfs directory.</p>
<p>Exactly which header file gets chosen for which purpose seems to be somewhat haphazard &#8211; in the example I saw, a #include &lt;fcntl.h&gt; was pulling in /usr/include/fcntl.h which was then pulling /usr/arm-linux-gnueabi/include/bits/stat.h.</p>
<p>I haven&#8217;t dug deep enough into sb2 to see what&#8217;s really going on here with gcc include paths, but it <i>seems</i> like it should be possible to workaround this and ignore the host&#8217;s headers entirely &#8211; in favour of the cross-compiler headers &#038; those installed in the target rootfs.</p>
<p>However, passing these paths explicitly is exactly the kind of drudgery that sb2 tries to avoid with its &#8220;magic&#8221;, so at this stage I&#8217;m leaving it &#8211; my program compiles &#038; links, so that&#8217;s good enough for now. If I end up having to explicitly set everything then I may as well create a conventional cross-compiler environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2011/12/notes-using-scratchbox2-with-debian-multiarch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Notes on FTDI latency with Arduino</title>
		<link>http://projectgus.com/2011/10/notes-on-ftdi-latency-with-arduino/</link>
		<comments>http://projectgus.com/2011/10/notes-on-ftdi-latency-with-arduino/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 11:42:10 +0000</pubDate>
		<dc:creator>angus</dc:creator>
				<category><![CDATA[Techy]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[FTDI]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://projectgus.com/?p=1010</guid>
		<description><![CDATA[Some notes about the FTDI Latency Timer, and how to set it for optimum latency on Linux, Windows and OS X.]]></description>
				<content:encoded><![CDATA[<p>Today I Learned how to minimise latency when sending data to a computer from an Arduino (or any other FTDI-based device.) I learned it specifically for Windows, Linux and OS X.</p>
<p><span id="more-1010"></span>Well, actually I learned this a few weeks ago while developing the <span style="white-space: nowrap;"><a href="http://projectgus.github.com/hairless-midiserial">Hairless MIDI<->Serial Bridge</a></span>. But the blog post had to wait until today.</p>
<h2>The Problems</h2>
<ul>
<li>By default, serial latency with FTDI chips (including Arduino Duemilanove/Mega) on Windows &#038; Linux can be quite high (>16ms) and unpredictable.
<li>In audio applications (like sending MIDI data), this can add enough latency to create audible artifacts.
<li>In Java-based applications that use it, librxtx introduces an <a href="http://neophob.com/2011/04/serial-latency-teensy-vs-arduino/">additional 20ms of latency</a>. I wasn&#8217;t using Java or librxtx, but you&#8217;ll want to read that if you are.
</ul>
<p>The good news is that you can reduce FTDI latency substantially with a simple tweak.</p>
<h2>What&#8217;s Latency?</h2>
<p>In this case, latency is the amount of time between when some data gets sent from one side (the Arduino), and received on the other side (the computer.)</p>
<p>In lots of cases latency doesn&#8217;t matter, or you accept higher latency in exchange for higher throughput. However, for real-time applications like MIDI controllers, you don&#8217;t want a noticeable delay between pressing a button and hearing the sound that it makes.</p>
<p>The consensus seems to be that for acceptable MIDI audio responses, you need to keep MIDI message latency under about 20ms.</p>
<h2>FTDI Latency Timer</h2>
<p>The problem stems from the Arduino&#8217;s &#8220;Serial to USB converter&#8221; chip, the FTDI FT232R. The FTDI can&#8217;t send a USB packet to the computer for every byte that comes from the Arduino&#8217;s microcontroller. Instead, it stores the serial data in an internal buffer and only sends a USB packet when the buffer is full, or after a period of time has elapsed. This period of time is determined by the FTDI Latency Timer, which is the reason why FTDI chips can give bad latency characteristics.</p>
<p>On Linux &#038; Windows, the default latency timer setting is 16ms. For example, say you send a 3 byte MIDI message from your Arduino at 115200bps. As serial data, it takes 0.3ms for the MIDI message to go from the Arduino&#8217;s microcontroller to the FTDI chip. However, the FTDI holds the message in its buffer for a further 15.8ms (16ms after the first byte arrived), before the latency timer expires and it sends a USB packet to the computer.</p>
<p>Thankfully, the latency timer can be tweaked. The tweaking method varies between operating systems.</p>
<h2>Linux</h2>
<p>In proper Linux style, the kernel&#8217;s FTDI driver exposes a nice sysfs interface that lets you get and set the latency timer. For example, if your serial port is ttyUSB0:</p>
<div align="left">
<pre>
# cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
16
# echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
# cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
1
</pre>
</div>
<p>&#8230; that will lower the timer from 16ms to 1ms (the minimum), to reduce latency.</p>
<p>In my experience, the timer value won&#8217;t change immediately on an open serial port. If an application is using it then you&#8217;ll need to close and reopen it before the new value takes effect.</p>
<p>If you&#8217;re writing code, there is also a Linux-specific serial flag ASYNC_LOW_LATENCY that programmatically sets the latency timer down to 1ms. This is how <a href="http://projectgus.github.com/hairless-midiserial">Hairless MIDI<->Serial Bridge</a> does it. You can see a succinct <a href="https://bugs.launchpad.net/ttymidi/+bug/822129">C code example in this patch</a> I submitted to the ttyMIDI project.</p>
<p>In testing, I found that ASYNC_LOW_LATENCY also only works if you subsequently close the serial port and then reopen it (annoying, because setting the flag requires you have open()ed it already.)</p>
<h2>Windows</h2>
<p>FTDI&#8217;s own driver for Windows has a combo box in the Port Settings dialog that lets you choose the latency timer value. <a href="http://www.instructables.com/id/Lampduino-an-8x8-RGB-Floor-Lamp/step20/Reducing-FTDI-Serial-Latency/">This Instructable</a> has some screen shots showing how to find the setting in the Windows Device Manager control panel.</p>
<p>Programmatically, setting the timer is a bit hackier on Windows but not impossible. The FTDI driver saves the current latency setting for each device in the registry, so you can use Microsoft&#8217;s Registry API to write a new value, then reopen the serial port.  The registry key is
<pre>SYSTEM\CurrentControlSet\Enum\FTDIBUS\-device id-\0000\Device Parameters</pre>
<p>There is a <a href="https://github.com/projectgus/hairless-midiserial/blob/master/src/PortLatency_win32.cpp">code example for this hack in the Hairless MIDI<->Serial source code</a>. </p>
<h2>OS X</h2>
<p>OS X does things differently. The driver bundle contains a file, <i>/System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist</i>. This XML plist file describes different profiles for the serial port, including different LatencyTimer values, depending on how the FTDI identifies itself on the USB bus. FTDI&#8217;s own <a href="http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_105%20Adding%20Support%20for%20New%20FTDI%20Devices%20to%20Mac%20Driver.pdf">Technical Note on the subject [PDF]</a> explains how to edit that value to change the latency.</p>
<p>The good news is that on OS X the latency timer defaults to 2ms for any FTDI FT232 that uses the default vendor &#038; device USB IDs (0403:6001). This includes Arduino &#038; clone FTDIs, so there is no real need to change anything.</p>
<h2>How Fast?</h2>
<p>I ran a test of the tweaked latency timers. The test sketch sends a MIDI note (3 bytes), then waits to see that same note echoed back. It does this many times and calculates the average delay.</p>
<p>With the latency timer set to 1-2ms, the entire round trip averages 18-19ms. This includes at least 1ms spent in the MIDI framework on the computer. So, based on those results, I estimate the one-way latency to be under 10ms. Excellent!</p>
<p>With a 16ms latency timer, the one-way latency would have been 25ms or more.</p>
<p>I don&#8217;t know how much of the 10ms latency is now coming from FTDI/USB layer, or from higher layers in the host operating system. It&#8217;s good enough for MIDI use, so I stopped investigating!</p>
<h2>Which Arduinos?</h2>
<p>Arduinos with FTDI chips include the Arduino Duemilanove &#038; Mega, and some clones like the Seeeduino.</p>
<p>The newer Arduino Uno &#038; Mega 2560 have a different AtMegaU8 chip, programmed to behave as a USB/Serial converter. According to <a href="http://neophob.com/2011/04/serial-latency-teensy-vs-arduino/">tests I&#8217;ve seen</a>, these have good latency characteristics.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectgus.com/2011/10/notes-on-ftdi-latency-with-arduino/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.268 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-05-20 03:05:44 -->
