<?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>petertyser.com &#187; Projects</title>
	<atom:link href="http://www.petertyser.com/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.petertyser.com</link>
	<description>Just another website</description>
	<lastBuildDate>Fri, 03 Dec 2010 06:36:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Nabaztagtag (Nabaztag v2) Dissection</title>
		<link>http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/</link>
		<comments>http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/#comments</comments>
		<pubDate>Sun, 11 Mar 2007 06:36:34 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/</guid>
		<description><![CDATA[<p>I received a Nabaztag/tag from my girlfriend this Christmas, bless her soul:) For those not familiar with the Nabaztag, check out <a href="http://en.wikipedia.org/wiki/Nabaztag">Wikipedia's page about it</a>.</p>The Nabaztag/tag is the 2nd generation of the Nabaztag and adds a few new features on top of the 1st generation Nabaztag. There is a relatively strong Nabaztag community on the internet. Quite a few sites exists with neat software hacks and documentation that allow users to have some control of the device. However, I hadn't seen anyone really take advantage of the hardware in any way other than what Nabaztag's inventors intended. From what I gather, its possible to run bytecode on a "virtual machine" on the Nabaztag, but that doesn't give you complete access to the Nabaztag's hardware.<br />
It would be great to gain complete control of the Nabaztag - ie download a custom version of the firmware such that you would have complete control of the processor and peripherals. This would be a fun project, and might open up the possibility of adding additional sensors or output devices to the Nabaztag to expand its features.<br />
In a perfect world, the firmware for the Nabaztag would be stored in a nice, neat, extractable flash chip which could be easily removed, backed-up, replaced, modified, etc. Alas, Violet was not so considerate:) During my investigation I had to dismantle the Nabaztag. I snapped some pictures during this process which you can find below.<br />
<br />]]></description>
			<content:encoded><![CDATA[<p>I received a Nabaztag/tag from my girlfriend this Christmas, bless her soul:) For those not familiar with the Nabaztag, check out <a href="http://en.wikipedia.org/wiki/Nabaztag">Wikipedia&#8217;s page about it</a>.</p>
<p>The Nabaztag/tag is made by a company called Violet. It is Violet&#8217;s 2nd generation Nabaztag and adds a few new features on top of the 1st generation. There is a relatively strong Nabaztag community on the internet. Quite a few sites exists with neat software hacks and documentation that allow users to have some control of the device. However, I hadn&#8217;t seen anyone really take advantage of the hardware in any way other than what Nabaztag&#8217;s inventors intended. From what I gather, its possible to run bytecode on a &#8220;virtual machine&#8221; on the Nabaztag, but that doesn&#8217;t give you full access to the Nabaztag&#8217;s hardware.</p>
<p>It would be great to gain complete control of the Nabaztag &#8211; ie download a custom version of the firmware such that you would have complete control of the processor and peripherals. This would be a fun project, and might open up the possibility of adding additional sensors or output devices to the Nabaztag to expand its features. Additionally, it would open the door to using server implementations completely unassociated with Violet, which occasionally has &#8220;service problems&#8221;.</p>
<p>In a perfect world, the firmware for the Nabaztag would be stored in a nice, neat, extractable flash chip which could be easily removed, backed-up, replaced, modified, etc. Alas, Violet was not so considerate:) During my investigation I had to dismantle the Nabaztag. I snapped some pictures during this process:</p>
<p><span id="more-58"></span></p>
<div style="text-align: center;">
  
