<?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>digital things and physical computing &#187; arduino</title>
	<atom:link href="http://ericholm.nl/blog/tag/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericholm.nl/blog</link>
	<description>things, tinkering and thougths by eric</description>
	<lastBuildDate>Fri, 04 Jun 2010 14:58:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Liquid tester</title>
		<link>http://ericholm.nl/blog/2009/08/liquid-tester/</link>
		<comments>http://ericholm.nl/blog/2009/08/liquid-tester/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 16:04:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[campusparty09]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://ericholm.nl/blog/?p=146</guid>
		<description><![CDATA[At the &#8216;Campus Party&#8216; in Valencia I gave an Arduino introduction workshop, and there were some very good results. Juan Ferrer and Jorge Cases built a liquid tester, with only two wires and a resistor, which can measure the resistance of a liquid. Because every liquid has a different resistance you can separate different drinks [...]]]></description>
			<content:encoded><![CDATA[<p>At the &#8216;<a href="http://campus-party.es">Campus Party</a>&#8216; in Valencia I gave an Arduino introduction workshop, and there were some very good results.</p>
<p>Juan Ferrer and Jorge Cases built a liquid tester, with only two wires and a resistor, which can measure the resistance of a liquid. Because every liquid has a different resistance you can separate different drinks like water or orange juice. With some <a href="http://processing.org">Processing</a> <a href="wp-content/uploads/2009/08/liquidtestProcessing.zip">code</a> you can do something nice with those values.</p>
<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/FsKtga3V3DE&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FsKtga3V3DE&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p>
<p><strong>How to make your own liquid tester:</strong><br />
You need an Arduino, some wires and a 10K resistor.<br />
Upload the standardFirmata to the Arduino, read <a href="http://www.arduino.cc/playground/Interfacing/Processing">this</a> for more info.<br />
<span id="more-146"></span><br />
<img src="http://ericholm.nl/blog/wp-content/uploads/2009/08/liquid-test-150x150.jpg" alt="liquid tester" title="liquid tester" width="150" height="150" class="alignnone size-thumbnail wp-image-149" /></p>
<pre class="brush: cpp; title: ;">
// Detector de Liquidos (Liquid Detector)
// By Juan Ferrer and Jorge Cases
// open this file in Processing and upload the Standard Firmata to your Arduino
// connect the wires to the analog input port number 0

import processing.serial.*;
import cc.arduino.*;

Arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

color blueColor = color(0,0,250);
color orangeColor = color(255,128,0);

int heightVal = 280;
int widthVal = 470;
int adjust = 20;
PFont fontA;

void drawGraph() {
  line(adjust,adjust,adjust,heightVal-(adjust*2));
  line(adjust,heightVal-(adjust*2),widthVal-(adjust*2),heightVal-(adjust*2));
}

void setup() {
  size(widthVal, heightVal);
  arduino = new Arduino(this, Arduino.list()[0], 115200);
  fontA = loadFont(&quot;CourierNew36.vlw&quot;);
  textFont(fontA, 32);
}

void draw() {
  background(off);
  stroke(on);

  drawGraph();
  int value = arduino.analogRead(0);

  if (value &lt; 980 &amp;&amp; value &gt; 900) {
    fill(blueColor);
    text(&quot;this is water&quot;, 200, 90);
  } else if (value&lt;800 &amp;&amp; value &gt; 700) {
    fill(orangeColor);
    text(&quot;this is orange juice&quot;, 200, 90);
  }
  else {
    fill(off);
    text(&quot;&quot;, 200, 90);
  }
  println(value);
  rect(adjust,heightVal-(adjust*2),50,-(heightVal-(adjust*2))*value/1024);
  delay(500);
}
</pre>
<p><a href="http://ericholm.nl/blog/wp-content/uploads/2009/08/liquidtestProcessing.zip">download processing.org code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ericholm.nl/blog/2009/08/liquid-tester/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Coffee machine on Twitter</title>
		<link>http://ericholm.nl/blog/2009/05/the-coffee-machine-on-twitter/</link>
		<comments>http://ericholm.nl/blog/2009/05/the-coffee-machine-on-twitter/#comments</comments>
		<pubDate>Sun, 17 May 2009 20:01:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[physical computing]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://ericholm.nl/blog/?p=18</guid>
		<description><![CDATA[After @BarackObama, @BritneySpears and @oprah it is now time for the coffeemachine to get on Twitter and add some meaning full words. What does it do? It will tweet “the coffee machine says: I’m making coffee” if you turn on the coffeemachine, if you switch it off it will tweet “the coffee machine says: someone [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ericholm.nl/blog/wp-content/uploads/2009/05/coffeemachine.jpg" alt="coffeemachine" title="coffeemachine" width="500" height="200" class="alignnone size-full wp-image-39" /></p>
<p><strong><em>After <a href="http://twitter.com/BarackObama">@BarackObama</a>, <a href="http://twitter.com/BritneySpears">@BritneySpears </a>and <a href="http://twitter.com/OprahWinfrey">@oprah</a> it is now time for the coffeemachine to get on Twitter and add some meaning full words.</em></strong></p>
<p></p>
<h3>What does it do?</h3>
<p>It will tweet “the coffee machine says: I’m making coffee” if you turn on the coffeemachine, if you switch it off it will tweet “the coffee machine says: someone switched me off”.</p>
<p></p>
<h3>How does it work?</h3>
<p>This is an overview of the hardware/software/services I used:<br />
<strong>Sensor > Arduino > Processing > PHP > Twitter</strong></p>
<p>A LDR (<a href="http://en.wikipedia.org/wiki/Light_Dependent_Resistor">light dependent resistor</a>) is glued on the on/off led of the coffeemachine. When the coffeemachine is switched on the led turns on, the ldr detects this light. This LDR is connected to an Arduino microcontroller, Processing reads the value from the Arduino using Firmata and Processing sends this to a php file which will send it to Twitter.</p>
<p></p>
<h3>How to build your own?</h3>
<p>Although it looks a bit overwhelming it is very easy to build your own tweeting &#8216;whatever&#8217; thing, All hardware, software and scripts I used to build this are opensource. I just hacked everything together.<br />
You will need the following:
<ul>
<li><a href="http://arduino.cc">Arduino</a> board + software</li>
<li><a href="http://en.wikipedia.org/wiki/Light_Dependent_Resistor">LDR</a> (or an other analog sensor)</li>
<li><a href="http://processing.org">Processing</a> (Processing.org)</li>
<li>webhosting with php support</li>
<li>a <a href="http://twitter.com">Twitter</a> account</li>
</ul>
<h3>Source files:</h3>
<p><a href="http://ericholm.nl/blog/wp-content/uploads/2009/05/coffeemachine-twitter.zip">» Download Processing code + PHP source files</a></p>
<p><span id="more-18"></span></p>
<h3>What do I need to do to get this working on my computer?</h3>
<p>I use the <a href="http://www.arduino.cc/playground/Interfacing/Processing">Arduino Library for Processing</a>  and the Firmata firmware for the Arduino (included in Arduino 12 or higher).</p>
<p><strong>1)</strong> Unzip the file ‘processing-arduino2.zip’ and copy the &#8220;arduino&#8221; folder into the &#8220;libraries&#8221; sub-folder of your Processing Sketchbook. (You can find the location of your Sketchbook by opening the Processing Preferences. If you haven&#8217;t made a &#8220;libraries&#8221; sub-folder, create one.)</p>
<p><strong>2)</strong> Start the Arduino application and open the Examples > Library-Firmata > StandardFirmata sketch, and upload it to the Arduino board.</p>
<p><strong>3)</strong> Upload the php files on your (php enabled) server in a folder called ‘twittertest’ (for example)<br />
Open the file ‘coffeemachine_processing.pde’ with Processing, and edit the following lines:<br />
- change the variable:<br />
<code>twitterPassword = "yourTwitterPassword";</code><br />
- change the portnumber for the Arduino:<br />
<code>arduino = new Arduino(this, Arduino.list()[2]);</code><br />
- change the url:<br />
<code>new URL("http://www.yourdomain.com/twittertest/insertTwitterMsg.php?pass="+twitterPassword+"&#038;msg="+msg).openStream();</code></p>
<p><strong>4)</strong> Open the file ‘insertTwitterMsg.php’ with a text editor and change the variable ‘$twitterUsername’ in your Twitter username.?</p>
<p><strong>5)</strong> Open the file ‘ coffeemachine_processing.pde’ in Processing and press ‘run’. Now you should have your own Tweeting arduino sensor.</p>
<p>Instead of a coffeemachine there are hundreds of other possibilities, you can connect almost every sensor or object to Twitter, and build your own ‘internet of things’.<br />
Next week I will post a &#8216;Who&#8217;s at the Office&#8217; Processing script that scans computernames in a local network, so stay tuned&#8230;</p>
<p><i>The Processing source file &#8216;coffeemachine_processing.pde&#8217;:</i></p>
<pre class="brush: cpp; title: ;">
/*
coffeemachineProcessing - receives Arduino input from sensor and sends a message to Twitter
Date: 05-2009
Copyleft by Eric Holm 

http://ericholm.nl/blog

*/

// import the Serial port library
import processing.serial.*;
// import the firmata arduino library
import cc.arduino.*;

Arduino arduino;
int sensorPin = 0;    // Analog input pin
int sensorValue = 0;  // value read from analog input
Boolean isBusy = false;
String twitterPassword;

void setup() {
  // CHANGE YOUR TWITTER PASSWORD
  twitterPassword = &quot;yourTwitterPassword&quot;;

  // CHANGE YOUR PORT NUMBER
  arduino = new Arduino(this, Arduino.list()[2]); // v2
  arduino.pinMode(sensorPin, Arduino.INPUT);
}

void draw() {
  sensorValue = arduino.analogRead(sensorPin); // read the analog value
  // if the analog value is below a certain value
  if (sensorValue &lt; 930) {
    switchCoffee(true);
  }
  // if the analog value is above a certain value
  if (sensorValue &gt; 800) {
    switchCoffee(false);
  }
  // for testing the value
  println(sensorValue);
  // delay for 5 seconds
  delay(5000);
} 

public void switchCoffee(Boolean switchState){
  if (switchState) {
    if (isBusy == false) {
      // switch on the led on port 13 of the arduino
      arduino.digitalWrite(13, Arduino.HIGH);
      // for testing inside the Processing IDE
      println(&quot;the coffee machine says: I'm making coffee&quot;);
      sendToTwitter(&quot;I%20am%20making%20coffee&quot;);
      isBusy = true;
    }
  } else {
  if (isBusy == true) {
     // switch on the led on port 13 of the arduino
     arduino.digitalWrite(13, Arduino.LOW);
     // for testing inside the Processing IDE
     println(&quot;the coffee machine says: someone switched me off&quot;);
     sendToTwitter(&quot;someone%20switched%20me%20off&quot;);
     isBusy = false;
    }
  }
}

public void sendToTwitter(String msg){
  try {
    // calls the PHP script on your own domain with the 'msg' string as a parameter
    new URL(&quot;http://www.yourdomain.com/twittertest/insertTwitterMsg.php?pass=&quot;+twitterPassword+&quot;&amp;msg=&quot;+msg).openStream();
    // wait 3 seconds..
    delay(3000);
  }
  catch (Exception theException) {
    theException.printStackTrace();
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ericholm.nl/blog/2009/05/the-coffee-machine-on-twitter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Arduino Unplugged Workshop at Mediamatic</title>
		<link>http://ericholm.nl/blog/2007/03/arduino-unplugged-workshop-at-mediamatic/</link>
		<comments>http://ericholm.nl/blog/2007/03/arduino-unplugged-workshop-at-mediamatic/#comments</comments>
		<pubDate>Tue, 20 Mar 2007 12:34:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[physical computing]]></category>

		<guid isPermaLink="false">http://ericholm.nl/blog/?p=8</guid>
		<description><![CDATA[A bit late with posting this. Last week I was at the &#8216;Arduino Unplugged Workshop&#8217; hosted by Mediamatic. Beside a general introduction to the (normal) Arduino NG the workshop focussed also on the new Bluetooth Arduino. Alltough the Bluetooth part isn&#8217;t documented very well at the moment, it definitely has a lot of possibilities. I [...]]]></description>
			<content:encoded><![CDATA[<p>A bit late with posting this. Last week I was at the &#8216;Arduino Unplugged Workshop&#8217; hosted by <a href="http://www.mediamatic.net">Mediamatic</a>. Beside a general introduction to the (normal) Arduino NG the workshop focussed also on the new <a href="http://www.arduino.cc/en/Main/ArduinoBoardBluetooth">Bluetooth Arduino</a>. Alltough the Bluetooth part isn&#8217;t documented very well at the moment, it  definitely has a lot of possibilities.<br />
I made a small <a href="http://www.mediamatic.net/article-14787-en.html">report</a> and some <a href="http://www.flickr.com/photos/stupidsimple/sets/72157600004902068/">pictures</a>.</p>
<p>
<img src="http://ericholm.nl/blog/wp-content/uploads/2009/05/participants-150x150.jpg" alt="participants" title="participants" width="150" height="150" class="alignnone size-thumbnail wp-image-88" />
</p>
<p>
<img src="http://ericholm.nl/blog/wp-content/uploads/2009/05/massimo_ubi-150x150.jpg" alt="massimo_ubi" title="massimo_ubi" width="150" height="150" class="alignnone size-thumbnail wp-image-86" />
</p>
<p>
<img src="http://ericholm.nl/blog/wp-content/uploads/2009/05/lcd_display-150x150.jpg" alt="lcd_display" title="lcd_display" width="150" height="150" class="alignnone size-thumbnail wp-image-87" /></p>
]]></content:encoded>
			<wfw:commentRss>http://ericholm.nl/blog/2007/03/arduino-unplugged-workshop-at-mediamatic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino Introduction presentation</title>
		<link>http://ericholm.nl/blog/2007/02/arduino-introduction-presentation/</link>
		<comments>http://ericholm.nl/blog/2007/02/arduino-introduction-presentation/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 12:38:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Gyro powerball game]]></category>
		<category><![CDATA[arduino]]></category>

		<guid isPermaLink="false">http://ericholm.nl/blog/?p=4</guid>
		<description><![CDATA[I just had my first presentation at the Medialab. It was just a introduction to Arduino itself and a small word about physical computing in general. Presentation files: Arduino Introduction (pdf, 0,4 MB) I also showed a demo of my pong with the Arduino and an accelerometer, not really a replacement for the wii controller, [...]]]></description>
			<content:encoded><![CDATA[<p>I just had my first presentation at the Medialab.<br />
It was just a introduction to Arduino itself and a small word about physical computing in general.</p>
<p>Presentation files: Arduino Introduction (pdf, 0,4 MB)</p>
<p>I also showed a demo of my pong with the Arduino and an accelerometer,<br />
not really a replacement for the <a href="http://en.wikipedia.org/wiki/Wii_Remote">wii controller</a>, but it&#8217;s a start <img src='http://ericholm.nl/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div id="flashcontent">
<p>pong accelerometer</p>
</div>
<p><script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("data/pong.swf", "pong", "320", "240", "8");
		//so.addParam("scale", "noscale");
		so.write("flashcontent");
		// ]]&gt;
	</script></p>
<p>For the geeks:<br />
I used a 2-axis digital accelerometer called &#8220;adxl202 JQC&#8221; from Analog Device. For reading the sensor I slighty modified the standard &#8220;accelerometer_memsic2125&#8243; code.</p>
<p>For communicating between the Arduino and flash I used the <a href="http://itp.nyu.edu/~dbo3/SerialServer/SerialServer.html">SerialServer</a> from Dan O&#8217;Sullivan. It&#8217;s not really simple to setup but once its working it works great.</p>
<p>for more information about Arduino check the <a href="http://www.arduino.cc">&#8216;official&#8217; Arduino site</a> with a lot of tutorials and examples, and a very usefull <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl">forum</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://ericholm.nl/blog/2007/02/arduino-introduction-presentation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

