<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Making Things Interactive</title>
	<atom:link href="http://makingthingsinteractive.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://makingthingsinteractive.wordpress.com</link>
	<description>Class Blog for Making Things Interactive, Spring 2008, Carnegie Mellon</description>
	<lastBuildDate>Wed, 14 May 2008 14:01:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='makingthingsinteractive.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Making Things Interactive</title>
		<link>http://makingthingsinteractive.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://makingthingsinteractive.wordpress.com/osd.xml" title="Making Things Interactive" />
	<atom:link rel='hub' href='http://makingthingsinteractive.wordpress.com/?pushpress=hub'/>
		<item>
		<title>spiderbot</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/14/spiderbot/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/14/spiderbot/#comments</comments>
		<pubDate>Wed, 14 May 2008 14:01:23 +0000</pubDate>
		<dc:creator>ponkotsu</dc:creator>
				<category><![CDATA[1: Post Something Interesting]]></category>
		<category><![CDATA[Gaku Sato]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=538</guid>
		<description><![CDATA[dies ist mein spiderbot.  i worked on it all semester.  i think it came out real good and i just wanted to show everyone. http://www.andrew.cmu.edu/user/gsato/spiderbot.jpg<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=538&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>dies ist mein spiderbot.  i worked on it all semester.  i think it came out real good and i just wanted to show everyone.</p>
<p><a href="http://www.andrew.cmu.edu/user/gsato/spiderbot.jpg">http://www.andrew.cmu.edu/user/gsato/spiderbot.jpg</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/538/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/538/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/538/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=538&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/14/spiderbot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fe06ba9ff5c2486e26d4fab5eb077cce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaku</media:title>
		</media:content>
	</item>
		<item>
		<title>Washroom Penitentiary [term paper]</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/14/washroom-penitentiary-term-paper/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/14/washroom-penitentiary-term-paper/#comments</comments>
		<pubDate>Wed, 14 May 2008 13:52:52 +0000</pubDate>
		<dc:creator>ponkotsu</dc:creator>
				<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Gaku Sato]]></category>
		<category><![CDATA[Term Paper]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=537</guid>
		<description><![CDATA[[final paper] [final paper appendix]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=537&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>[<a href="http://www.andrew.cmu.edu/user/gsato/mti/Final%20Paper.pdf">final paper</a>]</p>
<p>[<a href="http://www.andrew.cmu.edu/user/gsato/mti/Final%20Paper%20Appendix.pdf">final paper appendix</a>]</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/537/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/537/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/537/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=537&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/14/washroom-penitentiary-term-paper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fe06ba9ff5c2486e26d4fab5eb077cce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaku</media:title>
		</media:content>
	</item>
		<item>
		<title>Final Project: PhytoBot &#8220;Augmenting Plant Behavior Through Robotics&#8221;</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/14/final-project-phytobot-augmenting-plant-behavior-through-robotics/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/14/final-project-phytobot-augmenting-plant-behavior-through-robotics/#comments</comments>
		<pubDate>Wed, 14 May 2008 11:34:06 +0000</pubDate>
		<dc:creator>sbutalia</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Siddartha Butalia]]></category>
		<category><![CDATA[Term Paper]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[photosensors]]></category>
		<category><![CDATA[plants]]></category>
		<category><![CDATA[servo]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=531</guid>
		<description><![CDATA[The PhytoBot is a semi-intelligent plant which responds to external stimulus (light intensity and light location) and responds to it as a phototropic plant would. Essentially it is designed as a piece of interactive artwork for operation over a long period of time. The motivation driving this was triggered by the lack of understanding &#38; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=531&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The PhytoBot is a semi-intelligent plant which responds to external stimulus (light intensity and light location) and responds to it as a phototropic plant would. Essentially it is designed as a piece of interactive artwork for operation over a long period of time. The motivation driving this was triggered by the lack of understanding &amp; acceptance of plants as reactive living organisms. Many of us are so used to placing life on merely objects that have visual and audible external responses which can be seen by the naked eye. Plants on the other hand tend to be overlooked as their responses are more drawn out over time and hence we tend to see them as inanimate objects.</p>
<p> <a href="http://img404.imageshack.us/my.php?image=flowerjh2.png" target="_blank"><img src="http://img404.imageshack.us/img404/1009/flowerjh2.th.png" border="0" alt="" /></a><a href="http://img507.imageshack.us/my.php?image=schematicyw9.png" target="_blank"><img src="http://img507.imageshack.us/img507/6525/schematicyw9.th.png" border="0" alt="" /></a><a href="http://img262.imageshack.us/my.php?image=processflowvx2.png" target="_blank"><img src="http://img262.imageshack.us/img262/3819/processflowvx2.th.png" border="0" alt="" /></a><a href="http://img341.imageshack.us/my.php?image=electricalgb1.png" target="_blank"><img src="http://img341.imageshack.us/img341/3043/electricalgb1.th.png" border="0" alt="" /></a></p>
<p>The PhytoBot has two degrees of freedom and motion, rotational and angular (from the normal). The rotational range of motion is 360 degrees whereas the vertical/angular range is approximately 70 degrees. The second component of the response is the pulsing lights on the face. The lights pulse from on to off in a smooth glowing fashion as if the plant was breathing. The variance in frequency is driven by the amount of light given to the plant. A fast pulse indicates that the plant is healthy, and a slow pulse indicates that the plant is in need of more light. There are two basic mechanical features within the PhytoBot. When the PhytoBot actively seeks light, it is oriented by two servos in the x and y axes. When the light has been located the plant will twitch depending on how far away the light source is. For example a closer point light will produce more twitching than if the Plant was facing the sun.  </p>
<p>Parts List:</p>
<p>- Plastic Laser Cut Structural Parts<br />
- Foam Petals<br />
- Foam core Box<br />
- 4 Photo sensors<br />
- 1 Green LED<br />
- Wire (Solid core Flexible)<br />
- Cable Wire<br />
- 1 Standard Servo<br />
- 1 Continuous rotation servo<br />
- Screws<br />
- 1 Arduino Microcontroller<br />
- 4 100kOhm resistors<br />
- Circuit boards for soldering components<br />
- Acrylic glue</p>
<p>How it is Built: The PhytoBot is built primarily from laser cut acrylic parts. It was paramount to have my parts laser cut as they needed to fit correctly with minimal error. The whole plant can be divided up into 4 segments, the fixed base, rotating housing, stem and face. Each segment has their specific application and all working together complete the PhytoBot. The fixed base houses the rotational servo which in turn rotates the whole rotating housing. The rotating housing contains the stem servo. This stem servo is attached to the face via a cable wire through the stem. The stem supports the plant as it stands erect and also provides just the right amount of resistance to allow the plant to return to its erect position when not being pulled down. The face contains all the sensors and lights which provide the input and outputs of the whole plant. All the parts barring the petals were glues together using acrylic glue. This provided a strong hold and minimal movement/slop between the moving components.</p>
<p>Currently Im working on making a complete days time lapse video of my plant. Its a lot harder than I thought so the video isnt up as yet</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/531/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/531/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/531/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/531/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=531&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/14/final-project-phytobot-augmenting-plant-behavior-through-robotics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0ce0d57cf8f31640374caa918de71864?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sbutalia</media:title>
		</media:content>

		<media:content url="http://img404.imageshack.us/img404/1009/flowerjh2.th.png" medium="image" />

		<media:content url="http://img507.imageshack.us/img507/6525/schematicyw9.th.png" medium="image" />

		<media:content url="http://img262.imageshack.us/img262/3819/processflowvx2.th.png" medium="image" />

		<media:content url="http://img341.imageshack.us/img341/3043/electricalgb1.th.png" medium="image" />
	</item>
		<item>
		<title>Fireflies in a Jar</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/13/fireflies-in-a-jar/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/13/fireflies-in-a-jar/#comments</comments>
		<pubDate>Tue, 13 May 2008 07:46:41 +0000</pubDate>
		<dc:creator>gskim</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Gee Kim]]></category>
		<category><![CDATA[Students]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=518</guid>
		<description><![CDATA[     Fireflies in a Jar is a teaching tool for children who can’t sleep in the dark. There’ s going to be three differently programmed fireflies and a jar where the child can place them in. Before going to bed, the child can place as many fireflies into the jar and close the lid [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=518&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11221.jpg"><img class="alignnone size-medium wp-image-522" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11221.jpg?w=225&#038;h=300" alt="" width="225" height="300" />    </a><img class="alignnone size-medium wp-image-516" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1120.jpg?w=225&#038;h=300" alt="" width="225" height="300" /></p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1120.jpg"></a> Fireflies in a Jar is a teaching tool for children who can’t sleep in the dark. There’</p>
<p>s going to be three differently programmed fireflies and a jar where the child can place them in. Before going to bed, the child can place as many fireflies into the jar and close the lid to activate the light. You can adjust the luminosity of the jar by putting more or less fireflies in. The light from each firefly will eventually turn off within a certain time span. The child at this point will either be too tired to put in more fireflies, and end up sleeping in the dark, or still be awake. Then they have the option of putting more fireflies in to reactive the light or sleeping in the dark.</p>
<p>The program of the different combination of fireflies. The different combinations of fireflies will have different programs that will mimic the light of a firefly. The LED will blink or glow at different speeds with different delay times. Each light will also be programmed to have different time span for it to be on, keeping the fireflies spontaneous and fun for the child.</p>
<p>How will it work? Each firefly will have an LED attached to it. The fireflies will sit on its own on/off switch. Removing the firefly from the switch will let us know which firefly is being put into the jar and need to be on once the jar is closed. The jar will also have a mercury tilt sensor, attached to the lid, that will tell us when the jar is closed. Once a firefly is placed into the jar, and the jar is closed, the program for that firefly will run as long as the jar is closed. If the jar opens and closes, with the same firefly in the jar, the program of that firefly will restart. This works with all the fireflies.</p>
<p>Parts List: Arduino, circuit wire, conductive thread, tape, 3 LEDs, mercury tilt sensor, ribbon, wooden box, jar</p>
<p>Video Demonstration: </p>
<span style="text-align:center; display: block;"><a href="http://makingthingsinteractive.wordpress.com/2008/05/13/fireflies-in-a-jar/"><img src="http://img.youtube.com/vi/8FWCn96XLI4/2.jpg" alt="" /></a></span>
<p>Circuit diagram: </p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/circuit317.jpg"><img class="alignnone size-medium wp-image-530" src="http://makingthingsinteractive.files.wordpress.com/2008/05/circuit317.jpg?w=300&#038;h=214" alt="" width="300" height="214" /></a></p>
<p>Wiring:</p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11161.jpg"><img class="alignnone size-medium wp-image-520" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11161.jpg?w=225&#038;h=300" alt="" width="225" height="300" />    </a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1105.jpg"><img class="alignnone size-medium wp-image-521" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1105.jpg?w=225&#038;h=300" alt="" width="225" height="300" /></a></p>
<p>code:</p>
<p><pre class="brush: cpp;">

int tiltSensor = 3;    // connect tiltSensor to pin 3
int ffHome1 = 9;       // connect home1 to pin 9
int ffHome2 = 10;      // connect home2 to pin 10
int ffHome3 = 11;      // connect home3 to pin 11
int ffLite1 = 5;       // connect ff1 to pin 5
int ffLite2 = 6;       // connect ff2 to pin 6
int ffLite3 = 7;       // connect ff3 to pin 7
int count1 = 5;        // set glow to 5 times
int count2 = 3;        // set glow to 3 times
int count3 = 7;        // set glow to 7 times
int count4 = 4;        // set glow to 4 times
int count5 = 2;        // set glow to 2 times
int count6 = 5;        // set glow to 5 times
int count7 = 10;       // set glow to 10 times
int brightness = 0;    //

void setup ()
{
  pinMode (tiltSensor, INPUT);  // set switch 0 as digital input
  pinMode (ffHome1, INPUT);     // set switch 1 as digital input
  pinMode (ffHome2, INPUT);     // set switch 2 as digital input
  pinMode (ffHome3, INPUT);     // set switch 3 as digital input
  pinMode (ffLite1, OUTPUT);    // set led 1 as analog output
  pinMode (ffLite2, OUTPUT);    // set led 2 as analog output
  pinMode (ffLite3, OUTPUT);    // set led 3 as analog output
  Serial.begin(9600);           //
}

void ffOFF(int ff)         // when &quot;ffOFF&quot; is stated
 {                         //
 digitalWrite(ff, HIGH);   // ff don't glow
 }                         //

void glow(int ff, int slowness)           // when &quot;glow&quot; is stated
{                                         //
  for (brightness = 0; brightness &lt; 255; brightness ++)
         { analogWrite (ff, brightness);  // make ff glow
           delay (slowness);              // delay
         }                                //
  for (brightness = 255; brightness &gt; 0; brightness --)
         { analogWrite (ff, brightness);  // then make ff dim
          delay (slowness);               // delay
         }
 }

void glow2(int ff1, int ff2, int slowness) // when &quot;glow2&quot; is stated
{                                          //
  for (brightness = 0; brightness &lt; 255; brightness ++)
         { analogWrite (ff1, brightness);  // make ff1 glow
           analogWrite (ff2, brightness);  // make ff2 glow
           delay (slowness);               // delay
         }                                 //
  for (brightness = 255; brightness &gt; 0; brightness --)
         { analogWrite (ff1, brightness);  // then make ff1 dim
           analogWrite (ff2, brightness);  // then make ff2 dim
          delay (slowness);                // delay
         }
 }

void glow3(int ff1, int ff2, int ff3, int slowness)  // when &quot;glow3&quot; is stated
{                                                    //
  for (brightness = 0; brightness &lt; 255; brightness ++)
         { analogWrite (ff1, brightness);  // make ff1 glow
           analogWrite (ff2, brightness);  // make ff2 glow
           analogWrite (ff3, brightness);  // make ff3 glow
           delay (slowness);               // delay
         }                                 //
  for (brightness = 255; brightness &gt; 0; brightness --)
         { analogWrite (ff1, brightness);  // then make ff1 dim
           analogWrite (ff2, brightness);  // then make ff2 dim
           analogWrite (ff3, brightness);  // then make ff3 dim
          delay (slowness);                // delay
         }
 }

void loop ()
{
  Serial.println(digitalRead (tiltSensor));
 if (digitalRead (tiltSensor) == HIGH) {  // when jar is closed
  Serial.println (&quot;the jar is closed, fireflies awake&quot;);  

    if(digitalRead (ffHome1) == LOW)      // and when ff1 is not home
    {if (count1 &gt; 0) {                    //
       glow (ffLite1, 5);                 // glow ff1
       count1 = count1 - 1;}}             // 5 times.
    else                                  //
      {ffOFF(ffLite1);                    // when ff1 is home, don't glow
       count1 = 5; }                      // set glow back to 5 times. 

    if(digitalRead (ffHome2) == LOW)      // and when ff2 is not home
    {if (count1 &gt; 0){                     //
       glow (ffLite2, 5);                 // glow ff2
       count2 = count2 - 1;}}             // 3 times.
     else                                 //
       {ffOFF(ffLite2);                   // when ff2 is home, don't glow
       count2 = 3;}                       // set glow back to 3 times.

    if(digitalRead (ffHome3) == LOW)      // and when ff3 is not home
    {if (count1 &gt; 0){                     //
       glow (ffLite3, 5);                 // glow ff3
       count3 = count3 - 1;}}             // 7 times.
     else                                 //
       {ffOFF(ffLite3);                   // when ff3 is home, don't glow
       count3 = 7;}                       // set glow back to 7 times.

    if(digitalRead (ffHome1) == LOW &amp;&amp; digitalRead (ffHome2) == LOW )  // and when ff1 and ff2 is not home
    {if (count1 &gt; 0){                     //
       glow2 (ffLite1, ffLite2, 5);       // glow ff1 and ff2
       count4 = count4 - 1;}}             // 4 times.
     else                                 //
      {ffOFF(ffLite1);                    // when ff1 is home, don't glow
       ffOFF(ffLite2);                    // when ff1 is home, don't glow
       count4 = 4;}                       // set glow back to 4 times. 

    if(digitalRead (ffHome1) == LOW &amp;&amp; digitalRead (ffHome3) == LOW )  // and when ff1 and ff3 is not home
    {if (count1 &gt; 0){                    //
       glow2 (ffLite1, ffLite3, 5);      // glow ff1 and ff3
       count5 = count5 - 1;}}            // 2 times.
    else                                 //
      {ffOFF(ffLite1);                   // when ff1 is home, don't glow
       ffOFF(ffLite3);                   // when ff3 is home, don't glow
       count5 = 2;}                      // set glow back to 4 times.  

    if(digitalRead (ffHome2) == LOW &amp;&amp; digitalRead (ffHome3) == LOW )  // and when ff2 and ff3 is not home
    {if (count1 &gt; 0){                    //
      glow2 (ffLite2, ffLite3, 5);       // glow ff2 and ff3
      count6 = count6 - 1;}}             // 5 times.
    else                                 //
      {ffOFF(ffLite2);                   // when ff2 is home, don't glow
       ffOFF(ffLite3);                   // when ff3 is home, don't glow
       count6 = 5;}                      // set glow back to 5 times. 

    if(digitalRead (ffHome1) == LOW &amp;&amp; digitalRead (ffHome2) == LOW &amp;&amp; digitalRead (ffHome3) == LOW )  // and when ff1, ff2, and ff3 is not home
    {if (count1 &gt; 0){                        //
      glow3 (ffLite1, ffLite2, ffLite3, 5);  // glow ff1, ff2, and ff3
      count7 = count7 - 1;}}                // 10 times.
    else                                     //
      {ffOFF(ffLite1);                       // when ff1 is home, don't glow
       ffOFF(ffLite2);                       // when ff2 is home, don't glow
       ffOFF(ffLite3);                       // when ff3 is home, don't glow
       count7 = 10;}                         // set glow back to 10 times.
 }
 if (digitalRead (tiltSensor) == LOW)        // when jar is opened
 {ffOFF(ffLite1);                            // ff1 don't glow
  ffOFF(ffLite2);                            // ff2 don't glow
  ffOFF(ffLite3);                            // ff3 don't glow
  Serial.println(&quot;the jar is OPEN; fireflies asleep&quot;);}
}
</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/518/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/518/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/518/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=518&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/13/fireflies-in-a-jar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2237278ff7002a181747f3c8ea531e5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gskim</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11221.jpg?w=225" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1120.jpg?w=225" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/circuit317.jpg?w=300" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_11161.jpg?w=225" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1105.jpg?w=225" medium="image" />
	</item>
		<item>
		<title>BOOMBOXES</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/boomboxes/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/boomboxes/#comments</comments>
		<pubDate>Mon, 12 May 2008 19:44:47 +0000</pubDate>
		<dc:creator>paulcastellana</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Jesse Chorng]]></category>
		<category><![CDATA[Paul Castellana]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=509</guid>
		<description><![CDATA[Boomboxes is an environment designed to promote social interaction through music. It consists of a stationary hub, and five wireless modular seating units that can be moved and stacked to best fit the given social situation. Users can connect their mp3 players to an input jack in the hub to play music through all of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=509&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_0407.jpg"><img class="alignnone size-medium wp-image-511" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_0407.jpg?w=225&#038;h=300" alt="" width="225" height="300" /></a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes1.jpg"><img class="alignnone size-medium wp-image-512" src="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes1.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes3.jpg"><img class="alignnone size-medium wp-image-514" src="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes3.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a></p>
<p><a href="http://farm3.static.flickr.com/2279/2478087536_63bdc7c679_o.jpg"><img src="http://farm3.static.flickr.com/2279/2478087536_63bdc7c679_o.jpg" width="500," height="375"></a></p>
<p><a href="http://farm3.static.flickr.com/2236/2480178988_bf9de43f8f_o.jpg"><img src="http://farm3.static.flickr.com/2236/2480178988_bf9de43f8f_o.jpg" width="500," height="375"></a></p>
<p>Boomboxes is an environment designed to promote social interaction through music. It consists of a stationary hub, and five wireless modular seating units that can be moved and stacked to best fit the given social situation.  Users can connect their mp3 players to an input jack in the hub to play music through all of the modular units.  Each unit has a radio, RBG and white lights, a seat button that detects when someone is sitting down, and all are networked together using Xbee radio transmitters.  Although a faulty seat button caused malfunctioning during the final presentation, the particular program we’re providing code for here changes the lighting of the boxes based on the number of people sitting down, so that when music is playing and the boxes are activated, the lights are white until all five boxes are in use, at which point each box lights a different color.  If at this point, everyone stands up within 15 seconds of each other the colored lights dances to the music.</p>
<p><a href="http://theboomboxes.net">Project Website</a> which is currently under construction. For now, check it out <a>here</a></p>
<p>Here&#8217;s our proposal: <a href="http://makingthingsinteractive.files.wordpress.com/2008/05/project-proposal-final.pdf">Boomboxes Proposal</a></p>
<p>Part&#8217;s List: <a href="http://makingthingsinteractive.files.wordpress.com/2008/05/boomboxespartslistai.pdf">Boomboxes Parts List</a></p>
<p>Code:<br />
<code><br />
<pre class="brush: cpp;">
/*
Boomboxes - Social Interaction Through Music
Small Undergraduate Research Grant

Paul Castellana
Jesse Chorng

*/

//----------- STATES ------------//
const int sWaiting = 0;          // The system is waiting for audio to be plugged in. Speakers/Lights are off
const int sActivate = 1;         // The system detects audio being played. Speakers/Lights are on
const int sAttract = 2;          // The system detects motion and inactive; lights turn to attract attention
const int sStandby = 3;          // If everyone sitting and someone stands up, wait 30 secs to see if everyone stands up
const int sParty = 4;            // If there's enough people around and people are moving, party time! Lights dance to music

int currentState = sWaiting;
int nextState = sActivate;

//----------- INPUTS ------------//
int audioIn = 1;                 // Audio signal in from stereo jack
int activateSwitch = 9;          // Switch to activate Boomboxes
int pirSensor = 8;               // PIR Motion swich, sends LOW when motion detected

int seat1 = 6;                   // Input Pin for Seat 1
int seat2 = 5;                   // Input Pin for Seat 2
int seat3 = 4;                   // Input Pin for Seat 3
int seat4 = 3;                   // Input Pin for Seat 4
int seat5 = 2;                   // Input Pin for Seat 5

//----------- OUTPUTS -----------//
int recModuleSwitch = 10;        // Seat switch to know when someone is sitting
int radioSwitch = 7;             // Activates radios in seats
int rgbLed = 12;                 // RGB LED
int whiteLed = 11;               // White LED

//---------- VARIABLES ----------//
int motionCount = 0;             // PIR Motion Count
int allSitting = 0;              // All sitting true (1) or false (0)
int allStanding = 0;             // All standing true (1) or false (0)
int audioVal;

//--------------------------- SETUP ---------------------------//
void setup()  {

    pinMode(audioIn, INPUT);
    pinMode(activateSwitch, INPUT);
    pinMode(pirSensor, INPUT);
    pinMode(seat1, INPUT);
    pinMode(seat2, INPUT);
    pinMode(seat3, INPUT);
    pinMode(seat4, INPUT);
    pinMode(seat5, INPUT);

    pinMode(recModuleSwitch, OUTPUT);
    pinMode(radioSwitch, OUTPUT);
    pinMode(rgbLed, OUTPUT);
    pinMode(whiteLed, OUTPUT);

    Serial.begin(9600);
}

//---------------------------- LOOP -----------------------------//
void loop()  {

  switch(currentState) {
       case sWaiting:                                            // Waiting to either activate or attract people
           Serial.println(&quot;Waiting&quot;);

           digitalWrite(radioSwitch, LOW);                       // Radios are off
           digitalWrite(recModuleSwitch, LOW);                   // Don't play &quot;Boomboxes&quot; sample
           digitalWrite(whiteLed, LOW);                          // No LED action
           digitalWrite(rgbLed, LOW);                            // No color LED action

           if (digitalRead(activateSwitch) == HIGH) {            // Check switch to activate
               currentState = sActivate;
           }

           motionCheck();                                        // Check for motion from PIR sensor
           if(motionCount &gt; 30) {                                // If there's enough motion, go into Attract state
             currentState = sAttract;
           }
           break;

       case sAttract:
           Serial.println(&quot;Attract&quot;);

           digitalWrite(radioSwitch, HIGH);
           digitalWrite(recModuleSwitch, HIGH);
           digitalWrite(whiteLed, LOW);

           motionCount = 0;

           for(int h=0; h &lt; 10; h++) {                            // When in attract mode, flash lights for 15 secs
             digitalWrite(rgbLed, HIGH);
             delay(500);
             digitalWrite(rgbLed, LOW);
             delay(500);
           }

           if(digitalRead(activateSwitch) == HIGH) {
             currentState =sActivate;
           } else {
             currentState = sWaiting;
           }

           break;

       case sActivate:                                            // Activated mode is simply white LEDs on
           Serial.println(&quot;Activated&quot;); 

           digitalWrite(radioSwitch, HIGH);
           digitalWrite(recModuleSwitch, LOW);
           digitalWrite(whiteLed, HIGH);
           digitalWrite(rgbLed, LOW);

           if (digitalRead(activateSwitch) == LOW) {
             currentState = sWaiting;
           }       

           allSittingCheck();                                      // If all 5 seats are occupied, go to
           if(allSitting == 1) {                                   // Standby mode before Party state
             currentState = sStandby;
           }
           break;

       case sStandby:
           Serial.println(&quot;Standby to Party&quot;);

           digitalWrite(radioSwitch, HIGH);
           digitalWrite(recModuleSwitch, LOW);
           digitalWrite(whiteLed, LOW);
           digitalWrite(rgbLed, HIGH);

           allSittingCheck();

           if (allSitting == 0)  {                                  // If everyone is sitting there is
             for(int f=0; f&lt;15; f++) {                              // 15 secs to go into Party State
               digitalWrite(whiteLed, HIGH);
               delay(500);
               digitalWrite(whiteLed, LOW);
               allStandingCheck();
               if(allStanding == 1) {
                 f = 15;
                 currentState = sParty;
               }
               delay(500);
             }
             allSittingCheck();
             if(allSitting == 0) {
               currentState = sActivate;
             }
           }

           if (digitalRead(activateSwitch) == LOW) {
           currentState = sWaiting;
           }

           break;

       case sParty:
           Serial.println(&quot;Party!&quot;);

           digitalWrite(radioSwitch, HIGH);
           digitalWrite(recModuleSwitch, LOW);
           digitalWrite(whiteLed, LOW);

           audioVal = analogRead(audioIn);

           if (audioVal &lt;= 14) {                                    // Flash lights to music
             digitalWrite(rgbLed, LOW);
           } else {
             digitalWrite(rgbLed, HIGH);
           }

           allStandingCheck();

           if (allStanding == 0)  {
             currentState = sActivate;
           }
           if (digitalRead(activateSwitch) == LOW) {
             currentState = sWaiting;
           }
           break;

       default:
           Serial.println(&quot;ERROR: default state&quot;);
           currentState = sWaiting;
           nextState = sActivate;
           break;
   }
}

//------------------- PIR SENSOR MOTION CHECK -------------------//
void motionCheck()  {
  for (int j=0; j &lt; 5; j++)  {
    if (digitalRead(pirSensor) == LOW)  {
      motionCount++;
      delay(500);
    }
  }
}

//----------------- EVERYONE SITTING DOWN CHECK -----------------//
void allSittingCheck()  {
  if (digitalRead(seat1) == HIGH and digitalRead(seat2) == HIGH and
      digitalRead(seat3) == HIGH and digitalRead(seat4) == HIGH and
      digitalRead(seat5) == HIGH) {
    allSitting = 1;
  } else  {
    allSitting = 0;
  }
}

//------------------- EVERYONE STANDING STANDING ----------------//
void allStandingCheck()  {
  if (digitalRead(seat1) == LOW and digitalRead(seat2) == LOW and
      digitalRead(seat3) == LOW and digitalRead(seat4) == LOW and
      digitalRead(seat5) == LOW) {
    allStanding = 1;
    Serial.println(&quot;All Standing&quot;);
  } else  {
    allStanding = 0;
  }
}
</pre></p>
<p></code></p>
<p>Overall, we were very satisfied with how the project turned out.  It was well received at the Meeting of the Minds, and we even won a prize from the STUDIO for Creative Inquiry.  We plan on continuing to develop Boomboxes as concept, further improving the design and functionality of the space.  The next public forum in which we are hoping to present the project is the Outdoor Lounge Exhibition of Artscape 2008, in Baltimore, MD, which we are currently on the waitlist for.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/509/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/509/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/509/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=509&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/boomboxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a55a24b6941682a114f7ee8f162762d8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulcastellana</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_0407.jpg?w=225" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes1.jpg?w=300" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/boxes3.jpg?w=300" medium="image" />

		<media:content url="http://farm3.static.flickr.com/2279/2478087536_63bdc7c679_o.jpg" medium="image" />

		<media:content url="http://farm3.static.flickr.com/2236/2480178988_bf9de43f8f_o.jpg" medium="image" />
	</item>
		<item>
		<title>The Amazing Booth Device</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/the-amazing-booth-device/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/the-amazing-booth-device/#comments</comments>
		<pubDate>Mon, 12 May 2008 15:23:02 +0000</pubDate>
		<dc:creator>tovelet</dc:creator>
				<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Lea]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=502</guid>
		<description><![CDATA[    The details are rather long-winded for this blog, so I&#8217;ve put some explanations here and the full source code here.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=502&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img style="vertical-align:middle;" src="http://www.contrib.andrew.cmu.edu/~lea/mti/board-straight.jpg" alt="" width="263" height="189" /></p>
<p> </p>
<p><img src="http://www.contrib.andrew.cmu.edu/~lea/mti/dom_booth.jpg" alt="" width="281" height="211" /></p>
<p> </p>
<p>The details are rather long-winded for this blog, so I&#8217;ve put <a href="http://www.contrib.andrew.cmu.edu/~lea/mti/lea-boothmachine-explanations.pdf" target="_blank">some explanations here</a> and the<a href="http://www.contrib.andrew.cmu.edu/~lea/mti/code.pdf" target="_blank"> full source code here</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/502/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/502/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/502/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=502&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/the-amazing-booth-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/742e3a6c004f3e14ce7d22484f3f4cfb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tovelet</media:title>
		</media:content>

		<media:content url="http://www.contrib.andrew.cmu.edu/~lea/mti/board-straight.jpg" medium="image" />

		<media:content url="http://www.contrib.andrew.cmu.edu/~lea/mti/dom_booth.jpg" medium="image" />
	</item>
		<item>
		<title>The Light-o-Stat</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/the-light-o-stat/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/the-light-o-stat/#comments</comments>
		<pubDate>Mon, 12 May 2008 15:22:06 +0000</pubDate>
		<dc:creator>bkish</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Brian Kish]]></category>
		<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Term Paper]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=500</guid>
		<description><![CDATA[Hello All: Please take a look at my final term paper for my Light-o-Stat Project by following the attached link. final-paper1 The majority of my documentation can be seen in the paper, but here are some other things too. The Guts of the Project: The Mess that I made with an Arduino and Breadboard<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=500&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello All:</p>
<p>Please take a look at my final term paper for my Light-o-Stat Project by following the attached link.</p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/final-paper1.pdf">final-paper1</a></p>
<pre><strong>The majority of my documentation can be seen in the paper, but here are some other things too.</strong></pre>
<pre><span style="text-align:center; display: block;"><a href="http://makingthingsinteractive.wordpress.com/2008/05/12/the-light-o-stat/"><img src="http://img.youtube.com/vi/fsYuLlh2-hQ/2.jpg" alt="" /></a></span>

 The Guts of the Project:                          The Mess that I made with an Arduino and Breadboard
<a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_26641.jpg"><img class="alignnone size-medium wp-image-505" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_26641.jpg?w=300&#038;h=225" alt="The Guts of the Project" width="300" height="225" /></a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_2668.jpg"><img class="alignnone size-medium wp-image-506" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_2668.jpg?w=300&#038;h=225" alt="The Mess that I made with an Arduino and Breadboard" width="300" height="225" /></a></pre>
<p><pre class="brush: cpp;">
int servoPin = 2;     // Control pin for servo motor
int minPulse = 800;   // Minimum servo position
int maxPulse = 2300;  // Maximum servo position
int neutralPulse = 1500;  //neutral servo
int pulse = 0;        // Amount to pulse the servo
int prevPhotosensor;  //last reading of sensor-last state
int increment = 50;   //pwm changes
int goodLED= 6;
int darkLED= 7;
int brightLED = 5;

long lastPulse = 0;    // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses

int photoSensor = 0;  // the value returned from the analog sensor
int sensorPin = 1;    // the analog pin that the sensor's on
int average = 10;      // reads per cycle
int potSwitch = 0;     //potentiometer switch
int potMin = 0;
int potMax = 0;
int potPin = 0;

void setup() {
  pinMode(servoPin, OUTPUT);  // Set servo pin as an output pin
  pinMode(potSwitch, INPUT);
  pinMode(goodLED, OUTPUT);
  pinMode(darkLED, OUTPUT);
  pinMode(brightLED, OUTPUT);
  pulse = neutralPulse;           // Set the motor position value to the minimum
  digitalWrite(goodLED, LOW);
  digitalWrite(darkLED, LOW);
  digitalWrite(brightLED, LOW);
  Serial.begin(9600);

}

void loop() {
  delay(100);
  int x;
  int photoTotal;
  photoTotal = 0;
  for (x = 0; x&lt;average; x++) {
    photoSensor = analogRead(sensorPin);      // read the analog input
    potSwitch = analogRead(potPin);         //pulse = (photoSensor *19)/10 + minPulse;
    photoTotal = photoSensor + photoTotal;  // convert the analog value
  }
  photoSensor = photoTotal/average;   //average of photo sensor readings

  potMin = potSwitch-25;
  potMax = potSwitch+50;

  Serial.print(&quot;Amount of Light = &quot;);
  Serial.println((int)photoSensor);
  Serial.print(&quot;Desired amount of light = &quot;);
    Serial.println((int)potSwitch);        

  if (millis() - lastPulse &gt;= refreshTime) {
    digitalWrite(servoPin, HIGH);   // Turn the motor on
    delayMicroseconds(pulse);       // Length of the pulse sets the motor position
    digitalWrite(servoPin, LOW);    // Turn the motor off
    lastPulse = millis();           // save the time of the last pulse
  }

  //good State
  if(photoSensor &lt;= potMax &amp;&amp; photoSensor &gt;= potMin){  //if light value is in desired range, do the following
    digitalWrite(goodLED, HIGH);
    digitalWrite(darkLED, LOW);
    digitalWrite(brightLED,LOW);
    Serial.println(&quot;Light is good&quot;);
    //do nothing with pulse;
  }
  // bright State
  if(photoSensor &lt; potMin){   // if the actual light is greater than desired, do this...remember that the values are reversed, larger number=darker and smaller number = brighter
    digitalWrite(goodLED, LOW);
    digitalWrite(darkLED, LOW);
    digitalWrite(brightLED,HIGH);
    Serial.println(&quot;Too Bright&quot;);

    //pulse clockwise
    if(prevPhotosensor &gt; photoSensor) {  // if moving the shades makes it darker, it i doing the right thing, continue in this direction
      prevPhotosensor = photoSensor;
      pulse = pulse - increment;
      if (pulse &lt; minPulse)
        pulse = minPulse;
    }

  }

  // dark State
  if(photoSensor &gt; potMax){              // if level of light is below the minimum desired, it is too dark
    digitalWrite(goodLED, LOW);
    digitalWrite(darkLED, HIGH);
    digitalWrite(brightLED,LOW);
    Serial.println(&quot;Too Dark&quot;);
    //pulse counter-clockwise
    if(prevPhotosensor &lt; photoSensor) {   //if moving the shades makes it lighter, it is doin the right thing
      prevPhotosensor = photoSensor;
      pulse = pulse + increment;
      if (pulse &gt; maxPulse)
        pulse = maxPulse;
    }

  }
}

&lt;pre&gt;</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/500/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/500/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/500/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/500/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/500/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=500&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/the-light-o-stat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afeca367e010b4b8c925474394afac8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bkish</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_26641.jpg?w=300" medium="image">
			<media:title type="html">The Guts of the Project</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_2668.jpg?w=300" medium="image">
			<media:title type="html">The Mess that I made with an Arduino and Breadboard</media:title>
		</media:content>
	</item>
		<item>
		<title>Magic Lantern</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/magic-lantern/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/magic-lantern/#comments</comments>
		<pubDate>Mon, 12 May 2008 13:15:27 +0000</pubDate>
		<dc:creator>tyang1</dc:creator>
				<category><![CDATA[Assignments]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=493</guid>
		<description><![CDATA[Many times in a hotel room or even your own room, when you turn off the lights before going to bed you stumble over a few things before reaching your bed.  This is a night table next to your bed that will light up depending on what you are doing in the room.  The different [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=493&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Many times in a hotel room or even your own room, when you turn off the lights before going to bed you stumble over a few things before reaching your bed.  This is a night table next to your bed that will light up depending on what you are doing in the room.  The different states are:</p>
<p>1.  Turn off lights, leave the room:  night table lights off</p>
<p>2.  Turn off lights, stay in room but not going to bed yet (checking last minute email, etc): night table lights on</p>
<p>3.  Turn off lights, go to bed to read: night table lights on</p>
<p>4.  Turn off lights, go to bed to sleep: night table lights off</p>
<p>If at any time the room is bright, the night table lights will remain off no matter what your motions are.  </p>
<p>The sensors I used are: PIR sensor (very fickle!), ultrasonic sensor and photosensor. </p>
<p>Photosensor: used to detect overhead light</p>
<p>PIR sensor: detects motion in the room</p>
<p>ultrasonic sensor: angled to detect if someone is sitting up in bed or not (sometimes when you read there is not enough motion for the PIR sensor to detect that someone is in the room)</p>
<p><pre class="brush: cpp;">

 

int photoPin = 1;

int light;

float sens = 0.85;

int val = 0;

int pirPin = 3;

int calibrateTime = 60;                          // time given to PIR sensor to calibrate (10 -60 secs according to datasheet)

unsigned long lowIn;                         // the time when the sensor outputs a low impulse

unsigned long pause = 60000;                              // millisecondes the sensor has to be low before we assume all motion has stopped

boolean lockLow = true;

boolean takeLowTime;

int ultraPin = 5;                                // sets ultrasonic range finder to digital pin 5

int timecount = 0; 

int ultraVal = 0;

int ledPin = 11;                                 // sets LEDs in table to digital pin 11;

int ledActive = 12;                              // sets LED to digital pin 12; blinks when PIR sensor finishes calibrating

 

void setup() {

 

  pinMode(photoPin, INPUT);                      // declares photosenor as INPUT

  pinMode(pirPin, INPUT);                        // declares PIR sensor as INPUT

  digitalWrite(pirPin, LOW);                     // initially sets PIR sensor to LOW = no motion

  pinMode(ledPin, OUTPUT);                       // declares LEDs in table as OUTPUT

  pinMode(ledActive, OUTPUT);                    // declares calibration LED as OUTPUT

  Serial.begin(9600);                       

  val = analogRead(photoPin);                     // reads value of photosensor

  

  // Gives sensor some time to calibrate

  Serial.println(&quot;Calibrating PIR sensor &quot;);      

  for (int i = 0; i &lt; calibrateTime; i++) {       

    Serial.print(&quot;.&quot;);

    delay(1000);

  }

  Serial.println(&quot; SENSOR ACTIVE&quot;);               // notifies user when PIR is finished calibrating

  digitalWrite(ledActive, HIGH);                  // blinks LED when PIR finishes calibrating 

  delay(1000);

  digitalWrite(ledActive, LOW);

  delay(1000);

  digitalWrite(ledActive, HIGH);

  delay(1000);

  digitalWrite(ledActive, LOW);

}

 

int getPing() {                                    // sends a 10us pulse to activate the sonar

  pinMode(ultraPin, OUTPUT);                       // sets ultrasonic sensor to OUTPUT

  digitalWrite(ultraPin, LOW);                     // sends a LOW pulse  

  delayMicroseconds(2);                            // wait 2 microseconds

  digitalWrite(ultraPin, HIGH);                    // sends a HIGH pulse

  delayMicroseconds(5);                            // wait for 5 microseconds

  digitalWrite(ultraPin, LOW);                     // holdoff

  pinMode(ultraPin, INPUT);                        // switches signal pin to INPUT to listen for echo pulse

  return pulseIn(ultraPin, HIGH);                  //  returns echo singal i.e. object's distance

}

 

void loop() {

 

  light = analogRead(photoPin);                    // reads photosensor value and sets it to light variable

  ultraVal = getPing();                            // writes value of ultrasonic sensor from getPing to ultraVal variable

  Serial.println(&quot;pir value&quot;);

  Serial.println(digitalRead(pirPin));

  delay(1000);

 

  if ((light &lt; val * sens) || (light &lt;= 250)) {              // if the room becomes darker or the amount of light is below threshold...

 

    if (digitalRead(pirPin) == HIGH) {                       // ... and there is MOTION 

      if(lockLow){

        lockLow = false; 

        delay(50);

      }

      takeLowTime = true;

      if (ultraVal &lt;= 2000) {                                // ... and the person is sitting up 

        digitalWrite(ledPin, HIGH);                          // ... LIGHTS ON

        delay(60000);

      }

      else if (ultraVal &gt; 2000) {                            // ... and the person is lying down

        digitalWrite(ledPin, LOW);                           // ... LIGHTS OFF

      }

    }

    else if (digitalRead(pirPin) == LOW) {                   // ... and there is NO MOTION

      digitalWrite(ledPin, LOW);                             // ... LIGHTS OFF

      if (takeLowTime){

        lowIn = millis();

        takeLowTime = false; 

      }

      if(!lockLow &amp;&amp; millis() - lowIn &gt; pause){  

        //makes sure this block of code is only executed again after 

        //a new motion sequence has been detected

        lockLow = true;  

        delay(50);

      }

    }

  }

  else if (light &lt;= 250 &amp;&amp; ultraVal &lt;= 2000) {                // my PIR is finicky....so this is saying if there is someone in bed sitting up even if it detects no motion, then the lights will be on

    digitalWrite(ledPin, HIGH);

  }

  

  else if (light &gt; val * sens) {

    digitalWrite(ledPin, 0);

  }

  else {                                                      // not really needed since the previous else statement should cover                                                                       all other logic but this is insurance

   digitalWrite(ledPin, 0);

 }

}</pre><br />
 </p>
<p> </p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/table-by-bed.jpg"><img class="alignnone size-medium wp-image-494" src="http://makingthingsinteractive.files.wordpress.com/2008/05/table-by-bed.jpg?w=300&#038;h=225" alt="Final prototype of Magic Lantern" width="300" height="225" /></a></p>
<p><span style="color:#0000ee;text-decoration:underline;"><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/table-models.jpg"></a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/table-top.jpg"><img class="alignleft size-medium wp-image-496" src="http://makingthingsinteractive.files.wordpress.com/2008/05/table-top.jpg?w=277&#038;h=291" alt="Location of sensors on table top" width="277" height="291" /></a><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/table-bottom.jpg"><img class="alignnone size-medium wp-image-497" src="http://makingthingsinteractive.files.wordpress.com/2008/05/table-bottom.jpg?w=300&#038;h=225" alt="How the electronics are fitted inside the table" width="300" height="225" /></a></span></p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/table-models2.jpg"><img class="alignnone size-medium wp-image-499" src="http://makingthingsinteractive.files.wordpress.com/2008/05/table-models2.jpg" alt="Small models of tables whose forms would hide/embed the sensors better. " /></a><span style="text-align:center; display: block;"><a href="http://makingthingsinteractive.wordpress.com/2008/05/12/magic-lantern/"><img src="http://img.youtube.com/vi/f7ZQ9QJRBXY/2.jpg" alt="" /></a></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/493/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/493/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/493/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=493&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/magic-lantern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4dfb192151684aa184091dcdf0d1c491?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tyang1</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/table-by-bed.jpg?w=300" medium="image">
			<media:title type="html">Final prototype of Magic Lantern</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/table-top.jpg?w=277" medium="image">
			<media:title type="html">Location of sensors on table top</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/table-bottom.jpg?w=300" medium="image">
			<media:title type="html">How the electronics are fitted inside the table</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/table-models2.jpg" medium="image">
			<media:title type="html">Small models of tables whose forms would hide/embed the sensors better. </media:title>
		</media:content>
	</item>
		<item>
		<title>Washroom Penitentiary [final]</title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/washroom-penitentiary-final/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/washroom-penitentiary-final/#comments</comments>
		<pubDate>Mon, 12 May 2008 08:41:39 +0000</pubDate>
		<dc:creator>ponkotsu</dc:creator>
				<category><![CDATA[Final Project]]></category>
		<category><![CDATA[Gaku Sato]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=492</guid>
		<description><![CDATA[  this is a bathroom concept intended for consideration of possible implementation in the near future or at least further testing.  it is a sensor-driven room that advocates cleanliness by locking you in when you use it and telling you to wash your hands.  of course the lock can be manually disengaged (for legal reasons) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=492&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>  this is a bathroom concept intended for consideration of possible implementation in the near future or at least further testing.  it is a sensor-driven room that advocates cleanliness by locking you in when you use it and telling you to wash your hands.  of course the lock can be manually disengaged (for legal reasons) and the sign can be ignored, but if you choose to do so, as you leave a sign and alarm will notify everyone around you that you have not washed your hands.  of course, if you do wash your hands (whether you used the bathroom or not), you will be thanked and rewarded with sounds of success as you leave.</p>
<p>  additionally, rinsing does not count as washing as they are two separate entities.  and you will be hounded similarly for not flushing the toilet if you use it and don&#8217;t flush.</p>
<p>prototype details and photo scenario:<br />
  [<a href="http://www.andrew.cmu.edu/user/gsato/mti/Scenario.pdf">Scenario.pdf</a>]</p>
<p>state diagram, wiring schematic, and message list:<br />
  [<a href="http://www.andrew.cmu.edu/user/gsato/mti/Schematic%20v2.pdf">Schematic v2.pdf</a>]</p>
<p>reviews:<br />
  &#8220;great idea!&#8221;  -man at demo<br />
  &#8220;we need this!&#8221;  -hospital worker<br />
  &#8220;totally fascist!&#8221;  -g. levin<br />
  &#8220;adorable!&#8221;  -l. albaugh</p>
<p>code:</p>
<p><pre class="brush: cpp;">
#include &lt;Servo.h&gt;

// PINS //
int soapLED_R = 10; // warning light
int soapLED_G = 9;  // indicates soap being dispensed
int soapLED_B = 8;  // standard light [GB=white]
int sinkLED = 11;   // indicates running water [B]

int soapsensor = 0;
int sinksensor = 1;

int toiletswitch = 12; // indicates motion detected [in toilet!]
int flushbutton = 13;
int lockbutton = 7;
int doorswitch = 4;

int signservo = 3;
int locksolenoid = 2;
int speaker = 5;
int bell = 6;

Servo sign;

// STATES //
int State = 0;
const int Blank = 0;
const int Locked = 1;
const int Wash = 2;
const int LockWash = 3;
const int Flush = 4;
const int Toilet = 5;
const int DUnlock = 6;
const int DLeaving = 7;
const int DSoap = 8;
const int DRinse = 9;
const int Clean = 10;
const int CLeaving = 11;
const int TUnlock = 12;
const int TLeaving = 13;
const int TSoap = 14;
const int TWater = 15;

int LockState = 0;
const int Auto = 0;
const int Manual = 1;

// OUTPUT CONDITIONS //
int Reward = 0;
const int Off = 0;
const int On = 1;
int Buzzer = 0;
int Sign = 0;
const int Bl_Bl = 126; // in: blank   out: blank
const int Wa_Bl = 110; // in: wash    out: blank
const int Wa_Di = 89;  // in: wash    out: dirty
const int Ri_Bl = 71;  // in: rinse   out: blank
const int Fl_Bl = 55;  // in: flush   out: blank
const int Fl_Fl = 34;  // in: flush   out: flush
const int Th_Cl = 15;  // in: thanks  out: clean!
int Soap = 0;
const int White = 0;  // standard light
const int Red = 1;    // warning light
const int Green = 2;  // indicates soap being dispensed
int Sink = 0;
int Lock = 0;

// ANALOG INPUT THRESHOLDS //
int soapmin = 50;
int soapmax = 100;
int sinkmin = 100;
int sinkmax = 300;

// OTHER //
int lockbuttonpress = 0;
int dooropentime = 0;
int dooropenmax = 5000;

void setup()
{
  Serial.begin(9600);

  pinMode(soapLED_R, OUTPUT); // digital
  pinMode(soapLED_G, OUTPUT); // digital
  pinMode(soapLED_B, OUTPUT); // digital
  pinMode(sinkLED, OUTPUT);   // digital
  pinMode(soapsensor, INPUT); // analog
  pinMode(sinksensor, INPUT); // analog
  pinMode(toiletswitch, INPUT);  // digital
  pinMode(flushbutton, INPUT);   // digital
  pinMode(lockbutton, INPUT);    // digital
  pinMode(doorswitch, INPUT);    // digital: LOW when closed, HIGH when open
  pinMode(signservo, OUTPUT);    // digital: PWM
  pinMode(locksolenoid, OUTPUT); // digital
  pinMode(speaker, OUTPUT);      // digital
  pinMode(bell, OUTPUT);         // digital

  State = Blank;
  LockState = Auto;
  Reward = Off;
  Buzzer = Off;
  Sign = Bl_Bl;
  Soap = White;
  Sink = White;
  Lock = Off;

  lockbuttonpress = 0;
  dooropentime = 0;

  sign.attach(signservo);
  sign.setMaximumPulse(2400);
  sign.setMinimumPulse(544);
  sign.write(Bl_Bl);
}

void loop()
{
  // SWITCH STATES //
  switch(State)
  {
    case Blank:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH &amp;&amp; digitalRead(doorswitch)==LOW)
      { lockbuttonpress=1; State=Locked; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(analogRead(soapsensor)&lt;soapmin) {State=Wash;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case Locked:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=Blank; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(analogRead(soapsensor)&lt;soapmin) {State=LockWash;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case Wash:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH &amp;&amp; digitalRead(doorswitch)==LOW)
      { lockbuttonpress=1; State=LockWash; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH) {State=Blank;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=Clean;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case LockWash:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=Wash; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH) {State=Blank;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=Clean;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case Flush:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=DUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=DLeaving; }
      if(analogRead(soapsensor)&lt;soapmin) {State=DSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=DRinse;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case Toilet:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=TUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH) {dooropentime=0; State=TLeaving;}
      if(analogRead(soapsensor)&lt;soapmin) {State=TSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=TWater;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      break;
    case DUnlock:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH &amp;&amp; digitalRead(doorswitch)==LOW)
      { lockbuttonpress=1; State=Flush; LockState=Manual;}
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=DLeaving; }
      if(analogRead(soapsensor)&lt;soapmin) {State=DSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=DRinse;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case DLeaving:
      dooropentime++;
      if(digitalRead(doorswitch)==LOW || dooropentime&gt;dooropenmax)
      { dooropentime=0; State=Blank; }
      if(analogRead(soapsensor)&lt;soapmin) {State=DSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=DRinse;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case DSoap:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=DUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=DLeaving; }
      if(analogRead(sinksensor)&lt;sinkmin) {State=Clean;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case DRinse:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=DUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=DLeaving; }
      if(analogRead(soapsensor)&lt;soapmin) {State=DSoap;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case Clean:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1;
        if(LockState==Manual) {LockState=Auto;}
        /*if(LockState==Auto &amp;&amp; digitalRead(doorswitch)==LOW) {LockState=Manual;} */}
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=CLeaving; }
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case CLeaving:
      dooropentime++;
      if(digitalRead(doorswitch)==LOW || dooropentime&gt;dooropenmax)
      { dooropentime=0; State=Blank; }
      break;
    case TUnlock:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH &amp;&amp; digitalRead(doorswitch)==LOW)
      { lockbuttonpress=1; State=Toilet; LockState=Manual; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH) {dooropentime=0; State=TLeaving;}
      if(analogRead(soapsensor)&lt;soapmin) {State=TSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=TWater;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case TLeaving:
      dooropentime++;
      if(digitalRead(doorswitch)==HIGH || dooropentime&lt;50)
      { dooropentime=0; State=Blank; }
      if(analogRead(soapsensor)&lt;soapmin) {State=TSoap;}
      if(analogRead(sinksensor)&lt;sinkmin) {State=TWater;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case TSoap:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=TUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=TLeaving; }
      if(analogRead(sinksensor)&lt;sinkmin) {State=TWater;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
    case TWater:
      if(lockbuttonpress==0 &amp;&amp; digitalRead(lockbutton)==HIGH)
      { lockbuttonpress=1; State=TUnlock; }
      if(digitalRead(lockbutton)==LOW) {lockbuttonpress=0;}
      if(digitalRead(doorswitch)==HIGH)
      { dooropentime=0; State=TLeaving; }
      if(analogRead(soapsensor)&lt;soapmin) {State=TSoap;}
      if(digitalRead(flushbutton)==HIGH) {State=Flush;}
      if(digitalRead(toiletswitch)==HIGH) {State=Toilet;}
      break;
  }

  // SET CONDITIONS //
  switch(State)
  {
    case Blank:
      dooropentime = 0;
      Reward = Off; Buzzer = Off;
      Sign = Bl_Bl;
      Soap = White; Sink = Off;
      Lock = Off;   LockState = Auto;
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
    case Locked:
      Reward = Off; Buzzer = Off;
      Sign = Bl_Bl;
      Soap = White; Sink = Off;
      Lock = On;    LockState = Manual;
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
    case Wash:
      Reward = Off; Buzzer = Off;
      Sign = Bl_Bl;
      Soap = White; Sink = Off;
      Lock = Off;   LockState = Auto;
      if(analogRead(soapsensor)&lt;soapmin) {Soap = Green;}
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
    case LockWash:
      Reward = Off; Buzzer = Off;
      Sign = Bl_Bl;
      Soap = White; Sink = Off;
      Lock = On;    LockState = Manual;
      if(analogRead(soapsensor)&lt;soapmin) {Soap = Green;}
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
    case Flush: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Wa_Bl;
      Soap = Red;   Sink = Off;
      Lock = On;
      break;
    case Toilet: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Fl_Bl;
      Soap = White; Sink = Off;
      Lock = On;
      break;
    case DUnlock:
      Reward = Off; Buzzer = Off;
      Sign = Wa_Di;
      Soap = Red;   Sink = Off;
      Lock = Off;   LockState = Auto;
      break;
    case DLeaving:
      Reward = Off; Buzzer = On;
      Sign = Wa_Di;
      Soap = Red;   Sink = Off;
      Lock = Off;   LockState = Auto;
      break;
    case DSoap: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Wa_Bl;
      Soap = Red;   Sink = Off;
      Lock = On;
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      if(analogRead(soapsensor)&lt;soapmin) {Soap = Green;}
      break;
    case DRinse: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Ri_Bl;
      Soap = Red;   Sink = Off;
      Lock = On;
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
    case Clean:
      Reward = Off; Buzzer = Off;
      Sign = Th_Cl;
      Soap = White; Sink = Off;
      if(analogRead(soapsensor)&lt;soapmin) {Soap = Green;}
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      if(LockState==Auto) {Lock = Off;} else {Lock = On;}
      break;
    case CLeaving:
      Reward = On; Buzzer = Off;
      Sign = Th_Cl;
      Soap = White; Sink = Off;
      Lock = Off; LockState = Auto;
      break;
    case TUnlock:
      Reward = Off; Buzzer = Off;
      Sign = Fl_Fl;
      Soap = White; Sink = Off;
      Lock = Off;   LockState = Auto;
      break;
    case TLeaving:
      Reward = Off; Buzzer = On;
      Sign = Fl_Fl;
      Soap = White; Sink = Off;
      Lock = Off;   LockState = Auto;
      break;
    case TSoap: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Fl_Bl;
      Soap = White; Sink = Off;
      Lock = On;
      if(analogRead(soapsensor)&lt;soapmin) {Soap = Green;}
      break;
    case TWater: // do not set LockState
      Reward = Off; Buzzer = Off;
      Sign = Fl_Bl;
      Soap = White; Sink = Off;
      Lock = On;
      if(analogRead(sinksensor)&lt;sinkmin) {Sink = On;}
      break;
  }

  // EXECUTE CONDITIONS //
  if(Reward==On) {digitalWrite(bell, HIGH);}
  else {digitalWrite(bell, LOW);}
  if(Buzzer==On) {digitalWrite(speaker, HIGH);}
  else {digitalWrite(speaker, LOW);}
  switch(Sign)
  {
    case Bl_Bl: sign.write(Bl_Bl); break;
    case Wa_Bl: sign.write(Wa_Bl); break;
    case Wa_Di: sign.write(Wa_Di); break;
    case Ri_Bl: sign.write(Ri_Bl); break;
    case Fl_Bl: sign.write(Fl_Bl); break;
    case Fl_Fl: sign.write(Fl_Fl); break;
    case Th_Cl: sign.write(Th_Cl); break;
  }
  Servo::refresh();
  switch(Soap)
  {
    case White:
      digitalWrite(soapLED_R, LOW);
      digitalWrite(soapLED_G, HIGH);
      digitalWrite(soapLED_B, HIGH);
      break;
    case Red:
      digitalWrite(soapLED_R, HIGH);
      digitalWrite(soapLED_G, LOW);
      digitalWrite(soapLED_B, LOW);
      break;
    case Green:
      digitalWrite(soapLED_R, LOW);
      digitalWrite(soapLED_B, HIGH);  // B &amp; G pins reversed?
      digitalWrite(soapLED_G, LOW);
      break;
  }
  if(Sink==On) {digitalWrite(sinkLED, HIGH);}
  else {digitalWrite(sinkLED, LOW);}
  if(Lock==On &amp;&amp; digitalRead(doorswitch)==LOW) {digitalWrite(locksolenoid, HIGH);}
  else {digitalWrite(locksolenoid, LOW);}
}
</pre></p>
<p> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/492/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/492/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/492/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=492&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/washroom-penitentiary-final/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fe06ba9ff5c2486e26d4fab5eb077cce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaku</media:title>
		</media:content>
	</item>
		<item>
		<title></title>
		<link>http://makingthingsinteractive.wordpress.com/2008/05/12/488/</link>
		<comments>http://makingthingsinteractive.wordpress.com/2008/05/12/488/#comments</comments>
		<pubDate>Mon, 12 May 2008 05:04:02 +0000</pubDate>
		<dc:creator>catadams</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Cat Adams]]></category>
		<category><![CDATA[Final Project]]></category>

		<guid isPermaLink="false">http://makingthingsinteractive.wordpress.com/?p=488</guid>
		<description><![CDATA[The automatic recycling machine is designed to bring a process that is currently only done on an industrial sale, that is, the sorting of recyclables to a smaller and more personal scale. I intend for this machine to be used primarily on college campuses and areas of high traffic. I hope for people to understand [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=488&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The automatic recycling machine is designed to bring a process that is currently only done on an industrial sale, that is, the sorting of recyclables to a smaller and more personal scale.  I intend for this machine to be used primarily on college campuses and areas of high traffic.  I hope for people to understand the importance of recycling by being more involved in the process.</p>
<p>Overall View of the Recycle-Tron</p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1675a.jpg"><img class="aligncenter size-medium wp-image-491" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1675a.jpg?w=194&#038;h=300" alt="" width="194" height="300" /></a></p>
<p>View of the interior wiring</p>
<p><a href="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1690.jpg"><img class="aligncenter size-medium wp-image-490" src="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1690.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a></p>
<p>Video of a glass bottle being recycled</p>
<span style="text-align:center; display: block;"><a href="http://makingthingsinteractive.wordpress.com/2008/05/12/488/"><img src="http://img.youtube.com/vi/YPdkKe377vw/2.jpg" alt="" /></a></span>
<p>Video of the Recycle-Tron getting angry at someone who doesn&#8217;t recycle</p>
<span style="text-align:center; display: block;"><a href="http://makingthingsinteractive.wordpress.com/2008/05/12/488/"><img src="http://img.youtube.com/vi/E_wI04rh_4g/2.jpg" alt="" /></a></span>
<p>Code:</p>
<p><pre class="brush: cpp;">

/*
         ---Automatic Recycling Sorter---
--Making Things Interactive Spring 08 Final Project--
                 ---Cat Adams---
*/

//states
static int Idle = 0;                        //name for Idle state
static int Excited = 1;                      //name for Excited state
static int Angry = 2;                        //name for Angry state
static int BigReward = 3;                    //name for the post-recycling Big Reward state
static int SmallReward = 4;                  //name for the post-recycling Big Reward state

//regular ints
int redLED = 2;                              //red LED connected to digital pin 2
int blueLED = 3;                             //blue LED connected to digital pin 3
int greenLED = 4;                            //green LED connected to digital pin 4
int siren = 7;                               //buzzer connected to digital pin 7
int pir = 8;                                 //pir sensor connected to digital pin 8
int currentState = Idle;                     //sets the beginning state to Idle
int numberCycle = 0;                         //sets the number of items recycled to zero

//recycling ints
int servoM = 10;                             //Metal sorting Servo
int Mangle;                                  //angle at which to turn servoM, set later
int servoG = 9;                              //Glass-Plastic sorting servo
int Gangle;                                  //angle at which to turn servoG, set later
int switchMetal = 12;                        //Metal sensing wires
int switchGlass = 11;                        //Glass-Plastic sorting swtich analog pin 1
int bottlesense = 13;                        //button switch sensing presence of a bottle
int GAngle2 = 45;                            //angle for servo to sort out glass (from plastic)
int PAngle = 90;                             //angle for servo to sort out plastic
int GAngle = 90;                             //angle to sort glass/plastic from metal
int MAngle = 45;                             //angle to sort metal
int pulseWidth;                              //servo variable 

//program for moving the metal servo
void metalPulse(int servoM, int Mangle){
  pulseWidth = (Mangle * 11) + 500;
  digitalWrite(servoM, HIGH);
  delayMicroseconds(pulseWidth);
  digitalWrite(servoM, LOW);
  delay(20);
}

//program for moving the glass/plastic servo
void glassPulse(int servoG, int Gangle){
  pulseWidth = (Gangle * 11) + 500;
  digitalWrite(servoG, HIGH);
  delayMicroseconds(pulseWidth);
  digitalWrite(servoG, LOW);
  delay(20);
}

//program for pulsing just one LED at a time
void PulseOne (int pin) {
  for (int i=0; i&lt;=255; i++) {
    analogWrite(pin, i);
    delay(2);
  }
  for (int i=255; i&gt;=0; i--) {
    analogWrite(pin, i);
    delay(1);
  }
}

void setup(){
  pinMode(switchMetal, INPUT);
  pinMode(servoM, OUTPUT);
  pinMode(servoG, OUTPUT);
  pinMode(switchGlass, INPUT);
  pinMode(siren, OUTPUT);
  pinMode(redLED, OUTPUT);
  pinMode(blueLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(pir, INPUT);
  pinMode(bottlesense, INPUT);
  Serial.begin(9600);
}

void loop(){

  //Idle State: all LED's off, print &quot;Idle&quot; on computer screen
  if (currentState == Idle) {
    Serial.println(&quot;Idle&quot;);
    //turn all the LEDs off (in case a later state does not turn an led off)
    digitalWrite(blueLED, LOW);
    digitalWrite(redLED, LOW);
    digitalWrite(greenLED, LOW);

    delay(2000);

    if (digitalRead(pir) == LOW){                //if the pir sensor is tripped, a person is near and the machine goes into Excited mode
      currentState = Excited;
    }
    else{                                        //if no one is around, do nothing
      currentState = Idle;
    }
  }
  //Excited State: pulse all three LED's, print &quot;Excited&quot;
  if (currentState == Excited){
    Serial.println(&quot;Excited&quot;);
    delay(2000);
    digitalWrite(blueLED, HIGH);
    digitalWrite(greenLED, HIGH);
    delay(1000);
    digitalWrite(blueLED, LOW);
    digitalWrite(greenLED, LOW);
    delay(1000);
    digitalWrite(blueLED, HIGH);
    digitalWrite(greenLED, HIGH);
    delay(1000);
    digitalWrite(blueLED, LOW);
    digitalWrite(greenLED, LOW);
    delay(2000);

    if (digitalRead(bottlesense) == HIGH){             //if the bottle-sensing button is pressed, the bottle is either glass or plastic
      Serial.println(&quot;glass1&quot;);
      for (Mangle=20; Mangle&lt;=105; Mangle++){
        metalPulse(servoM, Mangle);
      }
      delay (1000);
      if (digitalRead(switchGlass) == HIGH){           //if the glass/plastic sorting button is pressed, the servo tilts and places the bottle in the glass bin
        Serial.println(&quot;glass2&quot;);
        for (Gangle=50; Gangle&lt;=95; Gangle++){
          glassPulse(servoG, Gangle);
        }
        delay (1000);
        numberCycle++;                                //add one to the current numberCycle count
        if (numberCycle &lt;=5) {                        //if the new numberCycle count is less than 6, go to Small Reward state
          currentState = SmallReward;
        }
        else{                                         //if the numberCycle count exceeds 5, go to the Big Reward state
          currentState = BigReward;
        }
      }
      else{                                           //if the glass/plastic sorting button is NOT pressed, the servo tilts and places the bottle in the plastic bin
        plastic();
        numberCycle++;
        if (numberCycle &lt;=5) {
          currentState = SmallReward;
        }
        else{
          currentState = BigReward;
        }
      }
    }
    else{                                             //if the bottle sensing button is NOT pressed
      if (digitalRead(switchMetal) == HIGH){          //but if the switchMetal circuit is connected, there is a metal can
        metal();
        numberCycle++;
        if (numberCycle&lt;=5){
          currentState = SmallReward;
        }
        else{
          currentState = BigReward;
        }
      }
      else{                                           //if neither the button sensing switch or the switchMetal circuit is connected, then
        currentState = Angry;                         //the person is not recycling, so the machine becomes angry
      }
    }
  }
  //Angry State: pulse red LED and print &quot;Angry!!&quot;

  if (currentState == Angry){
    Serial.println(&quot;Angry!!&quot;);
    delay(2000);
    digitalWrite(siren, HIGH);
    PulseOne(redLED);
    digitalWrite(siren, LOW);
    PulseOne(redLED);
    digitalWrite(siren, HIGH);
    PulseOne(redLED);
    digitalWrite(siren, LOW);
    delay(2000);

    if (digitalRead(bottlesense) == HIGH){          //the person has a second chance to recycle... see above for comments
      Serial.println(&quot;glass1&quot;);
      for (Mangle=20; Mangle&lt;=105; Mangle++){
        metalPulse(servoM, Mangle);
      }
      delay (1000);
      if (digitalRead(switchGlass) == HIGH){
        Serial.println(&quot;glass2&quot;);
        for (Gangle=50; Gangle&lt;=95; Gangle++){
          glassPulse(servoG, Gangle);
        }
        delay (1000);
        numberCycle++;
        if (numberCycle &lt;=5) {
          currentState = SmallReward;
        }
        else{
          currentState = BigReward;
        }
      }
      else{
        plastic();
        numberCycle++;
        if (numberCycle &lt;=5) {
          currentState = SmallReward;
        }
        else{
          currentState = BigReward;
        }
      }
    }
    else{
      if (digitalRead(switchMetal) == HIGH){
        metal();
        numberCycle++;
        if (numberCycle&lt;=5){
          currentState = SmallReward;
        }
        else{
          currentState = BigReward;
        }
      }
      else{
        currentState = Idle;
      }
    }
  }
  //Small Reward: print &quot;Small Reward&quot; and pulse the blue LED then the green LED

  if (currentState == SmallReward){
    Serial.println(&quot;Small Reward&quot;);
    PulseOne(blueLED);
    PulseOne(greenLED);
    PulseOne(blueLED);
    PulseOne(greenLED);

    currentState = Idle;
  }

  //Big Reward: print &quot;Big Reward&quot; and pulse the blue then green then red LED
  if (currentState == BigReward){
    Serial.println(&quot;Big Reward&quot;);
    PulseOne(blueLED);
    PulseOne(greenLED);
    PulseOne(redLED);
    PulseOne(blueLED);
    PulseOne(greenLED);
    PulseOne(redLED);
    currentState = Idle;
  }
}

</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/makingthingsinteractive.wordpress.com/488/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/makingthingsinteractive.wordpress.com/488/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/makingthingsinteractive.wordpress.com/488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/makingthingsinteractive.wordpress.com/488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/makingthingsinteractive.wordpress.com/488/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=makingthingsinteractive.wordpress.com&amp;blog=2520098&amp;post=488&amp;subd=makingthingsinteractive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://makingthingsinteractive.wordpress.com/2008/05/12/488/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/40991b0395af6453dad3b0e3d9ddfe1c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">catadams</media:title>
		</media:content>

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1675a.jpg?w=194" medium="image" />

		<media:content url="http://makingthingsinteractive.files.wordpress.com/2008/05/img_1690.jpg?w=300" medium="image" />
	</item>
	</channel>
</rss>