</div>
<div style="text-align: left;">
  Some details are discussed after the pictures.
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <img src="http://www.petertyser.com/wp-content/uploads/2008/03/nabaztagtag.jpg" width="225" height="427" alt="nabaztagtag.jpg" />
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Stock Nabaztagtag, fresh out of the box.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/assembled-front.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/assembled-front-tm.jpg" width="225" height="299" alt="assembled_front.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Ears and cover removed. You can see the 4 LED directional cones, microphone at the base, and RFID module (PCB in center with brown, red, orange, and yellow wires coming out of it).</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/chassis-front.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/chassis-front-tm.jpg" width="225" height="342" alt="chassis_front.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">View from front with antenna, PCB, and base removed. The grey wire with gold connector connects the wireless module to the green PCB shown in the picture below which is assumed to be an 802.11g antenna.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/chassis-back.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/chassis-back-tm.jpg" width="225" height="337" alt="chassis_back.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">View from back with base removed. Large green PCB connects to wireless module.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/base.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/base-tm.jpg" width="225" height="232" alt="base.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Base viewed from above.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/antenna-front.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/antenna-front-tm.jpg" width="225" height="196" alt="antenna_front.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Front of RFID module after removal. 13.560 MHz oscillator and <span style="font-style: normal;"><span style="font-style: italic;">STMicro CR14</span> <span style="font-style: italic;">contact-less coupler are visible.</span></span></span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/antenna-back.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/antenna-back-tm.jpg" width="225" height="244" alt="antenna_back.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Back of RFID module after removal.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/mainboard-front.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/mainboard-front-tm.jpg" width="225" height="157" alt="mainboard_front.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Mainboard front.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/mainboard-back.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/mainboard-back-tm.jpg" width="225" height="148" alt="mainboard_back.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Mainboard back.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/wireless.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/wireless-tm.jpg" width="225" height="132" alt="wireless.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Ralink 802.11g wireless USB module using <span style="font-style: normal;"><span style="font-style: italic;">RT2571W chipset</span><span style="font-style: italic;">.</span></span></span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/oki630eb04j.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/oki630eb04j-tm.jpg" width="225" height="226" alt="oki630eb04j.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">OKI ML67Q4051 33 MHz ARM7-TDMI processor.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/oki6295b08j.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/oki6295b08j-tm.jpg" width="225" height="219" alt="oki6295B08j.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">OKI ML60842 USB 2.0 On-the-go controller.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/dram.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/dram-tm.jpg" width="225" height="153" alt="dram.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Samsung K6X8016T3B 1 Mbyte (512K x 16 bit) CMOS SRAM.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <span style="color: #0000EE; text-decoration: underline;"><br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/vlsi1.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/vlsi-tm1.jpg" width="225" height="213" alt="VLSI.jpg" /></a></span>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">VLSI VS1003B MP3/WMA/WAV/MIDI decoder, ADPCM encoder.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/tlc5922.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/tlc5922-tm.jpg" width="225" height="202" alt="TLC5922.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">Texas Instruments TLC5922 16-bit LED driver.</span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/stcf616.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/stcf616-tm.jpg" width="225" height="181" alt="STCF616.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">STMicro 393? Dual CMOS Comparator? Used to control ear servos?<br /></span>
</div>
<div style="text-align: center;">
  
</div>
<div style="text-align: center;">
  <br />
  <a href="http://www.petertyser.com/wp-content/uploads/2008/03/regulator.jpg"><img src="http://www.petertyser.com/wp-content/uploads/2008/03/regulator-tm.jpg" width="225" height="177" alt="regulator.jpg" /></a>
</div>
<div style="text-align: center;">
  <span style="font-style: italic;">LD1117L 3.3 V Regulator, STMicro L5973D 2.5 Amp switch step down switching regulator.</span>
</div>
<div style="text-align: center;">
  
