<?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>Interactive Matter &#187; Tinkering</title>
	<atom:link href="http://interactive-matter.org/category/tinkering/feed/" rel="self" type="application/rss+xml" />
	<link>http://interactive-matter.org</link>
	<description>Tinkering with electronics &#38; ambient interaction</description>
	<lastBuildDate>Sat, 14 Aug 2010 15:29:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<image>
			<title>Interactive Matter</title>
			<url>http://interactive-matter.org/wp-content/uploads/2010/03/im-feed.png</url>
			<link>http://interactive-matter.org</link>
			<width></width>
			<height></height>
			<description>Tinkering with electronics &amp; ambient interaction</description>
		</image>		<item>
		<title>aJson &#8211; Handle JSON with Arduino</title>
		<link>http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ajson-handle-json-with-arduino</link>
		<comments>http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 15:29:02 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[aJson]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Library]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[data structure]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology_Internet]]></category>
		<category><![CDATA[Web Service]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=988</guid>
		<description><![CDATA[Exchanging data with other computers can be a daunting task with Arduino. No matter if you just want to pass some information to Processing, to a Web Service or something else – You always have to encode the data and decode the answer. There always have been solutions like XML for structured data. But XML [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/" title="Permanent link to aJson &#8211; Handle JSON with Arduino"><img class="post_image aligncenter colorbox-988" src="http://interactive-matter.org/wp-content/uploads/2010/08/JSON-500x457.png" width="500" height="457" alt="The JSON data structure" /></a>
</p><p>Exchanging data with other computers can be a daunting task with Arduino. No matter if you just want to pass some information to Processing, to a Web Service or something else – You always have to encode the data and decode the answer.</p>
<p>There always have been solutions like XML for structured data. But XML is hard to decode, complicated an takes up a lot of space. And then there is <a href="http://www.json.org/">JSON</a>. JSON is an easy and efficient way to transfer data. A complex data structure can for example represented as<br />
<code>{<br />
"name": "Jack (\"Bee\") Nimble",<br />
"format": {<br />
"type":       "rect",<br />
"width":      1920,<br />
"height":     1080,<br />
"interlace":  false,<br />
"frame rate": 24<br />
}<br />
}<br />
</code><br />
aJson is an Arduino library to enable JSON processing with Arduino. It easily enables you to decode, create, manipulate and encode JSON directly from and to data structures. By this you don&#8217;t have to bother with data encoding and decoding &#8211; this will hand aJson for you. It is based on the <a href="http://sourceforge.net/projects/cjson/">cJSON implementation</a>, reduced in size and removing one or two features.</p>
<h3><span id="more-988"></span>Using aJson</h3>
<p>To use aJson get it from the <a href="http://github.com/interactive-matter/aJson">git repository</a> or <a href="http://github.com/interactive-matter/aJson/downloads">download</a> the latest version. Unpack the zip file (or the git files) into an Folder &#8216;aJson&#8217; in the Arduino library directory &#8216;libraries\&#8217;. Due to the early stage of this library you can encounter problems. Simply <a href="http://github.com/interactive-matter/aJson/issues">submit a ticket</a> and it will fix it as soon as possible. On github you will also find a simple <a href="http://github.com/downloads/interactive-matter/aJson/aJson.pde">Arduino sketch</a> to test the library, or as a starting point.</p>
<p>To parse the above structure with aJson you simply convert it to a object tree:</p>
<pre> aJsonObject* jsonObject = aJson.parse(json_string);</pre>
<p>(assuming you got the JSON string in the variable json_string &#8211; as a char*). This is an object. We&#8217;re in C. We don&#8217;t have objects. But we do have structs. Therefore the objects are translated into structs, with all the drawbacks it brings. Now we can e.g. retrieve the value for name:</p>
<pre> aJsonObject* name = aJson.getObjectItem(root, "name");</pre>
<p>The value of name can be retrieved via:</p>
<pre>Serial.println(name-&gt;value.valuestring);</pre>
<p>Note that the aJsonObject has a union &#8216;value&#8217; which holds all possible value types as overlays &#8211; you can get only useful data for the type which you have at hand. You can get the type as</p>
<pre> name-&gt;type</pre>
<p>which can be either aJson_False, aJson_True, aJson_NULL, aJson_Number, aJson_String, aJson_Array or aJson_Object. For aJson_Number you can use value.number.valueint or value.number.valuedouble, for aJson_String you can use value.valuestring, for True or False, you can use value.valuebool.</p>
<p>If you want to change the name, you can do so by</p>
<pre>aJson.getObjectItem(jsonObject,"name")-&gt;value.valuestring="a new name";</pre>
<p>To render the object back to a string you can simply call</p>
<pre> char *json_String=aJson.print(jsonObject);</pre>
<p>Finished? Delete the root (this takes care of everything else).</p>
<pre> aJson.delete(root);</pre>
<p>This deletes the objects and all values referenced by it. So take care for your string, you directly assigned. They are deleted too.  If you want to see how you&#8217;d build this struct in code?<br />
<code lang="c"><br />
aJsonObject *root,*fmt;<br />
root=aJson.createObject();<br />
aJson.addItemToObject(root, "name", aJson.createString("Jack (\"Bee\") Nimble"));<br />
aJson.addItemToObject(root, "format", fmt = aJson.createObject());<br />
aJson.addStringToObject(fmt,"type",        "rect");<br />
aJson.addNumberToObject(fmt,"width",        1920);<br />
aJson.addNumberToObject(fmt,"height",        1080);<br />
aJson.addFalseToObject (fmt,"interlace");<br />
aJson.addNumberToObject(fmt,"frame rate",    24);<br />
</code><br />
The whole library (nicely provided by cJSON) is optimized for easy usage. You can create and modify the object as easy as possible.</p>
<h3>Limitations of aJson</h3>
<p>Unfortunately everything comes for a price and complex data structures and text processing is not really the primary domain for Arduino. So some simplifications had to be made:</p>
<ul>
<li>aJson is not really suitable for ATmega168 based Arduinos &#8211; there is just not enough RAM &#8211; and the library itself eats up toe 80% of the flash memory.</li>
<li>aJson cannot handle Unicode.</li>
<li>Lists and Objects can only handle up to 256 entries.</li>
<li>All strings are case sensitive, this is no real problem for values. But if you want to find a name you have keep in mind that it works case sensitive.</li>
</ul>
<p>A lot of these limitations will be gone in the future versions of aJson.</p>
<h3>Further Development of aJson</h3>
<p>Currently aJson is considered to be in a beta phase. It is usable, but it can get better. The most important task is to further reduce the memory footprint. Therefore the API may change a bit in next versions. When the library is better tested and more evolved it will be package as real Arduino library.</p>
<p>I hope that many people will use and test the library. So go ahead and <a href="http://github.com/interactive-matter/aJson/downloads">download aJson</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Palo Altonale – Learn Tinkering at the Good School</title>
		<link>http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=palo-altonale-learn-tinkering-at-the-good-school</link>
		<comments>http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 07:20:40 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[#palo_altona]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[good school]]></category>
		<category><![CDATA[Hamburg]]></category>
		<category><![CDATA[physical computing]]></category>
		<category><![CDATA[tinker]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=949</guid>
		<description><![CDATA[A short German sumary, English version after the click: Auf zur Palo Altonale! Zusammen mit Tinkerlog, Palo Altona und Interactive Matter bietet die Good School einen Kurs zu Physical Computing &#38; Tinkering in Hamburg an. Ziel des Workshop ist es Kreativen in 2 Tagen die Umsetzung von interaktiven Physical-Computing-Projekten auf Basis von Arduino zu vermitteln.Wer [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/" title="Permanent link to Palo Altonale – Learn Tinkering at the Good School"><img class="post_image aligncenter colorbox-949" src="http://interactive-matter.org/wp-content/uploads/2010/07/palo_altonale_stempel-500x440.jpg" width="500" height="440" alt="Post image for Palo Altonale – Learn Tinkering at the Good School" /></a>
</p><p>A short German sumary, English version after the click:</p>
<p><em>Auf zur Palo Altonale!</em> Zusammen mit <a href="http://tinkerlog.com/">Tinkerlog</a>, <a href="http://paloaltona.posterous.com/">Palo Altona</a> und Interactive Matter bietet die <a href="http://www.good-school.de/">Good School</a> einen Kurs zu Physical Computing &amp; Tinkering in Hamburg an. Ziel des Workshop ist es Kreativen in 2 Tagen die Umsetzung von interaktiven Physical-Computing-Projekten auf Basis von Arduino zu vermitteln.Wer immer schon mal interaktive, elektronische Spielereien selber basteln wollte ist bei uns bestens aufgehoben.</p>
<p>Wir geben nicht nur eine Einführung in die Programmierung mit Arduino sondern helfen jedem ein eigenes kleines Projekt umszusetzen! Jeder Teilnehmer erhält einen Arduino mit Netzwerkverbindung, notwendige Bauteile und Sensoren. Grundkentnisse sind eigentlich keine erforderlich (OK, Computer bedienen istsollte drin sein). Wer dann schon mal eine Programmiersprache gesehen hat (ActionScript, JavaScript, oder was auch immer) kann mitmachen. Wer denkt er könne keinen Arduino programmieren wird eines Besseren belehrt.</p>
<p>Der Workshop findet am 29. &amp; 30.10.2010 statt. Weitere Informationen gibt es bei der <a href="http://www.good-school.de/paloaltonale/">Good School</a> oder <a href="http://www.facebook.com/event.php?eid=136636016362929">Facebook</a>. Wer Interesse hat innerhalb des Workshops spezielle Themen umzusetzen will (MIDI, Robotik, …) meldet sich frühzeitig bei der Good School – dann können wir darauf gerne eingehen.</p>
<p>And now for the English description …</p>
<p><span id="more-949"></span></p>
<p><a href="http://tinkerlog.com/">Tinkerlog</a>, <a href="http://paloaltona.posterous.com/">Palo Altona</a> and Interactive Matter will help <a href="http://www.good-school.de/">Good School</a> to offer a Arduino workshop in Hamburg. The idea of the workshop is to bring creative professional in touch with physical computing. Every participant will build a physical project interacting with the internet. The basic concept of the workshop is pretty simple. Every participant gets an Arduino with a network connection and some physical interface sensors.  We will give a short introduction into the Arduino platform and how to program it. Everybody who had a look at ActionScript or any other programming language will be able to programm his Arduino. Don&#8217;t be shy, since you think you cannot program – nobody will be left behind. The most important part of the workshop will be free tinkering. You can design and realize your project. We will help you with any question, programming or sensors that you need! We will bring a plethora of stuff and experience! If you are in Hamburg on the 29. &amp; 30.10.2010 contact the <a href="http://www.good-school.de/paloaltonale/">Good School</a> and register! Uhmm, the course will be held in German.</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/' rel='bookmark' title='Permanent Link: Palo Altona – Hamburg Tinker Drinkup'>Palo Altona – Hamburg Tinker Drinkup</a></li>
<li><a href='http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/' rel='bookmark' title='Permanent Link: Palo Altona will build Hamburg&#8217;s first Makerbot'>Palo Altona will build Hamburg&#8217;s first Makerbot</a></li>
<li><a href='http://interactive-matter.org/2008/08/tinkering-with-adjd-s371-q999/' rel='bookmark' title='Permanent Link: Tinkering with ADJD-S371-Q999'>Tinkering with ADJD-S371-Q999</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing Software for the Atmel AVR with AVR-Eclipse</title>
		<link>http://interactive-matter.org/2010/07/developing-software-for-the-atmel-avr-with-avr-eclipse/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=developing-software-for-the-atmel-avr-with-avr-eclipse</link>
		<comments>http://interactive-matter.org/2010/07/developing-software-for-the-atmel-avr-with-avr-eclipse/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 17:10:13 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[atmel]]></category>
		<category><![CDATA[atmel avr]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[avr-gcc]]></category>
		<category><![CDATA[avrdude]]></category>
		<category><![CDATA[developing software]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse plugin]]></category>
		<category><![CDATA[Firmware]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Integrated development environment]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[open source software]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[win-avr]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=944</guid>
		<description><![CDATA[Developing software – or better firmware – for the Atmel AVR can be quite easy or quite complicated. A lot of people like to just use vi, some source files and a make file. Here at Interactive Matter we are a tad lazy and want a fully fledged IDE, with code completion, one click building, [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://interactive-matter.org/2010/07/developing-software-for-the-atmel-avr-with-avr-eclipse/" title="Permanent link to Developing Software for the Atmel AVR with AVR-Eclipse"><img class="post_image aligncenter colorbox-944" src="http://farm5.static.flickr.com/4140/4818143891_b35331665f.jpg" width="500" height="320" alt="Post image for Developing Software for the Atmel AVR with AVR-Eclipse" /></a>
</p><p>Developing software – or better firmware – for the Atmel AVR can be  quite easy or quite complicated. A lot of people like to just use <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','en.wikipedia.org']);" href="http://en.wikipedia.org/wiki/Vi">vi</a>,  some <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','en.wikipedia.org']);" href="http://en.wikipedia.org/wiki/Source_file">source  files</a> and a <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','en.wikipedia.org']);" href="http://en.wikipedia.org/wiki/Make_%28software%29">make  file.</a> Here at Interactive Matter we are a tad lazy and want a fully  fledged IDE, with code completion, one click building, no make files  and buttons to flash the AVR. The easiest was is to achieve this with  Open Source Software, using <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','gcc.gnu.org']);" href="http://gcc.gnu.org/">avr-gcc</a>,  <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','www.bsdhome.com']);" href="http://www.bsdhome.com/avrdude/">avrdude</a> and <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','avr-eclipse.sourceforge.net']);" href="http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin">avr-eclipse</a>.</p>
<p>To help anybody who wants to use this very convenient package Interactive Matter offers a <a href="http://interactive-matter.org/how-to/developing-software-for-the-atmel-avr-with-avr-eclipse-avr-gcc-avrdude/">complete guide on how to install and use avr-gcc, avrdude, Eclipse and the avr-eclipse plugin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2010/07/developing-software-for-the-atmel-avr-with-avr-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Palo Altona will build Hamburg&#8217;s first Makerbot</title>
		<link>http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=palo-altona-will-build-hamburgs-first-makerbot</link>
		<comments>http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:41:05 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[#palo_altona]]></category>
		<category><![CDATA[Hamburg]]></category>
		<category><![CDATA[MakerBot Cupcake CNC]]></category>
		<category><![CDATA[MakerBot Industries]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=791</guid>
		<description><![CDATA[Palo Altona is happy to announce that we will build the first MakerBot Cupcake CNC in Hamburg (at least according to Google). Good School approached Alex of Tinkerlog, me and Palo Altona in general, if we want to help to build their MakerBot. And yes we are happy to help. The weekend project will be [...]]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/" title="Permanent link to Palo Altona will build Hamburg&#8217;s first Makerbot"><img class="post_image aligncenter colorbox-791" src="http://farm4.static.flickr.com/3490/3458247336_bf8b6ec013.jpg" width="333" height="500" alt="MakerBot Cupcake CNC by Bre Petis" /></a>
</p><p><a href="http://paloaltona.posterous.com">Palo Altona</a> is happy to announce that we will build the first <a href="http://www.makerbot.com/">MakerBot Cupcake CNC</a> in Hamburg (at least according to Google). <a href="http://good-school.de/">Good School</a> approached Alex of <a href="http://tinkerlog.com/">Tinkerlog</a>, me and <a href="http://paloaltona.posterous.com">Palo Altona</a> in general, if we want to help to build their <a href="http://www.makerbot.com/">MakerBot</a>. And yes we are happy to help.</p>
<p>The weekend project will be documented over at <a href="http://paloaltona.posterous.com">Palo Altona</a> (mostly in German). Some updates will be posted here too.</p>
<p>If this weekend is successful the good boys and girls at <a href="http://good-school.de/">Good School</a> will have a nice functional <a href="http://www.makerbot.com/">MakerBot Cupcake CNC</a> (probably the first in Hamburg) and I am looking forward to it!</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/' rel='bookmark' title='Permanent Link: Palo Altona – Hamburg Tinker Drinkup'>Palo Altona – Hamburg Tinker Drinkup</a></li>
<li><a href='http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/' rel='bookmark' title='Permanent Link: Palo Altonale – Learn Tinkering at the Good School'>Palo Altonale – Learn Tinkering at the Good School</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Palo Altona – Hamburg Tinker Drinkup</title>
		<link>http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=palo-altona-%25e2%2580%2593-hamburg-tinker-drinkup</link>
		<comments>http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 09:11:27 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[#palo_altona]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[drinkup]]></category>
		<category><![CDATA[Hamburg]]></category>
		<category><![CDATA[tinker]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=471</guid>
		<description><![CDATA[Die deutsche Version gibt es nach dem Klick (und dann weiter unten). This time it is all non-technical (technically not – but that starts to get complicated). To further encourage tinkering in Hamburg, Alex and I have established a regularly tinker drinkup every Thursday (nearly) at Saal II. Currently it is a very cosy drinkup, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Die deutsche Version gibt es nach dem Klick (und dann weiter unten).</p>
<p>This time it is all non-technical (technically not – but that starts to get complicated). To further encourage tinkering in Hamburg, <a href="http://tinkerlog.com/">Alex</a> and I have established a regularly tinker drinkup every Thursday (nearly) at <a href="http://www.qype.co.uk/place/5426-Saal-II-Hamburg">Saal II</a>.</p>
<p><img class="slickr-post colorbox-471" src="http://farm3.static.flickr.com/2657/4156498852_6e28b3e04e.jpg" alt="Tinker Drinkup" width="500" height="281" /></p>
<p>Currently it is a very cosy drinkup, just a few guests. Hopefully this will change. We post announcements with very short notice <a href="http://twitter.com/#search?q=%23palo_altona">on Twitter via #palo_altona</a>. If you want to join to discuss some tinker stuff or present your Arduino or tinker projects, just tell <a href="http://twitter.com/9600baud">Alex</a> or <a href="http://twitter.com/interactmatter">me</a> and we will tell when the next <a href="http://twitter.com/#search?q=%23palo_altona">#palo_altona</a> takes place.</p>
<p><em>Update: There is now an <a href="http://paloaltona.posterous.com/">official Palo Altona site</a> for further references.</em></p>
<p>Und nun zur deutschen Version:</p>
<p><span id="more-471"></span>Um auch in Hamburg einen regelmäßige Austauch zu Arduino, Tinkern und Open Source Hardware zu etablieren haben <a href="http://tinkerlog.com/">Alex</a> und ich &#8216;Palo Altona&#8217; gegründet. Ein regelmäßiges, manchmal auch unregelmäßiges, Treffen, jeden Donnerstag, im <a href="http://www.qype.com/place/5426-Saal-II-Hamburg">Saal II</a> in der Schanze. Gäste sind gerne willkommen!</p>
<p>Die Koordination erfolgt recht kurzfristig (leider bisher meist erst am selben Tag) über <a href="http://twitter.com/#search?q=%23palo_altona">Twitter (#palo_atona)</a>. Meldet euch bei <a href="http://twitter.com/9600baud">Alex</a> oder <a href="http://twitter.com/interactmatter">mir</a> und wir geben Bescheid ob und wann das nächste Treffen ist. Wir freuen uns über jeden Gast.</p>
<p><em>Update: Es gibt inzwischen eine <a href="http://paloaltona.posterous.com/">offizielle Palo Altona Site</a> für weitere Informationen &#038; Koordinierung.</em></p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2010/04/palo-altona-will-build-hamburgs-first-makerbot/' rel='bookmark' title='Permanent Link: Palo Altona will build Hamburg&#8217;s first Makerbot'>Palo Altona will build Hamburg&#8217;s first Makerbot</a></li>
<li><a href='http://interactive-matter.org/2010/07/palo-altonale-learn-tinkering-at-the-good-school/' rel='bookmark' title='Permanent Link: Palo Altonale – Learn Tinkering at the Good School'>Palo Altonale – Learn Tinkering at the Good School</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2010/01/palo-altona-%e2%80%93-hamburg-tinker-drinkup/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Seasonal Greetings</title>
		<link>http://interactive-matter.org/2009/12/seasonal-greetings/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=seasonal-greetings</link>
		<comments>http://interactive-matter.org/2009/12/seasonal-greetings/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 18:37:27 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=506</guid>
		<description><![CDATA[This is definitively the last post for this year. So I wish everybody Merry Christmas or whatever you want to celebrate and a pleasant &#38; successful new year! Even I stopped tinkering and went on to hacking cookies. Have fun &#38; take care! Related posts:Last year in electronics]]></description>
			<content:encoded><![CDATA[<p></p><p>This is definitively the last post for this year. So I wish everybody Merry Christmas or whatever you want to celebrate and a pleasant &amp; successful new year!</p>
<p><a title="Space Invaders Cookies" href="http://farm3.static.flickr.com/2642/4197092247_b1ae89cb50_b.jpg"><img class="slickr-post colorbox-506" src="http://farm3.static.flickr.com/2642/4197092247_b1ae89cb50.jpg" alt="Space Invaders Cookies" width="500" height="375" /></a></p>
<p>Even I stopped tinkering and went on to hacking cookies. Have fun &amp; take care!</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2009/01/last-year-in-electronics/' rel='bookmark' title='Permanent Link: Last year in electronics'>Last year in electronics</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2009/12/seasonal-greetings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filtering Sensor Data with a Kalman Filter</title>
		<link>http://interactive-matter.org/2009/12/filtering-sensor-data-with-a-kalman-filter/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=filtering-sensor-data-with-a-kalman-filter</link>
		<comments>http://interactive-matter.org/2009/12/filtering-sensor-data-with-a-kalman-filter/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 20:38:25 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Accelerometer]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Kalman Filter]]></category>
		<category><![CDATA[LIS302DL]]></category>
		<category><![CDATA[Noise]]></category>
		<category><![CDATA[sensor noise]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=487</guid>
		<description><![CDATA[Some days ago I wrote about noise with a LIS302DL accelerometer. There is obviously something wrong with my hardware. But before I get a new version out I need to implement some software filtering. After some unsuccessful results with low pass filters I choose the Kalman Filter. The Kalman Filter involves an awful lot of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Some days ago I wrote about <a href="http://interactive-matter.org/2009/12/decoupling-lis302dl-%E2%80%93-there-i-fixed-it/">noise with a LIS302DL accelerometer</a>. There is obviously something wrong with my hardware. But before I get a new version out I need to implement some software filtering.</p>
<p><a title="Process Noise 4.0" href="http://farm3.static.flickr.com/2546/4195425248_99e844c507_o.png"><img src="http://farm3.static.flickr.com/2546/4195425248_d6b3083536.jpg" alt="Process Noise 0.125" width="500" height="250"  class="slickr-post colorbox-487" /></a></p>
<p>After some unsuccessful results with <a href="http://en.wikipedia.org/wiki/Low_pass_filter">low pass filters</a> I choose the <a href="http://en.wikipedia.org/wiki/Kalman_filter">Kalman Filter.</a> The Kalman Filter involves <a href="http://en.wikipedia.org/wiki/Kalman_filter#The_Kalman_filter">an awful lot of complicated mathematics.</a> But fortunately I just needed a simple one dimensional Kalman Filter without any driving information, which makes the filter much easier.<br />
<span id="more-487"></span></p>
<h3>Implementing the Kalman Filter</h3>
<p>If you check the Kalman Filter formulas, you will encounter a lot of complicated matrix and vector math. But after some research on the application domain for an LIS302DL accelerometer I found out that a simple one dimensional filter will do the job. The accelerometer puts out three dimensional acceleration data. But if you just want to get clean acceleration data from it all formulas simply deal with one dimension. So it was easier to use three different one dimensional Kalman filters. It all ended in a small set of formulas:</p>
<p><em>x = x<br />
p = p + q;</em></p>
<p><em>k = p / (p + r);<br />
x = x + k * (measurement &#8211; x);<br />
p = (1 &#8211; k) * p;</em></p>
<p>The first two formulas represent the prediction of the Kalman Filter. And since there is no information about the driving forces it is very simple. The second three formulas calculate the measurement update. The variables are <em>x</em> for the filtered value,  <em>q</em> for the process noise, <em>r</em> for the sensor noise, <em>p</em> for the estimated error and <em>k</em> for the Kalman Gain. The state of the filter is defined by the values of these variables.</p>
<p>The filter is applied with each measurement and initialized with the process noise <em>q</em>, the sensor noise <em>r</em>, the initial estimated error <em>p</em> and the initial value <em>x</em>. The initial values for <em>p</em> is not very important since it is adjusted during the process. It must be just high enough to narrow down. The initial value for the readout is also not very important, since it is updated during the process.</p>
<p>But tweaking the values for the process noise and sensor noise is essential to get clear readouts.</p>
<h3>Tweaking the Kalman Filter</h3>
<p>The first results were less than ideal. So I decided to use processing and my good old <a href="http://interactive-matter.org/2009/02/arduino-lis302dl/">LIS302DL breakout board</a> to get some insight of the optimal values of the different parameters:</p>
<p>First I looked into the importance of the process noise <em>q</em>, starting by a very high value of 128 (which is the maximum output of the accelerometer):</p>
<p><a title="Process Noise 128" href="http://farm3.static.flickr.com/2549/4194672843_0baecec073_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2549/4194672843_375fde33c4.jpg" alt="Process Noise 128" width="500" height="250" /></a><br />
You see there is nearly no difference between the filtered data (white) and the original data (grey) – since you just see the white line.<br />
If you turn down the process noise, e.g. to a value of 4 things start to change:</p>
<p><a title="Process Noise 4" href="http://farm3.static.flickr.com/2624/4195428360_9bc06e5802_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2624/4195428360_9bc06e5802_o.png" alt="Process Noise 4" width="500" height="250" /></a></p>
<p>If you look closely you see that the sensor data often overshoots the filtered value. The filtered value is pretty close to the real value, but is missing a lot of noise. For my application I needed a more static output, smoothing out nearly all of the noise, giving a clean an steady signal. So lets turn down the process noise value a bit more, e.g. something like 0.125:</p>
<p><a title="Process Noise 0.125" href="http://farm3.static.flickr.com/2727/4195426644_47c6ac3217_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2727/4195426644_5f93a20a79.jpg" alt="Process Noise 0.125" width="500" height="250" /></a></p>
<p>Now we got a quite a clean signal from quite a noisy source. It lags a bit behind the real data, but that is not critical for my application. Compared to the amount of noise reduction it is still quite fast.<br />
After this is set let&#8217;s play a bit around with the sensor noise <em>r</em>:<br />
We start back at <em>r</em>=1:</p>
<p><a title="Sensor Noise 1.0" href="http://farm3.static.flickr.com/2541/4194668397_f0f7e55f51_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2541/4194668397_fbe4e83636.jpg" alt="Sensor Noise 1.0" width="500" height="250" /></a></p>
<p>As expected if we turn down the assumed noise of the sensor the Kalman filter &#8216;relies&#8217; more on the sensor data and gives more noisy results. If we increase the noise factor of the sensor to 4 we get a more stable result again:</p>
<p><a title="Process Noise 4.0" href="http://farm3.static.flickr.com/2546/4195425248_99e844c507_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2546/4195425248_d6b3083536.jpg" alt="Process Noise 0.125" width="500" height="250" /></a></p>
<p>If we go up extreme and assume a noise level of 32 we get the expected steady result:</p>
<p><a title="Process Noise 32.0" href="http://farm3.static.flickr.com/2658/4195424262_a1939bd51f_o.png"><img class="slickr-post colorbox-487" src="http://farm3.static.flickr.com/2658/4195424262_73d3e5d471.jpg" alt="Process Noise 0.125" width="500" height="250" /></a></p>
<p>As expected the filtered value lags significantly behind the real measurement. But it is a much cleaner signal. But  it is questionable if this is still useful.</p>
<h3>Implementing Kalman in C</h3>
<p>Implementing this filter in C code (e.g. for an Arduino) is quite simple. First of all we define a state for a kalman filter:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">double</span> q<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//process noise covariance</span>
  <span style="color: #993333;">double</span> r<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//measurement noise covariance</span>
  <span style="color: #993333;">double</span> x<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//value</span>
  <span style="color: #993333;">double</span> p<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//estimation error covariance</span>
  <span style="color: #993333;">double</span> k<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//kalman gain</span>
<span style="color: #009900;">&#125;</span> kalman_state<span style="color: #339933;">;</span></pre></div></div>

<p>Next we need a function to initialize the kalman filter:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">kalman_state
kalman_init<span style="color: #009900;">&#40;</span><span style="color: #993333;">double</span> q<span style="color: #339933;">,</span> <span style="color: #993333;">double</span> r<span style="color: #339933;">,</span> <span style="color: #993333;">double</span> p<span style="color: #339933;">,</span> <span style="color: #993333;">double</span> intial_value<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  kalman_state result<span style="color: #339933;">;</span>
  result.<span style="color: #202020;">q</span> <span style="color: #339933;">=</span> q<span style="color: #339933;">;</span>
  result.<span style="color: #202020;">r</span> <span style="color: #339933;">=</span> r<span style="color: #339933;">;</span>
  result.<span style="color: #202020;">p</span> <span style="color: #339933;">=</span> p<span style="color: #339933;">;</span>
  result.<span style="color: #202020;">x</span> <span style="color: #339933;">=</span> intial_value<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> result<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And a function to update the kalman state, by calculating a prediction and verifying that against the real measurement:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span>
kalman_update<span style="color: #009900;">&#40;</span>kalman_state<span style="color: #339933;">*</span> state<span style="color: #339933;">,</span> <span style="color: #993333;">double</span> measurement<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//prediction update</span>
  <span style="color: #666666; font-style: italic;">//omit x = x</span>
  state<span style="color: #339933;">-&gt;</span>p <span style="color: #339933;">=</span> state<span style="color: #339933;">-&gt;</span>p <span style="color: #339933;">+</span> state<span style="color: #339933;">-&gt;</span>q<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//measurement update</span>
  state<span style="color: #339933;">-&gt;</span>k <span style="color: #339933;">=</span> state<span style="color: #339933;">-&gt;</span>p <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>state<span style="color: #339933;">-&gt;</span>p <span style="color: #339933;">+</span> state<span style="color: #339933;">-&gt;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  state<span style="color: #339933;">-&gt;</span>x <span style="color: #339933;">=</span> state<span style="color: #339933;">-&gt;</span>x <span style="color: #339933;">+</span> state<span style="color: #339933;">-&gt;</span>k <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>measurement <span style="color: #339933;">-</span> state<span style="color: #339933;">-&gt;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  state<span style="color: #339933;">-&gt;</span>p <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">-</span> state<span style="color: #339933;">-&gt;</span>k<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> state<span style="color: #339933;">-&gt;</span>p<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>What did we learn from this?</h3>
<p>First of all the Kalman filter can be much easier to implement if the underlying model is simple. We had not several dimensions, nor different sensor data to combine. The results are pretty good, but it is a challenge to find the right values for the process and sensor noise. Instead of just coming up with some guesses for the values, they can of course be estimated, but than we have to live with the result of the estimation.</p>
<p>In the end it is a good, robust, simple filter (in one dimension).</p>
<p>I think that in lack of several sensors we throw out the most advantage of the filter to combine several sensor data to a combined result. I think going a bit more in this direction can lead to real interesting results.</p>
<p>Or is there a much easier filter to use for my problem, leading to better results?</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2009/12/arduino-barometric-pressure-sensor-bmp085/' rel='bookmark' title='Permanent Link: Arduino &#038; Barometric Pressure Sensor BMP085'>Arduino &#038; Barometric Pressure Sensor BMP085</a></li>
<li><a href='http://interactive-matter.org/2010/02/bmp085-barometric-pressure-sensor-breakout-boards-arrived/' rel='bookmark' title='Permanent Link: BMP085 Barometric Pressure Sensor Breakout Boards arrived!'>BMP085 Barometric Pressure Sensor Breakout Boards arrived!</a></li>
<li><a href='http://interactive-matter.org/2009/12/decoupling-lis302dl-%e2%80%93-there-i-fixed-it/' rel='bookmark' title='Permanent Link: Decoupling LIS302DL – There I fixed it!'>Decoupling LIS302DL – There I fixed it!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2009/12/filtering-sensor-data-with-a-kalman-filter/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Decoupling LIS302DL – There I fixed it!</title>
		<link>http://interactive-matter.org/2009/12/decoupling-lis302dl-%e2%80%93-there-i-fixed-it/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=decoupling-lis302dl-%25e2%2580%2593-there-i-fixed-it</link>
		<comments>http://interactive-matter.org/2009/12/decoupling-lis302dl-%e2%80%93-there-i-fixed-it/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 19:20:51 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Accelerometer]]></category>
		<category><![CDATA[Decoupling]]></category>
		<category><![CDATA[Fail]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[LIS302DL]]></category>
		<category><![CDATA[Noise]]></category>
		<category><![CDATA[PCB]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=482</guid>
		<description><![CDATA[As you probably know, I really like I2C sensors and especially the LIS302DL. But adding this accelerometer to your circuit is not as straight forward as I thought. But in the end I got it quite right. It all started out with a 0.1µF ceramic capacitor. For good measure I put a ferrite bead in [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>As you probably know, I really like <a href="http://interactive-matter.org/tag/i2c/">I2C</a> <a href="http://interactive-matter.org/category/sensors/">sensors</a> and especially the <a href="http://interactive-matter.org/2009/02/arduino-lis302dl/">LIS302DL</a>. But adding this accelerometer to your circuit is not as straight forward as I thought. But in the end I got it quite right.<br />
<a title="Decoupling LIS302DL" href="http://farm3.static.flickr.com/2649/4188400702_bed6d4677c_b.jpg"><img class="slickr-post colorbox-482" src="http://farm3.static.flickr.com/2649/4188400702_bed6d4677c.jpg" alt="Decoupling LIS302DL" width="500" height="375" /></a><br />
It all started out with a 0.1µF ceramic capacitor. For good measure I put a ferrite bead in front. But this lead to terrible readouts. So I threw in a 10µF 0805 ceramic capacitor and a 4.7µF tantalum capacitor. It does not look nice, nor does it look terribly solid, but it works fine.<br />
So read on, what my analysis of the situation is.<br />
<span id="more-482"></span>My original layout had just a small ferrite bead and a way too small capacitor. And this on a board hosting a ATmega168 and four alphanumeric displays, drawing from 0 to 300mA, from a step up voltage controller. Of course I had about 400µF decoupling capacitors on board, but the direct power supply of the LIS302DL had still about 0.1 Volts of noise on the power supply line. And the readouts were extremely noisy (&gt;10%).</p>
<p>Not good.</p>
<p>Throwing in some capacitance was a good idea and reduced the noise by something like factor 2. But still it is very noisy. The <a href="http://www.st.com/stonline/products/literature/ds/12726.pdf">LIS302DL datasheet</a> suggest using at least a 10µF and a 0.1µF capacitor of different types (e.g. ceramic and tantalum) – I think it is just some minimum requirements. Proper voltage supply with as less noise as possible is a must.</p>
<p>So my next try will be:</p>
<ul>
<li>Redoing the complete layout so that the power supply of the LEDs is uses separate VCC and ground paths than the digital circuit.</li>
<li>Redoing the same for both chips, so that I got some <a href="http://www.aikenamps.com/StarGround.html">star like grounding</a> and supply system. Or some carefully laid out power planes.</li>
<li>Adding bigger ferrite beads in the supply line of the LEDs and both chips, so that each component has its own supply line with ferrite beads and capacitors, to reduce cross talk.</li>
<li>Perhaps adding some <a href="http://en.wikipedia.org/wiki/Low_dropout_regulator">LDO regulator</a> to drive the digital circuitry from 3V instead of 3.3V to reduce the noise of the LEDs or power supply.</li>
</ul>
<p>I alwayys thought good power supply design is just for audio stuff or other high quality applications, but I learned (the hard way) that you also need it for just some basic tinkering.</p>
<p>So off to the next design.</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2009/12/filtering-sensor-data-with-a-kalman-filter/' rel='bookmark' title='Permanent Link: Filtering Sensor Data with a Kalman Filter'>Filtering Sensor Data with a Kalman Filter</a></li>
<li><a href='http://interactive-matter.org/2009/02/arduino-lis302dl/' rel='bookmark' title='Permanent Link: Arduino &#038; LIS302DL'>Arduino &#038; LIS302DL</a></li>
<li><a href='http://interactive-matter.org/2009/05/shed-some-light/' rel='bookmark' title='Permanent Link: Low Voltage RGB LED'>Low Voltage RGB LED</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2009/12/decoupling-lis302dl-%e2%80%93-there-i-fixed-it/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Driving Circuits from a CR2032 Lithium Coin Cell</title>
		<link>http://interactive-matter.org/2009/08/driving-circuits-from-a-cr2032-lithium-coin-cell/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=driving-circuits-from-a-cr2032-lithium-coin-cell</link>
		<comments>http://interactive-matter.org/2009/08/driving-circuits-from-a-cr2032-lithium-coin-cell/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 15:32:26 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[cell batteries]]></category>
		<category><![CDATA[coin cell]]></category>
		<category><![CDATA[CR2032]]></category>
		<category><![CDATA[equivalent series resistance]]></category>
		<category><![CDATA[ESR]]></category>
		<category><![CDATA[internal resistance]]></category>
		<category><![CDATA[Power]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=441</guid>
		<description><![CDATA[Just another good example of &#8216;lesson learned&#8217;. I often use the very common CR2032 coin cell batteries to drive my circuits. Small, cheap, easy to get and there is a quite a range of good and cheap battery holders. But recently I have tested an complete over the top design which pushed the poor little [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Just another good example of &#8216;lesson learned&#8217;. I often use the very common CR2032 coin cell batteries to drive my circuits. Small, cheap, easy to get and there is a quite a range of good and cheap battery holders.</p>
<p><a title="CR2032 Battery" href="http://farm4.static.flickr.com/3517/3734750249_c980a7b27e_o.jpg"><img class="slickr-post colorbox-441" src="http://farm4.static.flickr.com/3517/3734750249_90ddeedbd4.jpg" alt="CR2032 Battery" width="500" height="375" /></a></p>
<p>But recently I have tested an complete over the top design which pushed the poor little CR2032 far beyond its limits. Time to grab a few facts from the datasheet for further reference.</p>
<p><span id="more-441"></span>To get a good example I found a quite elaborate <a href="http://data.energizer.com/PDFs/cr2032.pdf">CR2032 datasheet from Duracell</a>. I think other batteries behave quite similar to this.</p>
<h3>The Issue</h3>
<p>The general key fact of an CR2032 are obvious and quite easy to grab from the datasheet:</p>
<p><em>Voltage: 3V</em></p>
<p><em>Capacity: 240mAh (to 2.0V)</em></p>
<p>If you study the datasheet more closely you will see that the voltages drop sharply after it reaches 2.8V (after it has delivered about 170mAh).</p>
<p><em>ESR (Equivalent Series Resistor):about 18 to 20 Ohms.</em></p>
<p>The ESR (Equivalent Series Resistor) or IR (Internal Resistance) is quite flat up to 150mAh of capacitance &#8211; there it reaches about 20 Ohms. At 170mAh it reaches something like 30 Ohms. This is quite hefty. In comparison good capacitors have a series resistance from some Ohms to a fraction of an Ohm &#8211; so it is always good to put some (even electrolytic) capacitors in parallel to the battery. If you are concerned that switching on or of of your circuits discharges the battery to much by charging up the capacitors – there is a simple trick to prevent it: put the capacitors in front of the &#8216;on&#8217; switch so that are always charged and will not charge after your circuit is switched on. The leakage current will be so small that it will be neglectable in most cases.</p>
<p>But if you want to calculate how much constant current you can draw from these batteries you have to use <a href="http://en.wikipedia.org/wiki/Ohm%27s_law">Ohm&#8217;s law</a>:</p>
<p>V = R * I or I = V /R</p>
<p>If you take the later and say you want no voltage drop higher that 1.2 Volts &#8211; because after that your circuit reaches 1.8 Volts which makes your microcontroller most probably going brown out. Applying these with the ESR of 20 Ohms, you will get something like 60 mA you can draw by them (I = 1.2V/20Ohm). You if calculate more conservative and do not want to go below 2.8V &#8211; which gives you some 0.2 Volts head room  &#8211; you will only be able to draw 10 mA (I = 0.2V/20Ohm) &#8211; just enough for an LED. These calculations do not consider the voltage drop of the battery of its life time.</p>
<p><em>In the bottom line: If you use those batteries you have to consider the 20-30 Ohms series resistance. Especially if you draw some constant current (spikes can be easily removed using capacitors). Yo have to assume 170mAh as maximum capacitance because then the CR2032 reaches 2.8Volts and the ESR goes up to a whopping 30 Ohms – going up from there very steep. Because of the high ESR of the CR2032 you will most probably not be able to draw more than 20-30 mAh safely (as constant current).<br />
</em></p>
<p><em>Perhaps it is even better to get a boost converter to 3 or 3.3V &#8211; to suck out all the juice in the battery. This should should be good for the environment too. Or even better get rechargeable Lithium Cells.<br />
</em></p>
<p>So driving an RGB with an 5V boost op converter is impossible. At white (all three LEDs draw 20mA) it is 60mA current at 5V, considering a efficiency of 80% this will give you more than 120 mAh at 3.3V. Impossible or the CR2032. So my intended design will never work. I wish I had done those calculations before I designed it and not after I saw that the prototype does not work.</p>
<p>You live and learn!</p>
<h3>Some Closer Look</h3>
<p>As we see the higher the current is the more loss we get by the ESR of 20 Ohms. So the question is how much power we can get from an CR2032. If we want to draw the maximum amount of power over a short time we simply take the <a href="http://en.wikipedia.org/wiki/Electric_power">power</a>:</p>
<p>P=V*I</p>
<p>And we know that the voltage is</p>
<p>v=3-20*I</p>
<p>And we get</p>
<p>P=(3-20*I)*I</p>
<p>If we create a little graph from it we get</p>
<p><a title="CR2032 Wattage" href="http://farm4.static.flickr.com/3514/3906676695_f75568a3d6_o.png"><img class="slickr-post colorbox-441" src="http://farm4.static.flickr.com/3514/3906676695_4a25f2f7df.jpg" alt="CR2032 Wattage" width="500" height="282" /></a></p>
<p>So we see that the maximum is somewhere at 75mA and somwhere at 0,1125 Watts. Perhaps the real theoretical value is a bit off – but most real batteries will be a bit off too, so it is a good enough aproximation.</p>
<p>So that is somewhat consistent to our previous calculations to not exceed 80mA to avoid a too big voltage drop.</p>
<p>But how many energy can we draw from an CR2032? For this we simply calculate the watt hour of the battery:</p>
<p>e=P*t and t=0,24A/I</p>
<p>so we get</p>
<p>e=(0,24/I)*P</p>
<p>or</p>
<p><a title="CR2032 Energy" href="http://farm3.static.flickr.com/2551/3906720443_32df955d3a_b.jpg"><img class="slickr-post colorbox-441" src="http://farm3.static.flickr.com/2551/3906720443_32df955d3a.jpg" alt="CR2032 Energy" width="500" height="261" /></a></p>
<p>But this is not very astonishing. The less current you draw the less loss you got at the internal resistor. But I am unsure if there is this resistor, which burns energy to heat. But since the batteries get hot if you draw too much power you will get some loss. But I do not think that the loss is equal to a 20 Ohm resistor. But the main finding is clear – the more current you draw the more loss you have.</p>
<h3>What to do?</h3>
<p>From the comments I got the tip to put the lithium coin cells in series to get a higher coltage at the current draw. But this will enlarge the voltage swing at different current levels (from 6V at 0mA to 3V at 150mA). This can be dangerous for your circuit. A better approach would be to put the batteries in parallel to half the internal ESR – so you would still get 1.5 Volts at 150mA.</p>
<p>Of course to counter current spikes you should allways put sufficiently sized capacitors in parallel. Sufficiently sized depends on the level of current spikes and there time. Just check out how a <a href="http://en.wikipedia.org/wiki/Farad">Farad</a> is defined and you can derrive the needed value (which is the product of voltage change and time).</p>
<p>But in most of my designs space is a rare good. So no parallel batteries and no big capacitor banks.</p>
<p>Something that could work is sucking the power with a boost converter to get a steady output voltage independent of the current draw. This would of course enhance the loss but at least we get the voltage we want at an expense of the efficiency. Right now the calculations are a bit too complicated for this evening. But updates will follow</p>
<p>Lets see how that works.</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2009/12/decoupling-lis302dl-%e2%80%93-there-i-fixed-it/' rel='bookmark' title='Permanent Link: Decoupling LIS302DL – There I fixed it!'>Decoupling LIS302DL – There I fixed it!</a></li>
<li><a href='http://interactive-matter.org/2010/04/skatepov/' rel='bookmark' title='Permanent Link: SkatePOV'>SkatePOV</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2009/08/driving-circuits-from-a-cr2032-lithium-coin-cell/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Interactive Matter: The first year!</title>
		<link>http://interactive-matter.org/2009/08/interactive-matter-the-first-year/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=interactive-matter-the-first-year</link>
		<comments>http://interactive-matter.org/2009/08/interactive-matter-the-first-year/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 06:00:07 +0000</pubDate>
		<dc:creator>Marcus</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[HWYDD]]></category>
		<category><![CDATA[Space Invaders]]></category>
		<category><![CDATA[TV-B-Gone]]></category>

		<guid isPermaLink="false">http://interactive-matter.org/?p=416</guid>
		<description><![CDATA[Unbelievable that this is just the first year of Interactive Matter. But still there happened a lot of things. Lets have a look on what Interactive Matter has managed to achieve. The Beginning It all started with the little idea of having a &#8216;time replay device&#8217;. How was your Day Darling was born. It samples [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Unbelievable that this is just the first year of Interactive Matter. But still there happened a lot of things.</p>
<p><a href="http://interactive-matter.org/2009/07/interactive-matter-goes-kit/"><img class="alignnone colorbox-416" title="Space Invaders goes Kit" src="http://farm3.static.flickr.com/2463/3734747053_e3c7ed47d7_m.jpg" alt="" width="240" height="180" /></a><a href="http://interactive-matter.org/2009/04/space-invaders-button/"><img class="alignnone colorbox-416" title="Space Invaders Button" src="http://farm4.static.flickr.com/3383/3437050307_bdcc51bcc0_m.jpg" alt="" width="240" height="180" /></a><a href="http://interactive-matter.org/2008/10/how-was-your-day-darling/"><img class="alignnone colorbox-416" title="How was your Day Darling?" src="http://farm4.static.flickr.com/3553/3349059009_d3879cdb04_m.jpg" alt="" width="240" height="180" /></a><a href="http://interactive-matter.org/2008/12/gravitron/"><img class="alignnone colorbox-416" title="Gravitron" src="http://farm4.static.flickr.com/3107/3130088565_3b054502b3_m.jpg" alt="" width="240" height="180" /></a></p>
<p>Lets have a look on what Interactive Matter has managed to achieve.</p>
<p><span id="more-416"></span></p>
<h2>The Beginning</h2>
<p>It all started with the little idea of having a &#8216;time replay device&#8217;. <a href="http://interactive-matter.org/2008/10/how-was-your-day-darling/">How was your Day Darling</a> was born. It samples the light levels during the day and if you take in your hand it plays it back.</p>
<p>The first prototype was still a bit rough but functional:</p>
<p><a title="HWYDD: Prototype internals" href="http://farm4.static.flickr.com/3115/2770813216_56d524b014_o.png"><img class="colorbox-416"  src="http://farm4.static.flickr.com/3115/2770813216_fe690c0559.jpg" alt="" width="500" height="357" /></a></p>
<p>But soon it evolved in perhaps the nicest PCB I have done yet:</p>
<p><a href="http://farm4.static.flickr.com/3098/2837650398_354ab12346_b.jpg"><img class="slickr-post colorbox-416" src="http://farm4.static.flickr.com/3098/2837650398_354ab12346.jpg" alt="The hwydd board" width="500" height="357" /></a></p>
<p>The final &#8216;<a href="http://interactive-matter.org/2008/10/how-was-your-day-darling/">How was your Day Darling</a>&#8216; was nice, but till a bit week. I think this is a project I have to come back to.</p>
<h2><a href="http://interactive-matter.org/2008/12/gravitron/">Gravitron</a></h2>
<p>After the first success of How was your day darling I did something very dumb. After some beers I promised to create some Cylon/KITT like device in half a ping pong ball. Of course the concept got completely out of hand. After thinking how to switch it on I realized that the &#8216;easiest&#8217; would be to include an accelerometer and detect motion. But if you have a accelerometer in it you can also play around with gravity, implement some minimalistic physics engine and implement a &#8216;air bubble&#8217; with LEDs:</p>
<p>httpv://www.youtube.com/watch?v=m31_mkeNV3g</p>
<p>The original KITT-like animation was just used to indicate that the device is going to sleep. But this design ultimately got me to SMT. First of all it was hard to solder the ADXL accelerometer. So I bought an hot air rework station. And after that I was able to solder nearly any SMT device. Which is way cool.</p>
<h2>Long Term Goal: <a href="http://interactive-matter.org/2009/04/space-invaders-button/">Space Invaders Button</a></h2>
<p>The idea for my Space Invaders Button is very old. I existed before I started with all this electronics stuff. I promised a friend of mine to get here some button for her jacket, displaying space invaders characters. I thought that it cannot be that easy. In the end it was more complicated than I thought- but at the end I was able to achieve it:</p>
<p><a href="http://farm4.static.flickr.com/3383/3437050307_bdcc51bcc0_b.jpg"><img class="colorbox-416"  src="http://farm4.static.flickr.com/3383/3437050307_bdcc51bcc0.jpg" alt="" width="500" height="375" /></a></p>
<p>It was a great success, I must admit. People love it so much that I am currently working on a kit. So stay tuned and see what will be coming along. This design has still a lot of potential. It should be still able to use the LEDs as inputs (e.g. to detect touch or ambient light level). And there could also be some easier way to download custom animations on it. Another design which I have to revisit if I got some time.</p>
<h2><a href="http://interactive-matter.org/2009/07/%c2%b5tvbg-tv-b-gone-clone/">µTVBG</a></h2>
<p>The µTVBG was just some kind of SMT exercise. I questioned myself how small can you go tu build an TV-B-Gone clone. Ther result was quite nice. A working TV-B-Gone on approximate 2cm²:</p>
<p><a title="µTVBG" href="http://farm4.static.flickr.com/3554/3687153902_162fe47fde_b.jpg"><img class="colorbox-416"  src="http://farm4.static.flickr.com/3554/3687153902_162fe47fde.jpg" alt="ÂµTVBG" width="500" height="400" /></a></p>
<p>Surely you will be able to make it smaller. Lets see how this evolves.</p>
<h2>Whats coming up?</h2>
<p>There are still a lot of projects in the pipeline. They rank from funny simple pranks to full scale product ideas. Of course all of them are in a much to early state to talk about. But stay tuned. They will be coming.</p>
<p>Another big issue right now is creating kits. Interactive Matter will offer solder-yourself SMT kits for all skill levels. But this topics needs some time too to evolve.</p>


<p>Related posts:<ul><li><a href='http://interactive-matter.org/2009/07/interactive-matter-goes-kit/' rel='bookmark' title='Permanent Link: Interactive Matter goes Kit'>Interactive Matter goes Kit</a></li>
<li><a href='http://interactive-matter.org/2010/02/blinken-button-%e2%80%93-the-led-matrix-button-kit/' rel='bookmark' title='Permanent Link: Blinken Button – The LED Matrix Button Kit'>Blinken Button – The LED Matrix Button Kit</a></li>
<li><a href='http://interactive-matter.org/2010/05/blinken-buttons-for-beginners-a-smt-beginners-kit/' rel='bookmark' title='Permanent Link: Blinken Buttons for Beginners &#8211; a SMT Beginners Kit'>Blinken Buttons for Beginners &#8211; a SMT Beginners Kit</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://interactive-matter.org/2009/08/interactive-matter-the-first-year/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc (user agent is rejected)

Served from: interactive-matter.org @ 2010-09-10 09:35:57 -->