<?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>sundh.com</title>
	<atom:link href="http://www.sundh.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sundh.com/blog</link>
	<description>Technology / Wood / Electronics</description>
	<lastBuildDate>Thu, 19 Jan 2012 11:54:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Develop for Android on your Mac</title>
		<link>http://www.sundh.com/blog/2012/01/develop-for-android-on-your-mac/</link>
		<comments>http://www.sundh.com/blog/2012/01/develop-for-android-on-your-mac/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 11:53:24 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ADT Plugin]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=813</guid>
		<description><![CDATA[Here is a short tutorial on how to install all you need for Android development on a Mac.
1. Download Eclipse 3.2, 3.3 (Europa) for your Mac on:
http://www.eclipse.org/downloads/
2. Download the Android SDK from here:
http://developer.android.com/sdk/index.html
2. Once you installed the SDK you can get the latest update from this command-line command by
executing:

tools/android update sdk

3. Install the ADT plugin
- [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a short tutorial on how to install all you need for Android development on a Mac.</p>
<p>1. Download Eclipse 3.2, 3.3 (Europa) for your Mac on:<br />
<a href="http://www.eclipse.org/downloads/" rel="nofollow">http://www.eclipse.org/downloads/</a></p>
<p>2. Download the Android SDK from here:<br />
<a href="http://developer.android.com/sdk/index.html" rel="nofollow">http://developer.android.com/sdk/index.html</a></p>
<p>2. Once you installed the SDK you can get the latest update from this command-line command by<br />
executing:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">tools<span class="sy0">/</span>android update sdk</div>
</div>
<p>3. Install the ADT plugin<br />
- Start Eclipse, then select Help ]]&gt; Install New Software&#8230;<br />
- Click on add and the window below will appear. Input the URL <a href="https://dl-ssl.google.com/android/eclipse/" rel="nofollow">https://dl-ssl.google.com/android/eclipse/</a>. Use http if https does not work. Name it &#8220;ADT Plugin&#8221;.</p>
<p><a href="http://www.sundh.com/blog/wp-content/uploads/2012/01/android_adt_plugin.png"><img src="http://www.sundh.com/blog/wp-content/uploads/2012/01/android_adt_plugin.png" alt="android_adt_plugin" title="android_adt_plugin" width="640" height="318" class="alignnone size-full wp-image-816" /></a></p>
<p>- Click on Next, and then Next agian and accept the license agreements. Click on Finish.<br />
- Restart Eclipse</p>
<p>4. Create an AVD Manager<br />
- In order to run our Android app on the Mac we need to set up an Android Virtual Device in Eclipse.<br />
Window > AVD Manager<br />
- Create a new AVD by clicking on new<br />
- Type in the name of your avd, in my case my_avd<br />
- Choose a target.<br />
The target is the platform (that is, the version of the Android SDK, such as 2.3.3) you want to run on the emulator. I chose the latest one I got.<br />
- Click create!<br />
<a href="http://www.sundh.com/blog/wp-content/uploads/2012/01/android_virtual_device_manager.png"><img src="http://www.sundh.com/blog/wp-content/uploads/2012/01/android_virtual_device_manager.png" alt="android_virtual_device_manager" title="android_virtual_device_manager" width="397" height="592" class="alignnone size-full wp-image-818" /></a></p>
<p>5. Now you are up and running!<br />
Why not start with a simple Hello World:<br />
<a href="http://developer.android.com/resources/tutorials/hello-world.html" rel="nofollow">http://developer.android.com/resources/tutorials/hello-world.html</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2012/01/develop-for-android-on-your-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Ehternet access just got smaller</title>
		<link>http://www.sundh.com/blog/2012/01/small-ehternet-access-just-got-smaller/</link>
		<comments>http://www.sundh.com/blog/2012/01/small-ehternet-access-just-got-smaller/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 21:08:37 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino shield]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[freetronics]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=805</guid>
		<description><![CDATA[
The Arduino Ethernet shield has been around for some time now. It&#8217;s a great solution for cutting out the middle man of the computer when check things online from the Arduino. In order to build smaller cases I stumbled upon EtherTen from Freetronics. It&#8217;s a fully Arduino-compatible board that runs Arduino code AND connects to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sundh.com/blog/wp-content/uploads/2012/01/ethernet.jpg"><img src="http://www.sundh.com/blog/wp-content/uploads/2012/01/ethernet.jpg" alt="ethernet" title="ethernet" width="680" height="306" class="alignnone size-full wp-image-806" /></a></p>
<p>The <a href="http://arduino.cc/en/Main/ArduinoEthernetShield">Arduino Ethernet shield</a> has been around for some time now. It&#8217;s a great solution for cutting out the middle man of the computer when check things online from the Arduino. In order to build smaller cases I stumbled upon <a href="http://www.freetronics.com/products/etherten">EtherTen</a> from <a href="http://www.freetronics.com/">Freetronics</a>. It&#8217;s a fully Arduino-compatible board that runs Arduino code AND connects to internet with Ethernet. </p>
<p>Lets make a list of the pros:<br />
- Smaller than Arduino board with Ethernet shield on top<br />
- Runs Arduino Ethernet library<br />
- Power of Ethernet, no power supply needed (!!!!)<br />
- Micro SD card holder<br />
- And sexy round corners (rounder than the Ethernet Shield)<br />
- Neat mini USB socket</p>
<p>When it arrived I simply ran the <a href="http://arduino.cc/en/Tutorial/TwitterClient">TwitterClient file by Tom Igoe</a> in Ethernet examples of the Arduino IDE and it was up and running. To call my custom php file was a bit harder though. Example code to be posted on my <a href="http://arduino.sundh.com/">Arduino Circuit Blog </a>shortly.</p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2012/01/small-ehternet-access-just-got-smaller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xmas Installation based on node-js and Hydna</title>
		<link>http://www.sundh.com/blog/2011/12/xmas-installation-based-on-node-js-and-hydna/</link>
		<comments>http://www.sundh.com/blog/2011/12/xmas-installation-based-on-node-js-and-hydna/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 13:35:56 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[case]]></category>
		<category><![CDATA[hydna]]></category>
		<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=793</guid>
		<description><![CDATA[At Society 46 we celebrated the Xmas by hooking up to loads of Xmas lights to the node-js module Hydna. People can switch on and off 11 220 V sockets in real-time. Try it out on http://www.society46.com/xmas and turn on the lights of Society 46 Xmas Crib.



]]></description>
			<content:encoded><![CDATA[<p>At Society 46 we celebrated the Xmas by hooking up to loads of Xmas lights to the node-js module <a href="http://www.hydna.com">Hydna</a>. People can switch on and off 11 220 V sockets in real-time. Try it out on <a href="http://www.society46.com/xmas">http://www.society46.com/xmas</a> and turn on the lights of Society 46 Xmas Crib.<br />
<br />
<a href="http://www.sundh.com/blog/wp-content/uploads/2011/12/site1.jpg"><img src="http://www.sundh.com/blog/wp-content/uploads/2011/12/site1.jpg" alt="site" title="site" width="680" height="341" class="alignnone size-full wp-image-800" /></a><br />
<br />
<iframe src="http://player.vimeo.com/video/34075581?title=0&amp;byline=0&amp;portrait=0" width="680" height="383" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/12/xmas-installation-based-on-node-js-and-hydna/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AppleScript in Objective-C</title>
		<link>http://www.sundh.com/blog/2011/12/applescript-in-objective-c/</link>
		<comments>http://www.sundh.com/blog/2011/12/applescript-in-objective-c/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 10:22:26 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[objectve-c]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=787</guid>
		<description><![CDATA[I am working on a project where the good old Apple Script is need to do some magic on a Mac computer. Even though it is very semantic it can do some powerful stuff. The result will be posted as soon as it is finished.
Here is a simle Hello World example just to get it [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a project where the good old Apple Script is need to do some magic on a Mac computer. Even though it is very semantic it can do some powerful stuff. The result will be posted as soon as it is finished.</p>
<p>Here is a simle Hello World example just to get it up and running in Xcode. The example is used in a Mac OS X application.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="co2">#import &quot;S46AppDelegate.h&quot;</span></p>
<p>@implementation S46AppDelegate</p>
<p>@synthesize window<span class="sy0">;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>applicationDidFinishLaunching<span class="sy0">:</span><span class="br0">&#40;</span>NSNotification <span class="sy0">*</span><span class="br0">&#41;</span>aNotification<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Insert code here to initialize your application</span><br />
&nbsp; &nbsp; NSDictionary<span class="sy0">*</span> errorDict<span class="sy0">;</span><br />
&nbsp; &nbsp; NSAppleEventDescriptor<span class="sy0">*</span> returnDescriptor <span class="sy0">=</span> NULL<span class="sy0">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; NSAppleScript<span class="sy0">*</span> scriptObject <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>NSAppleScriptalloc<span class="br0">&#93;</span> initWithSource<span class="sy0">:</span><br />
&nbsp; &nbsp; @<span class="st0">&quot;display dialog <span class="es1">\&quot;</span>Hello World<span class="es1">\&quot;</span> buttons <span class="es1">\&quot;</span>OK<span class="es1">\&quot;</span> default button <span class="es1">\&quot;</span>OK<span class="es1">\&quot;</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; returnDescriptor <span class="sy0">=</span> <span class="br0">&#91;</span>scriptObject executeAndReturnError<span class="sy0">:</span> <span class="sy0">&amp;</span>errorDict<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>scriptObject release<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>returnDescriptor <span class="sy0">!=</span> NULL<span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// successful execution</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>kAENullEvent <span class="sy0">!=</span> <span class="br0">&#91;</span>returnDescriptor descriptorType<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// script returned an AppleScript result</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cAEList <span class="sy0">==</span> <span class="br0">&#91;</span>returnDescriptor descriptorType<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// result is a list of other descriptors</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// coerce the result to the appropriate ObjC type</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// no script result, handle error here</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p>@end</p></div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/12/applescript-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking technology meets iPhone</title>
		<link>http://www.sundh.com/blog/2011/11/trackingtechnology-meets-iphone/</link>
		<comments>http://www.sundh.com/blog/2011/11/trackingtechnology-meets-iphone/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 09:49:09 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fmod]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tracab]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=778</guid>
		<description><![CDATA[Today Society46 is launching the Pepsi Refresh project together with Åkestam Holst. The project involves the Tracab tracking stystem, UDP streams, iPhone sensors and FMOD for iOS. Code will follow.

]]></description>
			<content:encoded><![CDATA[<p>Today <a href="http://www.society46.com" target="_blank">Society46</a> is launching the <a href="http://thesoundoffootball.com/" target="_blank">Pepsi Refresh project</a> together with <a href="http://fabriken.akestamholst.se/" target="_blank">Åkestam Holst</a>. The project involves the <a href="http://www.tracab.com/" target="_blank">Tracab tracking stystem</a>, UDP streams, iPhone sensors and <a href="http://www.fmod.org/index.php/download" target="_blank">FMOD for iOS</a>. Code will follow.<br />
</br><br />
<iframe width="680" height="415" src="http://www.youtube.com/embed/g0Xgp2Mi6Xs" frameborder="0" allowfullscreen></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/11/trackingtechnology-meets-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Arduino circuit blog</title>
		<link>http://www.sundh.com/blog/2011/10/my-arduino-circuit-blog/</link>
		<comments>http://www.sundh.com/blog/2011/10/my-arduino-circuit-blog/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 10:45:36 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[curcuits]]></category>
		<category><![CDATA[electronics]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=775</guid>
		<description><![CDATA[Whenever I make a circuit I try to document it and take photos. With the Fritzing software it gets even better. To share code and circuits I gathered my Arduino circuits on this new blog: Ellen Sundh&#8217;s Arduino Circuit Blog 
]]></description>
			<content:encoded><![CDATA[<p>Whenever I make a circuit I try to document it and take photos. With the <a href="http://fritzing.org/">Fritzing</a> software it gets even better. To share code and circuits I gathered my Arduino circuits on this new blog: <a href="http://arduino.sundh.com/">Ellen Sundh&#8217;s Arduino Circuit Blog </a></p>
<p><a href="http://www.sundh.com/blog/wp-content/uploads/2011/10/Untitled-1.png"><img src="http://www.sundh.com/blog/wp-content/uploads/2011/10/Untitled-1.png" alt="Untitled-1" title="Untitled-1" width="640" height="355" class="alignnone size-full wp-image-776" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/10/my-arduino-circuit-blog/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using iPhone sensors with real-time server</title>
		<link>http://www.sundh.com/blog/2011/10/using-iphone-sensors-with-real-time-server/</link>
		<comments>http://www.sundh.com/blog/2011/10/using-iphone-sensors-with-real-time-server/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 10:35:35 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hydna]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[real-time server]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[society46]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=764</guid>
		<description><![CDATA[The latest work from Society46 where the iPhones turns into a tool to paint together with other, in real time with the help of Hydna real-time server. 

CO:CREATE from Society 46 on Vimeo.]]></description>
			<content:encoded><![CDATA[<p>The latest work from <a href="http://www.society46.com/" target="_blank">Society46</a> where the iPhones turns into a tool to paint together with other, in real time with the help of <a href="http://www.hydna.com/" target="_blank">Hydna real-time server</a>. </br><br />
<iframe src="http://player.vimeo.com/video/30372100?title=0&amp;byline=0&amp;portrait=0" width="680" height="383" frameborder="0"></iframe>
<p><a href="http://vimeo.com/30372100">CO:CREATE</a> from <a href="http://vimeo.com/user4611212">Society 46</a> on <a href="http://vimeo.com">Vimeo</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/10/using-iphone-sensors-with-real-time-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geek Girl Arduino Workshop</title>
		<link>http://www.sundh.com/blog/2011/10/geek-girl-arduino-workshop/</link>
		<comments>http://www.sundh.com/blog/2011/10/geek-girl-arduino-workshop/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 10:15:14 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[Geek Girl Meetup 2011]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=748</guid>
		<description><![CDATA[During the Arduino Workshop with Geek Girls Meetup we went through a number of sensors. A full list will be posted here soon. Here are some images from the workshop:
]]></description>
			<content:encoded><![CDATA[<p>During the Arduino Workshop with <a href="http://geekgirlmeetup.com/stockholm/" target="_blank">Geek Girls Meetup</a> we went through a number of sensors. A full list will be posted here soon. Here are some images from the workshop:<br />
<a href="http://www.flickr.com/photos/40119456@N07/6237220868/" title="@ellensundh visar by aselundblad, on Flickr"><img src="http://farm7.static.flickr.com/6108/6237220868_2de9189b51.jpg" width="500" height="281" alt="@ellensundh visar"></a><a href="http://www.flickr.com/photos/40119456@N07/6236642981/" title="Visning av motståndsappen by aselundblad, on Flickr"><img src="http://farm7.static.flickr.com/6103/6236642981_8f63c11acc.jpg" width="182" height="281" alt="Visning av motståndsappen"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/10/geek-girl-arduino-workshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The dirty robot</title>
		<link>http://www.sundh.com/blog/2011/10/the-dirty-robot/</link>
		<comments>http://www.sundh.com/blog/2011/10/the-dirty-robot/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 16:55:25 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[robot]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=746</guid>
		<description><![CDATA[
Some robots only reacts on very dirty words. It&#8217;s a struggle but what could you do. This robot reacts on Swedish dirty words (genitals and poo related words). ]]></description>
			<content:encoded><![CDATA[<p><iframe width="680" height="415" src="http://www.youtube.com/embed/wESrrzw-I4E" frameborder="0" allowfullscreen></iframe></p>
<p>Some robots only reacts on very dirty words. It&#8217;s a struggle but what could you do. This robot reacts on Swedish dirty words (genitals and poo related words). </p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/10/the-dirty-robot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stabalize compass of iPhone with gyroscope</title>
		<link>http://www.sundh.com/blog/2011/09/stabalize-compass-of-iphone-with-gyroscope/</link>
		<comments>http://www.sundh.com/blog/2011/09/stabalize-compass-of-iphone-with-gyroscope/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 17:50:04 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[gyroscope]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[yaw]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=704</guid>
		<description><![CDATA[How is it possible to detect the rotation of an iPhone that lies on a table like the compass but is showing a more accurate rotation? I tried to use the compass with the magnetic heading of the iPhone but it appears to be quite unreliable and jumps unexpectedly. The gyroscope can be used but [...]]]></description>
			<content:encoded><![CDATA[<p>How is it possible to detect the rotation of an iPhone that lies on a table like the compass but is showing a more accurate rotation? I tried to use the compass with the magnetic heading of the iPhone but it appears to be quite unreliable and jumps unexpectedly. The gyroscope can be used but the original reference point drifts with the gyroscope over time. This example combines the compass and the gyroscope using the compass as a reference as long as it is stable and using the fast update of the gyroscope between the times the compass is unstable.</p>
<p>In the app below there are 3 rotating graphics:</p>
<ul>
<li>Yellow is magnetic heading.</li>
<li>Blue is a compass offset (always following the magnetic heading with a decided offset)</li>
<li>Black is the gyroscope (reset every time the compass is stable)</li>
</ul>
<p><iframe width="680" height="415" src="http://www.youtube.com/embed/2b6lrsgFBkE" frameborder="0" allowfullscreen></iframe></p>
<p>The application uses the <a href="http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html%23//apple_ref/occ/cl/CLLocationManager" target="_blank">CLLocationManager</a> to access the magnetic heading of the compass and <a href="http://developer.apple.com/library/ios/#documentation/CoreMotion/Reference/CMMotionManager_Class/Reference/Reference.html" target="_blank">CMMotionManager</a> to access the gyroscope. The values I use are newHeading.magneticHeading and motion.attitude.yaw. The magnetic heading gives a value of 360 degrees. The yaw value gives a value between -180 and 180. </p>
<h3>Compass from Location Manager</h3>
<p>First we initialize the location manager. This will only work on the device and not in the simulator. </p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">locationManager<span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#91;</span>CLLocationManager alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span><span class="sy0">;</span><br />
locationManager<span class="sy0">.</span>desiredAccuracy <span class="sy0">=</span> kCLLocationAccuracyBest<span class="sy0">;</span><br />
locationManager<span class="sy0">.</span>delegate<span class="sy0">=</span><span class="kw2">self</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span>CLLocationManager headingAvailable<span class="br0">&#93;</span> <span class="sy0">==</span> YES<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="sy0">@</span><span class="st0">&quot;Heading is available&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="sy0">@</span><span class="st0">&quot;Heading isn&#8217;t available&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#91;</span>locationManager startUpdatingHeading<span class="br0">&#93;</span><span class="sy0">;</span></div>
</div>
<p>As shown in the code above we delegate the listener to RotationViewController. The following code is needed to listen to updates for the compass:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="co2">#import &lt;UIKit/UIKit.h&gt;<br />
</span><span class="co2">#import &lt;math.h&gt;<br />
</span><span class="co2">#import &lt;CoreMotion/CoreMotion.h&gt; // For the gyroscope<br />
</span><span class="co2">#import &lt;CoreLocation/CoreLocation.h&gt; // For the compass<br />
</span><br />
<span class="sy0">@</span><span class="kw2">interface</span> RotationViewController <span class="sy0">:</span> UIViewController <span class="sy0">&lt;</span>CLLocationManagerDelegate<span class="sy0">&gt;</span> <span class="br0">&#123;</span></div>
</div>
<h3>Yaw data from gyroscope</h3>
<p>Next step is to listen to updates from the gyroscope. We do that by listening to motionManager&#8217;s CMAttitude updates. We use the yaw which is retrieved in radians and we convert it to degrees. </p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">motionManager <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>CMMotionManageralloc<span class="br0">&#93;</span> &nbsp;init<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp;motionManager.<span class="me1">deviceMotionUpdateInterval</span> <span class="sy0">=</span> 1.0<span class="sy0">/</span><span class="nu16">60.0</span><span class="sy0">;</span><br />
&nbsp;opQ <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>NSOperationQueuecurrentQueue<span class="br0">&#93;</span> retain<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <br />
&nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>motionManager.<span class="me1">isDeviceMotionAvailable</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; motionHandler <span class="sy0">=</span> <span class="sy0">^</span> <span class="br0">&#40;</span>CMDeviceMotion <span class="sy0">*</span>motion<span class="sy0">,</span> NSError <span class="sy0">*</span>error<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; CMAttitude <span class="sy0">*</span>currentAttitude <span class="sy0">=</span> motion.<span class="me1">attitude</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yawValue <span class="sy0">=</span> currentAttitude.<span class="me1">yaw</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yawDegrees <span class="sy0">=</span> CC_RADIANS_TO_DEGREES<span class="br0">&#40;</span>yawValue<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; <span class="br0">&#91;</span>motionManager release<span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="br0">&#91;</span>motionManagerstartDeviceMotionUpdatesToQueue<span class="sy0">:</span>opQwithHandler<span class="sy0">:</span>motionHandler<span class="br0">&#93;</span><span class="sy0">;</span></div>
</div>
<p>We now have the compass and the gyroscope. In this example I wanted to offset the magnetic heading so it always points at a certain direction. I decide on that direction when I press the &#8220;Calibrate&#8221;-button I set my offset from the magnetic heading. updatedHeading is the latest magnetic heading I got from the locationManager. northOffset becomes my reference to where I want the gyroscope to always origin from.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>calibrate<span class="sy0">:</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; northOffest <span class="sy0">=</span> updatedHeading <span class="sy0">-</span> <span class="nu0">0</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h3>Compensating for compass inaccuracies</h3>
<p>Now that we have the northOffset we want to use it together with the gyroscope. Since the compass is jumping sometimes we want to only use the compass value when it is stable. A timer is created with the updater method that checks if the value of the magnetic heading has changed. The interval is called every other second. If the magnetic heading hasn&#8217;t changed from last time it is considered a stable value. The stable value is added to <em>newCompassTarget</em> which is use for the gyroscope to get a new reference.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>updater<span class="sy0">:</span><span class="br0">&#40;</span>NSTimer <span class="sy0">*</span><span class="br0">&#41;</span>timer <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Om inte compassen rört sig på ett tag kalibrera gyron efter det</span><br />
&nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>updatedHeading <span class="sy0">==</span> oldHeading<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;NSLog<span class="br0">&#40;</span>@<span class="st0">&quot;Update gyro&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;newCompassTarget <span class="sy0">=</span> <span class="br0">&#40;</span>0 <span class="sy0">-</span> updatedHeading<span class="br0">&#41;</span> <span class="sy0">+</span> northOffest<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;offsetG <span class="sy0">=</span> currentYaw<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; updateCompass <span class="sy0">=</span> <span class="nu0">1</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; updateCompass <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; oldHeading <span class="sy0">=</span> updatedHeading<span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><em>newCompassTarget</em> is used in the code below so that the gyroscope always strive to go to the new reference of the compass but with the offset we use in the variable <em>offsetG</em> which is the difference between where the gyroscope was with the old and compared to the new heading.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">motionHandler <span class="sy0">=</span> <span class="sy0">^</span> <span class="br0">&#40;</span>CMDeviceMotion <span class="sy0">*</span>motion<span class="sy0">,</span> NSError <span class="sy0">*</span>error<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CMAttitude <span class="sy0">*</span>currentAttitude <span class="sy0">=</span> motion.<span class="me1">attitude</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yawValue <span class="sy0">=</span> currentAttitude.<span class="me1">yaw</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yawDegrees <span class="sy0">=</span> CC_RADIANS_TO_DEGREES<span class="br0">&#40;</span>yawValue<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentYaw <span class="sy0">=</span> yawDegrees<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yawDegrees <span class="sy0">=</span> newCompassTarget <span class="sy0">+</span> <span class="br0">&#40;</span>yawDegrees <span class="sy0">-</span> offsetG<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>yawDegrees <span class="sy0">&lt;</span> 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yawDegrees <span class="sy0">=</span> yawDegrees <span class="sy0">+</span> <span class="nu0">360</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compassDif.<span class="me1">text</span> <span class="sy0">=</span> <span class="br0">&#91;</span>NSString stringWithFormat<span class="sy0">:</span>@<span class="st0">&quot;Gyro: %f&quot;</span><span class="sy0">,</span>yawDegrees<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> gyroDegrees <span class="sy0">=</span> <span class="br0">&#40;</span>yawDegrees<span class="sy0">*</span>radianConst<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>updateCompass<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView beginAnimations<span class="sy0">:</span>nil context<span class="sy0">:</span>NULL<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationDuration<span class="sy0">:</span>0.25<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationCurve<span class="sy0">:</span>UIViewAnimationCurveEaseInOut<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>rotateImg setTransform<span class="sy0">:</span>CGAffineTransformMakeRotation<span class="br0">&#40;</span>gyroDegrees<span class="br0">&#41;</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView commitAnimations<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateCompass <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rotateImg.<span class="me1">transform</span> <span class="sy0">=</span> CGAffineTransformMakeRotation<span class="br0">&#40;</span>gyroDegrees<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">;</span></div>
</div>
<p>Download project source code <a href="http://www.sundh.com/files/iPhoneRotation.zip">here</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/09/stabalize-compass-of-iphone-with-gyroscope/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