</div>
<p></p>
<h3>&#8220;Important&#8221; Component Summary</h3>
<h4>OKI ML67Q4051 33MHz ARM7-TDMI processor</h4>
<ul>
<li>128 KB of &#8220;secure&#8221; internal flash</li>
<li>8KB &#8220;Boot Flash ROM&#8221;</li>
<li>16 KB internal RAM</li>
<li>Supports 32-bit instructions or 16-bit thumb instructions</li>
<li>JTAG interface</li>
<li>External memory controller</li>
<li>Peripherals &#8211; I2C, SPI, watchdog, RTC, timers, 4 ADCs, DMA controller, 2 UARTs</li>
</ul>
<h4>OKI ML60842 USB 2.0 OTG controller</h4>
<ul>
<li>Used to interface ARM processor with Ralink 80211b/g module</li>
</ul>
<h4>Samsung K6X8016T3B 512K x 16 bit CMOS SRAM</h4>
<ul>
<li>Additional 1MB of RAM available to ARM processor</li>
</ul>
<h4>(1 MB)VLSI VS1003B MP3/WMA/WAV/MIDI decoder, ADPCM encoder</h4>
<ul>
<li>Play streamed audio, encode voice commands</li>
</ul>
<h4>Texas Instruments TLC5922 16-bit LED driver</h4>
<ul>
<li>Drive belly button and nose LEDs</li>
<li>Serial data interface, SPI compatible</li>
</ul>
<h4>Ralink RT2571W-based USB 802.11b/g module</h4>
<ul>
<li>802.11b/g adapter</li>
<li>USB interface</li>
</ul>
<h4>STMicro CR14 contactless coupler with anti-collision, CRC management</h4>
<ul>
<li>Used for RFID</li>
<li>Supports ISO14443 type-B protocol</li>
<li>I2C interface</li>
</ul>
<p></p>
<h3>Analysis</h3>
<p>It looks like Violet did their homework and made it relatively hard to extract the firmware from the Nabaztag. The 128 KB of internal flash that is used to store the firmware has a security feature which will make it difficult to read. After Violet has programmed the firmware, they can put the enable a &#8220;security mode&#8221;. When this security mode is enabled, external devices (eg JTAG or parallel programmer) can no longer read or with the flash, or use the standard JTAG debug functionality of the chip. OKI describes this feature as follows:</p>
<p><span style="font-style: italic;">When a security bit is set, the contents of Flash ROM cannot be read or rewritten in Flash-JTAG mode. A debugging interface (ie JTAG) can no longer be used. The security bit can be reset after the chip contents are erased in Flash-JTAG mode or parallel programmer mode.</span></p>
<p>So if one were willing to erase their processor&#8217;s flash, they could then reprogram it with their own image. This means the Nabaztag is pretty easily reprogrammable, but it would be pretty difficult to reprogram it with any sort of useful image since its not possible to inspect the current Nabaztag firmware. Without reverse engineering the current firmware, it would be VERY difficult to port/write some of the current Nabaztag features such as the wireless card driver.</p>
<h3></h3>
<h3>Possible Workarounds</h3>
<p>A few possible ways to read the flash on the ARM processor came to mind. All would require a significant amount of work (and maybe not be possible at all:).</p>
<h3>Make Sure &#8220;Security Mode&#8221; is Enabled</h3>
<p>I made the assumption that Violet enabled the security mode on the processor do prevent reverse engineering. Unfortunately I don&#8217;t have a JTAG debugger compatible with the L67Q4051 to test this. The first thing to do would be to verify that security mode is in fact enabled. If anyone has an ARM JTAG debugger lying around or wanted to donate one to the cause, I&#8217;d be happy to look into it:)</p>
<h3>Use Serial Programming Interface</h3>
<p>The ARM processor has some configuration pins that affect how it operates when it comes out of reset. One combination of these configuration pins forces the processor to execute the Boot ROM flash (the 8KB, non-user reprogrammable flash) and allows the user to erase and reprogram the 128 KB of flash by downloading an image over the serial port. You can do it with a standard terminal emulator such as TeraTerm or minicom or with OKI&#8217;s own utility called ISFP which is available their its website.</p>
<p>The ISFP utility can actually dump the flash for other OKI chips like the ML674001 and ML675001. However, OKI says this feature is not available on the L67Q4051 which the Nabaztag uses. Its not clear to me whether this feature is truly disabled on the L67Q4051, or if OKI&#8217;s ISFP software just doesn&#8217;t allow it. Its a bit risky, but it may be possible to issue the same serial commands to the L67Q4051 that are known to work on the ML674001/ML675001.</p>
<h3>Use &#8220;User Mode&#8221; Programming interface to read the flash</h3>
<p>Code executing on the L67Q4051 is able to read the 128 KB of flash even when the &#8220;security mode&#8221; is enabled. If the code executing on the L67Q4051 could be comprised, it may be possible to execute a program which would read the flash contents and print it to the serial port. I imagine comprimising the L67Q4051 would be no trivial matter&#8230;</p>
<h3>Reverse Engineer Nabaztag Firmware Published by Violet</h3>
<p>Violet provides a firmware image at www.nabaztag.com/firmware/firmware.0.0.0.10.sim.txt. I&#8217;ve looked at this file a bit, and its not clear to me what format it is in or how the Nabaztag firmware interprets it. Its possible that this file could be reverse engineered to provide a firmware image that could be inspected in order to make a custom image for the Nabaztag.</p>
<h3>Reprogram &#8220;Fresh&#8221; Image</h3>
<p>Documentation for most of the peripherals are readily available. Source code is also available for the more complex components such as the VS1003B and Ralink wireless adapter. In theory, it would be possible to write Nabaztag firmware from scratch and not use the stock Nabaztag firmware as a reference at all. However, this would be VERY time consuming, and frankly, I don&#8217;t have that much time on my hands:)</p>
<h3>Conclusion</h3>
<p>Reprogramming the Nabaztag is straightforward and could be done with little effort. However, first extracting the firmware image to reverse engineer would pose a significant risk to bricking the Nabaztag and could take significant effort. If others have any additional info or thoughts, please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Website management python script</title>
		<link>http://www.petertyser.com/2006/01/22/website-management-python-script/</link>
		<comments>http://www.petertyser.com/2006/01/22/website-management-python-script/#comments</comments>
		<pubDate>Mon, 23 Jan 2006 05:42:21 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://petertyser.com/wordpress/2008/01/05/website-management-python-script/</guid>
		<description><![CDATA[This is a little script I created to help manage this website. It does 2 things: 1. It does basic macro expansion/replacement on html files. This allows html files to contain non-html tags which can be expanded into html based on the values in a configuration file. For instance, since every html file has the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a little script I created to help manage this website. It does 2 things:</p>
<p>1. It does basic macro expansion/replacement on html files. This allows html files to contain non-html tags which can be expanded into html based on the values in a configuration file. For instance, since every html file has the same header, its possible to include an &lt;auto_update_header&gt; tag in every html file and then have 1 definition of &lt;auto_update_header&gt; it in a configuration file. Its then easy to update the entire site&#8217;s html by modifying the configuration file and running update_html.py. This makes it easy to make sitewide changes and ensure all pages are up to date.</p>
<p>2. It &#8220;intelligently&#8221; uploads the website a webserver via FTP. It would be easier to use a standard FTP tool which could perform syncing, but there are many files that I don&#8217;t want to be uploaded (eg. .svn directories, non-gif or non-jpg images, etc). The FTP server address, username, and password as well as file and directories to be ignored can be specified in the same configuration file referenced above.<br />
The script is very simple at this point, but should evolve as this webpage does.</p>
<p><a href="http://petertyser.com/files/python/update_html.python">Download update_html.py</a><br />
<a href="http://petertyser.com/files/python/update_html_example.conf">Download update_html_example.conf</a><br />
<a href="http://petertyser.com/files/python/update_html_example.html">Download update_html_example.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.petertyser.com/2006/01/22/website-management-python-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Legofy&#8221; Gimp plugin</title>
		<link>http://www.petertyser.com/2006/01/05/legofy-gimp-plugin/</link>
		<comments>http://www.petertyser.com/2006/01/05/legofy-gimp-plugin/#comments</comments>
		<pubDate>Fri, 06 Jan 2006 05:41:09 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://petertyser.com/wordpress/2008/01/05/legofy-gimp-plugin/</guid>
		<description><![CDATA[This is a very simple script &#8220;legoizes&#8221; a standard image via the Gimp image editor. It was used to create the header image used on this website as seen above. The concept comes from Patrick Mahoney. To install, download legofy.py and put in in your gimp plug-in path (eg ~/.gimp-2.2/plug-ins/ or /usr/lib/gimp/2.0/plug-ins/ for me). You&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very simple script &#8220;legoizes&#8221; a standard image via the Gimp image editor. It was used to create the header image used on this website as seen above. The concept comes from <a href="http://polycrystal.org/tutorials/legomosaic.html">Patrick Mahoney</a>. To install, download legofy.py and put in in your gimp plug-in path (eg ~/.gimp-2.2/plug-ins/ or /usr/lib/gimp/2.0/plug-ins/ for me). You&#8217;ll also need to download two Lego patterns and put them in one of Gimp&#8217;s pattern directories (~/.gimp-2.2/patterns/ or /usr/lib/gimp/2.0/plugins/) Note that it is not perfect and it generally works best if you pixelize the image by hand before running the script. Let me know if you have any suggestions/comments.</p>
<p><a href="http://petertyser.com/files/python/legofy.python">Download legofy.py</a><br />
<a href="http://petertyser.com/files/python/lego_stud_20x20.pat">Download Lego Pattern</a><br />
<a href="http://petertyser.com/files/python/lego_stud_highlight_20x20.pat">Download Lego Highlight Pattern</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.petertyser.com/2006/01/05/legofy-gimp-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Motion-Based iPod Remote Control</title>
		<link>http://www.petertyser.com/2005/04/28/motion-based-ipod-remote-control/</link>
		<comments>http://www.petertyser.com/2005/04/28/motion-based-ipod-remote-control/#comments</comments>
		<pubDate>Thu, 28 Apr 2005 07:29:00 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://petertyser.com/wordpress/2006/01/31/motion-based-ipod-remote-control/</guid>
		<description><![CDATA[The goal of the motion-based iPod remote control was to design and build a remote control for the iPod that responds to a user&#8217;s motion. An accelerometer is used to detect the motion of a user. A microprocessor then interprets these movements and sends the appropriate commands to the iPod via its remote control port. [...]]]></description>
			<content:encoded><![CDATA[<p>The goal of the motion-based iPod remote control was to design and build a remote control for the iPod that responds to a user&#8217;s motion. An accelerometer is used to detect the motion of a user. A microprocessor then interprets these movements and sends the appropriate commands to the iPod via its remote control port.</p>
<p><span id="more-7"></span></p>
<h3><strong>Introduction</strong></h3>
<p>During the cold winter months in Wisconsin, avid iPod users find difficulty in comfortably controlling their MP3 player. In order to manipulate the touch-based iPod controls or Appleâ€™s standard remote control, pockets must be opened and gloves or mittens removed, losing precious heat to the cold. One possible solution would be to use general body motion to control the iPod as opposed to touch. This would require no dexterous tasks, only general movements</p>
<p>This same concept would also make controlling an iPod easier for active people (eg. riding a bike &#8211; you can keep your eyes on the road and donâ€™t have to use fingers) and those who lack dexterity and canâ€™t use their fingers to manipulate the iPod controls (eg. arthritis sufferers).<br />
Summary</p>
<p>The goal of the motion-based iPod remote control was to design and build a remote control for the iPod that responds to a userâ€™s motion. An accelerometer is used to detect the motion of a user. A microprocessor then interprets these movements and sends the appropriate commands to the iPod via its remote control port.</p>
<h3>Hardware Components</h3>
<ul>
<li><strong>iPod:</strong> If youâ€™re here, you probably know what one is. Check them out here if not: <a href="http://www.apple.com/ipod">www.apple.com/ipod</a>. This project is tailored to the 3rd generation iPod (and should be compatible with 4th, U2, photo, mini revs too), but can be adapted to work with any generation.</li>
</ul>
<ul>
<li><strong>Accelerometer</strong>: A Memsic MXD2125 accelerometer was used to sense the userâ€™s motion. It is a two dimensional accelerometer and senses acceleration in the range of -2g to 2g. It uses pulse width modulation (PWM) to output acceleration measurements. It measures both static and dynamic acceleration. Internally, it heats up a bubble of air and uses an array of thermocouples to detect its position and thus acceleration.</li>
</ul>
<ul>
<li><strong>Microcontroller: </strong>An ATmega8 microcontroller was chosen. It is an 8-bit AVR from Atmel. It polls the accelerometer for data, interprets the readings, and sends commands to the iPod. The ATmega8 was a bit overkill but had all the necessary features (Interrupts on IO pins, onboard UART, internal oscillator, 16-bit timer, etc) and also enough flash and memory to expand the remote in the future. An ATtiny2313 was also used during the development process.</li>
</ul>
<ul>
<li><strong>RS232 Line Level Converter: </strong>A Maxim MAX3233E RS232 line-level converter was used during development to translate the serial output of the microcontroller to RS232 voltage levels needed by a PCâ€™s serial port. Internal charge pumps are used in the MAX3233 which reduces necessary external circuitry.</li>
</ul>
<h3><strong>iPod Remote Port</strong></h3>
<p>The 3rd generation iPod has a remote connector on its top next to the headphone jack.</p>
<p>The remote connector has 4 pins- VCC, GND, TX data, and RX data. The remote connector supplies power to the remote control as well as receives its commands. For pinouts, check <a title="iPod remote pinout" href="http://www.maushammer.com/systems/ipod-remote/ipod-remote.html">here</a>.</p>
<p align="center"><img src="http://petertyser.com/wp-content/uploads/2008/01/ipod-top.jpg" alt="ipod top" width="228" height="120" /></p>
<p align="center"><em>Top of ipod 3rd Generation iPod viewed from above.</em></p>
<h3><strong>iPod Remote Protocol</strong></h3>
<p>In order for the ATmega8 to send commands to the iPod, it had to mimic the standard iPod remote control&#8217;s output. This reverse engineering of the iPod remote protocol can be done by hooking up an oscilloscope to the remote control Apple sells and monitoring its output when different buttons are pushed. Fortunately, this step had already been mostly done by someone else. The iPod remote uses a 7-byte standard 8N1 19200 baud serial protocol. The commands contain a checksum and you&#8217;ll also notice that the &#8220;command byte&#8221; (byte 6) using bitmapping so that multiple commands can be sent at once. The commands are defined as:</p>
<div style="MARGIN-LEFT: 2em; MARGIN-RIGHT: 0px" dir="ltr">
<ul>
<li><strong>Play/Pause:</strong> 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;01 0xFA</li>
<li><strong>Volume UP</strong>: 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;02 0xF9</li>
<li><strong>Volume DOWN:</strong> 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;04 0xF7</li>
<li><strong>Skip Ahead:</strong> 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;08 0xF3</li>
<li><strong>Skip Back:</strong> 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;10 0xEB</li>
<li><strong>Button Depress:</strong> 0xFF 0&#215;55 0&#215;03 0&#215;02 0&#215;00 0&#215;00 0xFB</li>
</ul>
</div>
<h3>Initial Prototype</h3>
<p>An initial prototype was created using a breadboard. It utilized an ATtiny2313 rather than the final ATmega8. Although the ATtiny2313 could have been used in the final implementation, its 2Kbyte flash limited its possibilities for growth. The accelerometer was soldered to a Memsic MXEB-002 eval board then connected to the breadboard via 4 wires. The accelerometer eval board (sans accelerometer) can be seen in the upper left of the image along with the rest of the prototype setup.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/breadboard-1.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/breadboard-1-small.jpg" alt="breadboard" width="225" height="169" /></a><br />
<em>Prototype setup.</em></p>
<h3>Schematic/PCB Creation</h3>
<p>The prototype circuit was drawn up by hand and was relatively straight-forward. The next step was to create an electronic version of the schematic and its corresponding PCB. PowerLogic and PowerPCB were used to create the schematic and PCB, respectively. To reduce the final size of the remote itself, the MAX3233E RS232 converter and programming circuitry was placed on an external &#8220;debug board&#8221; which would connects via a flat flex cable to the &#8220;remote board&#8221; which has the accelerometer and microcontroller.</p>
<p>The schematic entry was straight-forward, however the PCB layout was not quite as simple. Decals had to be created for non-standard symbols, design rules checked against the PCB fabricator rules, etc. This may be easy for someone with extensive experience, but was a new experience for me and took a good deal of time. PowerLogic and PowerPCB are designed to work together and thus when the schematic would change, the change could be &#8220;forwarded&#8221; to PowerPCB with little hassle. The process took a while, but was a good experience all-in-all. The final remote has 1 red power LED and 3 general purpose LEDs connected to some of the ATmega8&#8242;s spare IO pins. The packages were LLC8 for the accelerometer, TQFP32 for the ATmega8, and 603s for the discrete components.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/debug-setup.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/debug-setup-small.jpg" alt="debug setup" width="450" height="101" /></a></p>
<p align="center"><em>Debug setup Debug board (left) &lt;-&gt; Remote board (right).</em></p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/debug-sch.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/debug-sch-small.jpg" alt="debug sch" width="225" height="132" /></a><br />
<em>Debug board schematic Debug board schematic.</em></p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/remote-sch.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/remote-sch-small.jpg" alt="remote sch" width="225" height="225" /></a><br />
<em>Remote schematic Remote board schematic.</em></p>
<h3>Programming/Serial Debug</h3>
<p>As mentioned above, the &#8220;debug board&#8221; contained the circuitry necessary to program the ATmega8 via a PC parallel port as well as convert its serial I/O to standard RS232 serial port voltage levels. The &#8220;debug board&#8221; connects to the parallel and serial port of a PC via a RJ45 jack which split into two connectors. RJ45 headers were used on all ends of the cable and the serial and parallel connector had female RJ45 connectors on them. Only 7 signals were needed, so standard ethernet cable and RJ45 headers worked great. I&#8217;ll draw up a wiring diagram for the Programming/Serial cable one of these days (it can be derived from the schematic if necessary).</p>
<p>To connect the remote control to the iPod, a connector was fashioned using an old ISA card and some 2-row header pins. Berg pin connectors were crimped onto the ends of the wire then insulated with heat shrink. Credit goes to the the iPod Linux project for the idea. Check out putting Linux on your iPod while you&#8217;re at it.</p>
<p>An sp12 programmer was used to program the ATmega8. It is a software/hardware combo that has programming software under both Linux and Windows. It uses a standard parallel port. The sp12 hardware is located on the &#8220;debug board&#8221;.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/serial-programming-cable.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/serial-programming-cable-small.jpg" alt="serial programming cable" width="225" height="160" /></a><br />
<em>serial debug and programming cable Programming/Serial debug cable + headers.</em></p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/isa-connector.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/isa-connector-small.jpg" alt="isa connector" width="225" height="138" /></a><br />
<em>ipod remote connector based on old ISA card ISA connector-based remote connector.</em></p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/ipod-remote-port.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/ipod-remote-port-small.jpg" alt="ipod remote port" width="225" height="191" /></a><br />
<em>remote connector plugging into the ipod Connector + iPod.</em></p>
<h3>Result</h3>
<p>The final remote control was roughly the size of a quarter, slightly smaller than the standard Apple-supplied remote:)<br />
finished remote Final remote.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/finished-remote.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/finished-remote-small.jpg" alt="finished remote" width="225" height="227" /></a></p>
<h3>Software Components</h3>
<ul>
<li><strong>Development Environment: </strong>avr-gcc was used to compile code for the ATmega8. avr-gcc allows a host computer (x86 in my case) to cross-compile for an AVR target using the standard GNU tools like make, objcopy, ld, etc. avr-gcc is supported under both Windows and Linux(which I&#8217;d recommend:). All code for the project was written in C.</li>
</ul>
<ul>
<li><strong>AVR Programmer: </strong>As mentioned above, a sp12 programmer was used to download the compiled files to the ATmega8 via a PC parallel port. The software to program it is available for both Windows and Linux.</li>
</ul>
<h3>Reading Accelerations</h3>
<p>The MXD2125 accelerometer has two outputs &#8211; one for X accelerations, one for Y. These accelerations are represented by the duty cycle of a square wave. A 50% duty cycle is equivalent of 0g. Duty cycle&#8217;s above 50% are positive accelerations, duty cycles below 50% are negative accelerations. A formula provided by Memsic converts the duty cycle reading into acceleration. To read the accelerations, the INT0 and INT1 pins of the ATmega8 were connected to the MXD2125 outputs. These pins allow triggering of external interrupts. Additionally, they can be configured to trigger on positive or negative edges, or logic level changes. This allows the ATmega8 to read the duty cycle using the following process:</p>
<ul>
<li>Interrupt on a positive edge, record the time</li>
<li>Reconfigure the pin to trigger on a negative edge</li>
<li>Interrupt on negative edge, record time</li>
<li>Disable interrupts on the pin</li>
<li>Repeat the process on the other input, thus reading both accelerations</li>
</ul>
<p>These times in addition to the constant period of the MXD2125 output can then be used to calculate the duty cycles, and thus the accelerations.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/duty-calculation.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/duty-calculation-small.jpg" alt="duty calculation" width="225" height="90" /></a></p>
<p align="center"><em>Interrupt-based duty cycle calculation.</em></p>
<h3>Interpreting Accelerations</h3>
<p>This was definitely the hardest part of the remote. The accelerometer detects both static and dynamic acceleration in 2 dimensions. Therefore, it can detect movement in a plane, or, using simple geometry, the angle of tilt of the sensor. The angle of tilt is measuring what portion of Earth&#8217;s gravity is acting horizontally on the sensor rather than acceleration caused by movement.</p>
<p>Since everyone moves at different rates while gravity is constant, it is much easier to accurately detect tilts. Thus the angle of tilt of the accelerometer was most often used in the algorithm to interpret commands. A state machine was then implemented in software which would interpret the user&#8217;s motions into commands. To prevent the remote from generating random commands while running, waving, etc, the remote must be put into a &#8220;command mode&#8221; by holding the remote flat for approximately 1 second before it begins issuing commands. Once the remote begins accepting commands, multiple commands can be issued until the remote is held still for approximately 1 more second.</p>
<p>The movements could be more complex, but for the purposes of a prototype, the above worked fine and demonstrated the remote&#8217;s functionality. In the movie section below, you can see a different detection algorithm that responds to circular motions to control volume.</p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/tilt-calculation.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/tilt-calculation-small.jpg" alt="tilt calculation" width="225" height="218" /></a></p>
<p align="center"><em>Tilt calculation.</em></p>
<p align="center"><a href="http://petertyser.com/wp-content/uploads/2008/01/state-machine.jpg"><img src="http://petertyser.com/wp-content/uploads/2008/01/state-machine-small.jpg" alt="state machine" width="225" height="174" /></a><br />
<em>Command recognition stat machine.</em></p>
<h3>Source Code</h3>
<p>To be released&#8230;</p>
<h3>Result</h3>
<p>The final result was a success. The Motion-Based iPod remote control met the goals set out at the beginning of the semester. It was a lot of fun to design and it I got two independent study credits out of it to boot:) It won first prize for individuals at the University of Wisconsin Engineering Expo this fall as well. The final implementation was programmed to be worn on the user&#8217;s wrist, but could be reprogrammed to be worn on a headphone, in a pocket, etc. I&#8217;m currently pursuing the possibility of getting the remote or some of its technology patented via the <a href="http://www.warf.ws">Wisconsin Alumni Research Foundation</a>.</p>
<h3>Future Possibilities</h3>
<ul>
<li>More complex motion detection</li>
<li>Wireless</li>
<li>3D accelerometer</li>
<li>TV/DVD/VCR/etc remote</li>
<li>Audio feedback</li>
</ul>
<h3>Movies</h3>
<div style="text-align:center;"><a href="http://petertyser.com/movies/tilt_control.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/tilt-control-mov.jpg" border="0" alt="tilt_control_mov.jpg" width="240" height="320" /></a></div>
<p align="center"><em>This movie demonstrates the Play, Volume Down, Volume UP, Fast Forward, and Pause commands.</em></p>
<div style="text-align:center;"><a href="http://petertyser.com/movies/close_up.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/close-up-mov.jpg" border="0" alt="close_up_mov.jpg" width="240" height="320" /></a></div>
<p align="center"><em>This movie is a close-up demonstration of a Pause, Play, Volume Down, Volume Up, Fast Forward, and Rewind commands. Notice the small amber LED on the remote. When lit, it signals that it is ready to accept commands. Another amber LED blinks when a command it sent giving visual feedback to the user.</em></p>
<div style="text-align:center;"><a href="http://petertyser.com/movies/wax_on_volume.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/wax-on-volume-mov1.jpg" border="0" alt="wax_on_volume_mov.jpg" width="320" height="240" /></a></div>
<p align="center"><em>This movie demonstrates an alternate detection algorithm to detect volume up and down commands. The remote is configured to interpret clockwise circular motions as &#8220;Volume Up&#8221; and counter-clockwise circular motions as &#8220;Volume Down&#8221;. It is meant to allow the user to mimic the scroll wheel finger motion with their arm. More creative patterns could be developed. Mr. Miyagi would be proud&#8230;</em></p>
<div style="text-align:center;"><a href="http://petertyser.com/movies/volume_mov.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/volume-mov-prev.jpg" border="0" alt="volume_mov_PREV.jpg" width="160" height="120" /></a></div>
<p align="center"><em>In the movie, the remote is shook (like it would be in a real world situation if it were strapped to your wrist) No commands are sent while it is being moved since it is in a &#8220;Wait&#8221; state. After it is held flat for 1 second, an LED lights up signaling it is ready to accept a command. Each time the remote is tilted upwards, the volume on the iPod increases and a LED on the remote flashes showing the user that a command has been sent. Tilting the remote downward would decrease the volume similarly. The remote is held flat for 1 second to put it back into the &#8220;Wait&#8221; mode.</em></p>
<div style="text-align:center;"><a href="http://petertyser.com/movies/pause_play_mov.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/pause-play-mov-prev.jpg" border="0" alt="pause_play_mov_PREV.jpg" width="160" height="120" /></a></div>
<p align="center"><em>In the movie, the remote is shook (like it would be in a real world situation if it were strapped to your wrist) No commands are sent while it is being moved since it is in a &#8220;Wait&#8221; state. After it is held flat for 1 second, an LED lights up signaling it is ready to accept a command. When the remote is moved quickly left to right, a Pause command is sent to the iPod and a LED on the remote flashes showing the user that a command has been sent. The above process is repeated to issue the Play command.</em></p>
<div style="text-align:center;"><a href="http://petertyser.com/movies/ff_rew_mov.avi"><img src="http://petertyser.com/wp-content/uploads/2008/02/ff-rew-mov-prev.jpg" border="0" alt="ff_rew_mov_PREV.jpg" width="160" height="120" /></a></div>
<p align="center"><em>In the movie, the remote is shook (like it would be in a real world situation if it were strapped to your wrist) No commands are sent while it is being moved since it is in a &#8220;Wait&#8221; state. After it is held flat for 1 second, an LED lights up signaling it is ready to accept a command. Each time the remote is tilted to the right, the iPod skips the the next track and a LED on the remote flashes showing the user that a command has been sent. Each time the remote is tilted to the left, the iPod skips to the previous track and a LED on the remote flashes showing the user that a command has been sent. In the movie, the remote skips ahead two songs, then skips back one song.</em></p>
<h3>Datasheets/Links</h3>
<ul>
<li><a href="http://www.memsic.com/memsic/products/product.asp?prodid=40">MXD2125 2D Accelerometer</a></li>
<li><a href="http://www.atmel.com/dyn/products/product_card.asp?part_id=2004">Atmel ATmega8 Microcontroller</a></li>
<li><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2008">Maxim MAX3233E RS232 Level Converter</a></li>
<li><a href="http://gcc.gnu.org/">gcc</a> + <a href="http://savannah.nongnu.org/projects/avr-libc/">avrlibc</a></li>
<li><a href="http://www.maushammer.com/systems/ipod-remote/ipod-remote.html">iPod Remote Control Protocol</a></li>
<li><a href="http://www.xs4all.nl/%7Esbolt/e-spider_prog.html">sp12 AVR Programmer</a></li>
</ul>
<h3>Questions, Comments?</h3>
<p>I probably didn&#8217;t do the best explaining certain aspects of the project, so if you have questions or comments, email me @ petertyser @ nospam (dot ) gmail (dot) com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petertyser.com/2005/04/28/motion-based-ipod-remote-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://petertyser.com/movies/close_up.avi" length="2461480" type="video/x-msvideo" />
<enclosure url="http://petertyser.com/movies/tilt_control.avi" length="2358756" type="video/x-msvideo" />
<enclosure url="http://petertyser.com/movies/wax_on_volume.avi" length="1566158" type="video/x-msvideo" />
<enclosure url="http://petertyser.com/movies/volume_mov.avi" length="1120646" type="video/x-msvideo" />
<enclosure url="http://petertyser.com/movies/pause_play_mov.avi" length="1808112" type="video/x-msvideo" />
<enclosure url="http://petertyser.com/movies/ff_rew_mov.avi" length="1855882" type="video/x-msvideo" />
		</item>
		<item>
		<title>Internet Enabled Data Logger</title>
		<link>http://www.petertyser.com/2002/07/15/data_logger/</link>
		<comments>http://www.petertyser.com/2002/07/15/data_logger/#comments</comments>
		<pubDate>Mon, 15 Jul 2002 06:31:23 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://petertyser.com/wordpress/2008/02/28/data_logger/</guid>
		<description><![CDATA[My sophmore year in college I did an independent study to create a data logger that could function like a normal data logger, or, post the conents of the logger to the internet. This would allow someone to watch the results of a long-term experiment from any computer with internet access rather than having to [...]]]></description>
			<content:encoded><![CDATA[<p>My sophmore year in college I did an independent study to create a data logger that could function like a normal data logger, or, post the conents of the logger to the internet. This would allow someone to watch the results of a long-term experiment from any computer with internet access rather than having to be on-site to monitor the experiment.</p>
<p><span id="more-43"></span></p>
<h2>(Limited) Details</h2>
<p>A Basic Stamp 2 was used in conjunction with ADCs and other external circuitry to record data. The data logger could be connected to a computer via a serial port. The host PC could then read the data from the Basic Stamp 2 and post it to the internet. The software running on the PC was written in Visual Basic (Uck&#8230;) and implemented a very trimmed down web server to post the results so that they could be viewed using a standard web browser.</p>
<h2>Result</h2>
<p>All in all, the project was relatively straightforward. It was a good intro to a simple embeded system and I got 3 credits from it, which I can&#8217;t complain about. The schematics and source code have been lost in the clutter of my room&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petertyser.com/2002/07/15/data_logger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

