<?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>jamin.org &#187; arduino</title>
	<atom:link href="http://jamin.org/tag/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamin.org</link>
	<description>Jamin Hegeman on design, writing, and life</description>
	<lastBuildDate>Wed, 09 Jun 2010 16:42:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Lampie: RFID and Sensor Lamp</title>
		<link>http://jamin.org/archives/2007/lampie-rfid-and-sensor-lamp/</link>
		<comments>http://jamin.org/archives/2007/lampie-rfid-and-sensor-lamp/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 20:20:41 +0000</pubDate>
		<dc:creator>Jamin</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[makingfurnitureinteractive]]></category>
		<category><![CDATA[muscle wire]]></category>
		<category><![CDATA[rfid]]></category>
		<category><![CDATA[sensor]]></category>

		<guid isPermaLink="false">http://jamin.org/archives/2007/lampie-rfid-and-sensor-lamp/</guid>
		<description><![CDATA[<a href="http://jamin.org/archives/2007/lampie-rfid-and-sensor-lamp/"><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0006_lampiefinal.jpg" /></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0006_lampiefinal.jpg" /></p>
<p>Final Project<br />
Making Furniture Interactive<br />
Carnegie Mellon University<br />
Fall 2007</p>
<h3>Abstract</h3>
<p>The more complex the artifacts we interact with become, the more we personify their behavior. The goal of this project was to explore interacting with a small, playful form and the emotional connection between a person and an artifact. I chose a lamp, and used RFID, a motion sensor, muscle wire, and computing for the interaction. Unfortunately, the muscle wire did not exert the strength needed to move the form, and it was abandoned for the final artifact.</p>
<h3>How It Works</h3>
<p>Lampie likes it when people are around. When Lampie is not turned on but detects motion through a PIR sensor, the three LEDs alternate in a soothing pattern. If no motion is detected, Lampie becomes agitated, which results in rapid blinking lights. After a certain amount of time, Lampie&#8217;s agitation elevates. Motion calms him, but ultimately, Lampie wants to be turned on. His agitation has memory, so that if he is calmed after being really agitated he will return to his previous state as soon as no motion is detected.</p>
<p>Lampie can be turned on and off only by a specific RFID tag. You can watch the video to see how this all works.</p>
<p>[wp_youtube]HynsbLjcq-c[/wp_youtube]</p>
<p>Lampie&#8217;s thinking is a result of Processing code run within the Arduino development environment.</p>
<h3>Materials</h3>
<ul>
<li>Arduino microprocessor</li>
<li>Breadboard</li>
<li>Parallax RFID Reader</li>
<li>Passive RFID tags</li>
<li>Parallax PIR Sensor</li>
<li>5mm While LED 3.6V 20mA 1100mcd</li>
<li>Jumbo Super-Bright Red LED 2.4V 20mA 5000mcd</li>
<li>5mm Yellow LED 2V 20mA</li>
<li>3 15o-Ohm resistors</li>
<li>22-gauge solid wire</li>
<li>MacBook Pro (for power)</li>
<li>Foam core</li>
<li>Vellum</li>
<li>Electrical tape</li>
</ul>
<p>Not in final, but used extensively throughout the process:</p>
<ul>
<li>.008 inch actuactor wire (muscle wire)</li>
<li>2 1-watt 10-Ohm resistors</li>
</ul>
<h3>Process</h3>
<p>I started with the RFID reader, thinking that would be the main challenge. Originally, I started with a Phidgets RFID reader lent to me by my professor. But it needed to be connected to the computer to work, and I hoped the lamp would not need to be connected to a computer in the end. So instead I ordered an RFID reader from Parallax that used a serial connection to the Arduino board. I then used <a href="http://www.arduino.cc/playground/Learning/PRFID" target="_blank">code from the Arduinio Playground</a> to get the reader working. One problem that I never perfected was having the reader stop reading after identifying the correct RFID tag. (I suspect it might have something to do with the slow serial speed: 2,400 baud.) So sometimes it would turn the lamp off after turning it on, or vice versa. But I chalked that up to Lampie having a mind of his own.</p>
<p><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0003_rfidreader.jpg" alt="RFID Reader" /></p>
<p>The muscle wire proved much more challenging, largely because it needed a precise amp current and I did not understand how circuits worked. After a lot of frustration, a lot of seared foam core, and a lot of time looking at <a href="http://www.allaboutcircuits.com" target="_blank">All About Circuits</a>, I got it working.</p>
<p><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0000_musclewire.jpg" /></p>
<p>I used <a href="http://www.arduino.cc/playground/Code/PIRsense" target="_blank">code for the PIR sensor</a> again from the Arduino Playground. No problems there.</p>
<p>With the technology working, I turned to out to be my greatest challenge: form. Here are some early sketches of what I imagined.</p>
<p><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0002_sketches.jpg" alt="Lampie sketches" /></p>
<p>Having little experience in physical prototyping, bringing everything together proved to be a hurdle I could not overcome completely, as I could not implement the muscle wire in a way that would have an forcible impact on the lamp. Also, the size of the Arduino processor, breadboard, and RFID reader meant the form could not be as small as I hoped. Like all design, I learned in the actual making, and iterated as needed.</p>
<p>I built a box out of foam core that had a raised shelf, on which the breadboard sat. Rather than hide the wires for the LEDs, I used them as part of the design, and created an LED flower garden aesthetic. The breadboard was covered with vellum, as were the LEDs.</p>
<p>Attempts to use the muscle wire and its requirement of precise current meant I stuck with the laptop as a power source. You can still the muscle wire in this prototype.</p>
<p><img src="http://jamin.org/blog/wp-content/uploads/2007/12/process-photos_0005_lateprototype1.jpg" /></p>
<p>But ultimately, the muscle wire was removed.</p>
<p>I programmed Lampie to have an on and off state, and I used to timer to increase his excitement level if there was no motion detected during the off state. Turning Lampie on resets the timer.</p>
<p><span id="more-425"></span></p>
<p><a href="http://jamin.org/blog/wp-content/uploads/2007/12/rfid2_pir3-071217a.zip" title="Source Code">Download Arduino Source Code</a></p>
<p>[sourcecode language='cpp']<br />
/////////////////////////////<br />
//VARS<br />
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)<br />
int calibrationTime = 30;</p>
<p>//the time when the sensor outputs a low impulse<br />
long unsigned int lowIn;</p>
<p>//the amount of milliseconds the sensor has to be low<br />
//before we assume all motion has stopped<br />
long unsigned int pause = 5000;</p>
<p>boolean lockLow = true;<br />
boolean takeLowTime;</p>
<p>int timerLimit = 50000;<br />
int timer = 0;<br />
int noOwnerLimit = 5;<br />
int noOwner = 0;</p>
<p>int pirPin = 11;    //the digital pin connected to the PIR sensor&#8217;s output</p>
<p>// RFID reader for Arduino<br />
// Wiring version by BARRAGAN <http:><br />
// Modified for Arudino by djmatic</http:></p>
<p>int  val = 0;<br />
char code[10];<br />
int bytesread = 0;<br />
char message[6] = &#8220;hello&#8221;;<br />
// char worldtag[12] = &#8220;0415D8A2BCC&#8221;;<br />
char worldtag[12] = &#8220;0F02F2D2EAA&#8221;;<br />
int digit = 0;<br />
int led1 = 9;<br />
int led2 = 5;<br />
int led3 = 6;<br />
int rfidPin = 2;<br />
int blinkDelayOn = 10;<br />
int blinkDelayOff = 30;<br />
boolean lampieOn = false;<br />
boolean motion = false;</p>
<p>void setup() {</p>
<p>Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps<br />
pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin<br />
pinMode(led1, OUTPUT);      // sets the digital pin as output<br />
digitalWrite(rfidPin, LOW);                  // Activate the RFID reader<br />
pinMode(led2, OUTPUT);  // declare the led1 as an OUTPUT<br />
pinMode(led3, OUTPUT);  // declare the led1 as an OUTPUT</p>
<p>pinMode(pirPin, INPUT);<br />
digitalWrite(pirPin, LOW);</p>
<p>//give the sensor some time to calibrate<br />
Serial.print(&#8220;calibrating sensor &#8220;);<br />
for(int i = 0; i < calibrationTime; i++){<br />
Serial.print(".");<br />
quickBlink(led3);<br />
delay(1000);<br />
}<br />
Serial.println(" done");<br />
Serial.println("SENSOR ACTIVE");</p>
<p>digitalWrite(led3, LOW);<br />
}</p>
<p>void loop() {</p>
<p>// Code for the PIR Sensor</p>
<p>if(digitalRead(pirPin) == HIGH){<br />
motionDetected();</p>
<p>if(lockLow){<br />
//makes sure we wait for a transition to LOW before any further output is made:<br />
lockLow = false;<br />
Serial.println("---");<br />
Serial.print("motion detected at ");<br />
Serial.print(millis()/1000);<br />
Serial.println(" sec");<br />
delay(50);<br />
}<br />
takeLowTime = true;<br />
}</p>
<p>if(digitalRead(pirPin) == LOW){<br />
noMotion();</p>
<p>if(takeLowTime){<br />
lowIn = millis();          //save the time of the transition from high to LOW<br />
takeLowTime = false;       //make sure this is only done at the start of a LOW phase<br />
}<br />
//if the sensor is low for more than the given pause,<br />
//we assume that no more motion is going to happen<br />
if(!lockLow &#038;&#038; millis() - lowIn > pause){<br />
//makes sure this block of code is only executed again after<br />
//a new motion sequence has been detected<br />
lockLow = true;<br />
/*<br />
Serial.print(&#8220;motion ended at &#8220;);      //output<br />
Serial.print((millis() &#8211; pause)/1000);<br />
Serial.println(&#8221; sec&#8221;);<br />
*/<br />
delay(50);<br />
}<br />
if (timer == timerLimit) {<br />
timer = 0;</p>
<p>if (lampieOn == false &#038;&#038; noOwner < noOwnerLimit) {<br />
getAngry();<br />
noOwner++;<br />
}<br />
else if (lampieOn == false &#038;&#038; noOwner >= noOwnerLimit) {<br />
getReallyAngry();<br />
noOwner++;<br />
}<br />
}<br />
timer++;<br />
//Serial.println(timer);<br />
}</p>
<p>// Code for the RFID Reader</p>
<p>if(Serial.available() > 0) {          // if data available from reader<br />
if((val = Serial.read()) == 10) {   // check for header<br />
bytesread = 0;<br />
while(bytesread<10) {              // read 10 digit code<br />
if( Serial.available() > 0) {<br />
val = Serial.read();<br />
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading<br />
break;                       // stop reading<br />
}<br />
code[bytesread] = val;         // add the digit<br />
//Serial.println(code);<br />
bytesread++;                   // ready to read next digit</p>
<p>}<br />
}<br />
if(bytesread == 10) {              // if 10 digit read is complete</p>
<p>if(code[6] == worldtag[6]) {<br />
/*<br />
Serial.print(&#8220;World Tag: &#8220;);   // possibly a good TAG</p>
<p>Serial.print(code);            // print the TAG code<br />
Serial.print(&#8221; vs &#8220;);<br />
Serial.println(worldtag);<br />
*/<br />
if(lampieOn == false) {<br />
turnLampieOn();<br />
}<br />
else {<br />
turnLampieOff();<br />
}<br />
}<br />
else {</p>
<p>Serial.print(code);<br />
Serial.print(&#8221; vs &#8220;);<br />
Serial.println(worldtag[6]);</p>
<p>}<br />
}<br />
bytesread = 0;<br />
// wait for a second<br />
}<br />
}<br />
else {<br />
//digitalWrite(led1, LOW);<br />
//blink(led2);<br />
//blink(led3);<br />
}<br />
}</p>
<p>void quickBlink(int pin) {<br />
digitalWrite(pin, HIGH);<br />
delay(50);<br />
digitalWrite(pin, LOW);<br />
}</p>
<p>void blink(int pin) {<br />
fadeIn(pin);<br />
delay(blinkDelayOn);<br />
fadeOut(pin);<br />
delay(blinkDelayOff);<br />
}</p>
<p>void fadeIn(int pin) {<br />
//Serial.println(pin);<br />
for(int value = 0 ; value <= 255; value+=5) // fade in (from min to max)<br />
{<br />
analogWrite(pin, value);           // sets the value (range from 0 to 255)<br />
delay(10);                            // waits for 30 milli seconds to see the dimming effect<br />
}<br />
}</p>
<p>void fadeOut(int pin) {<br />
//Serial.println(pin);<br />
for(int value = 255; value >=0; value-=5)   // fade out (from max to min)<br />
{<br />
analogWrite(pin, value);<br />
delay(10);<br />
}<br />
}</p>
<p>void turnLampieOff() {<br />
digitalWrite(led1, LOW);<br />
digitalWrite(led2, LOW);<br />
digitalWrite(led3, LOW);<br />
lampieOn = false;<br />
Serial.println(&#8220;Lampie off&#8221;);<br />
digitalWrite(2, HIGH);             // deactivate RFID reader<br />
delay(2000);<br />
digitalWrite(rfidPin, LOW);                  // Activate the RFID reader<br />
}<br />
void turnLampieOn() {<br />
noOwner = 0; // reset back to 0;<br />
Serial.println(timer);<br />
for (int i = 0; i < 3; i++) {<br />
quickBlink(led1);<br />
quickBlink(led2);<br />
quickBlink(led3);<br />
delay(200);<br />
}<br />
digitalWrite(led1, HIGH);   // sets the LED on<br />
digitalWrite(led2, HIGH);<br />
digitalWrite(led3, HIGH);<br />
lampieOn = true;</p>
<p>Serial.println(&#8220;Lampie on&#8221;);<br />
digitalWrite(2, HIGH);             // deactivate RFID reader<br />
delay(5000);<br />
digitalWrite(rfidPin, LOW);                  // Activate the RFID reader</p>
<p>}</p>
<p>void motionDetected() {<br />
//Serial.println(&#8220;motion detected&#8221;);<br />
//digitalWrite(led2, HIGH);   //the led visualizes the sensors output pin state<br />
if(lampieOn == false) {<br />
getExcited();<br />
}<br />
}<br />
void noMotion() {<br />
//Serial.println(&#8220;no motion&#8221;);<br />
//digitalWrite(led2, LOW);  //the led visualizes the sensors output pin state<br />
}</p>
<p>void getExcited() {<br />
blink(led1);<br />
blink(led2);<br />
blink(led3);<br />
}</p>
<p>void allBlink() {<br />
quickBlink(led1);<br />
quickBlink(led2);<br />
quickBlink(led3);<br />
}</p>
<p>void getAngry() {<br />
Serial.println(&#8220;angry&#8221;);<br />
for (int i = 0; i < 3; i++) {<br />
allBlink();<br />
delay(50);<br />
}<br />
}</p>
<p>void getReallyAngry() {<br />
Serial.println(&#8220;really angry&#8221;);<br />
for (int i = 0; i < 10; i++) {<br />
allBlink();<br />
delay(50);<br />
}<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://jamin.org/archives/2007/lampie-rfid-and-sensor-lamp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making Furniture Interactive</title>
		<link>http://jamin.org/archives/2007/making-furniture-interactive/</link>
		<comments>http://jamin.org/archives/2007/making-furniture-interactive/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 06:04:09 +0000</pubDate>
		<dc:creator>Jamin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[interactive-furniture]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://jamin.org/archives/2007/making-furniture-interactive/</guid>
		<description><![CDATA[Instead of doing an independent study on composition, or Research Methods with Dick Buchanan, or an introduction to industrial design fundamentals, I&#8217;m taking Making Furniture Interactive with Mark Gross. I&#8217;m working with a microcontroller, wires, LEDs, and writing programs with Processing. We&#8217;re using Arduino—an open-source electronics prototyping platform—for development. I decided to take this course [...]]]></description>
			<content:encoded><![CDATA[<p>Instead of doing an independent study on composition, or Research Methods with Dick Buchanan, or an introduction to industrial design fundamentals, I&#8217;m taking Making Furniture Interactive with Mark Gross. I&#8217;m working with a microcontroller, wires, LEDs, and writing programs with <a href="http://processing.org" target="_blank">Processing</a>. We&#8217;re using <a href="http://www.arduino.cc/" target="_blank">Arduino</a>—an open-source electronics prototyping platform—for development.</p>
<p><img src="http://farm2.static.flickr.com/1398/1330255677_d3260c0d12_m.jpg" alt="LEDs and breadboard" /></p>
<p>I decided to take this course because it looked fun, it didn&#8217;t involve readings, and it gets me working in the physical world.</p>
<p>Our first project was to program the board with three LEDs and create a lamp. It took a while to get my head around wiring the board and the LEDs, but I figured it out with help from peers. I made the lights fade in and out randomly at random intervals. (I like random stuff.) I then stuck a paper candle holder I created last year over top of my creation (a cheap move, but I&#8217;m really pressed for time with Emergence two days away).</p>
<p><img src="http://farm2.static.flickr.com/1153/1330255551_7bf821dbbd_m.jpg" alt="lamp with blue light" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jamin.org/archives/2007/making-furniture-interactive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
  
