<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Crit 1: Visual &#8211; Making Things Interactive, Fall 2020</title>
	<atom:link href="https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;cat=13" rel="self" type="application/rss+xml" />
	<link>https://courses.ideate.cmu.edu/48-339/f2020</link>
	<description>Making Things Interactive</description>
	<lastBuildDate>Tue, 22 Dec 2020 08:51:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.14</generator>
	<item>
		<title>Belay on!</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=2026</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=2026#respond</comments>
		
		<dc:creator><![CDATA[srng@andrew.cmu.edu]]></dc:creator>
		<pubDate>Tue, 22 Dec 2020 08:51:43 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=2026</guid>

					<description><![CDATA[Problem: In rock climbing, when ascending a natural rock face, rock climbers use a technique called lead climbing. This is different from toprope climbing, where the rope is already tethered to the top of the route. Here, the lead climber brings the rope up the rock surface with them. (Source) More details about lead climbing &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=2026" class="more-link">Continue reading<span class="screen-reader-text"> "Belay on!"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Problem:</p>
<p>In rock climbing, when ascending a natural rock face, rock climbers use a technique called lead climbing. This is different from toprope climbing, where the rope is already tethered to the top of the route. Here, the lead climber brings the rope up the rock surface with them.</p>
<p><img src="https://www.petzl.com/sfc/servlet.shepherd/version/download/068w0000005umUtAAI" /></p>
<p>(<a href="https://www.petzl.com/GB/en/Sport/News/2017-11-16/Best-practices-for-belaying-a-lead-climber">Source</a>)</p>
<div style="width: 640px;" class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-2026-1" width="640" height="360" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/HarmlessAgreeableAnemonecrab-mobile.mp4?_=1" /><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/HarmlessAgreeableAnemonecrab-mobile.mp4">https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/HarmlessAgreeableAnemonecrab-mobile.mp4</a></video></div>
<p>More details about lead climbing can be found <a href="https://www.rei.com/learn/expert-advice/belay-lead-climber.html">here</a>.</p>
<p>Due to the physical position of the belayer, it is incredibly tiring for them to continuously keep a lookout on the climber. Sometimes, this is even impossible if there are outcrops of rock that occludes the belayer&#8217;s line of sight.</p>
<p><img src="https://cdn.shopify.com/s/files/1/0249/5525/6922/products/SideViewComparison_1024x1024@2x.jpg?v=1603485543" /></p>
<p>There are some tools today such as belay glasses that try to relieve the neck strain of belayers, but it is still a tiring job and it&#8217;s incredibly easy to make a mistake, when you take your eyes off of the climber or look down for a break.</p>
<p><img src="https://cdn.shopify.com/s/files/1/0249/5525/6922/products/EyeSendViewRangeAd_2000x1798_9db9d5c2-bd93-4164-aa48-e97c27d70a4e_2000x.jpg?v=1603485543" /></p>
<p>In fact, it is so tedious and strenuous that lots of pro climbers get into accidents and falls often while lead climbing. How can we provide visual feedback to help reduce incidence of accidents and injury?</p>
<p><strong>Solution:</strong></p>
<p>Creating a system of visual feedback where there&#8217;s an indicator signaling how high or low the tension is in the rope. Compared to regular toprope, there is little physical feedback on the belayer on how taut the lead climber&#8217;s rope actually is. By introducing more indicators on the belay device, the belayer will be more aware of the rope tension as this feedback will be visible within their line of sight, and on the belay device.</p>
<p>(<a href="https://www.petzl.com/US/en/Sport/Universal-technique-for-correct-use-of-a-belay-device-?ActivityName=Rock-climbing">Source</a>)</p>
<p><img loading="lazy" class="alignnone size-full wp-image-2044" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard3.png" alt="" width="821" height="434" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard3.png 821w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard3-300x159.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard3-768x406.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></p>
<p><img loading="lazy" class="alignnone size-full wp-image-2043" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard2.png" alt="" width="808" height="727" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard2.png 808w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard2-300x270.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/Artboard2-768x691.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></p>
<p><strong>Part 1: Preventing falling</strong></p>
<p><img src="https://www.petzl.com/sfc/servlet.shepherd/version/download/068w0000005umV3AAI" /></p>
<p>(<a href="https://www.petzl.com/GB/en/Sport/News/2017-11-16/Best-practices-for-belaying-a-lead-climber">Source</a>)</p>
<p>One of the greatest causes of accidents is slow or absent braking when the lead climber falls. At all times, except when letting in more rope, the belayer should apply friction to the right side of the belay device to act as an emergency brake. In this visual feedback system, if there is insufficient tension applied, a red light will start blinking. Once it is pulled taut enough to withstand a fall from the lead climber, it will stop blinking.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-2042" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/part1small.gif" alt="" width="600" height="1067" /></p>
<p><strong>Part 2: Slack awareness</strong></p>
<p>One of the other most important factors in lead climbing is providing the lead climber with the appropriate amount of slack. If it&#8217;s too little, they can&#8217;t stretch or move far enough to progress. If it&#8217;s too much, they run the risk of a highly injurious fall if they do end up slipping. By introducing a color indicator of the range of rope tension, we enable belayers to better monitor this more closely and make adjustments more quickly. As the tension moves low to high, the range is indicated on the row of lights.</p>
<p>Side view, for better view of colors in visual feedback:<img loading="lazy" class="alignnone size-full wp-image-2046" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/belayfront.gif" alt="" width="600" height="338" /></p>
<p>Front view demo of the whole system:</p>
<p><iframe title="IMG_0333 2" src="https://player.vimeo.com/video/493667813?dnt=1&amp;app_id=122963" width="840" height="473" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></p>
<p><strong>Schematic:</strong></p>
<p><img loading="lazy" class="alignnone size-large wp-image-2028" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-1024x886.png" alt="" width="840" height="727" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-1024x886.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-300x260.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-768x664.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-1536x1329.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb-1200x1038.png 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/visualCrit_bb.png 1914w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p><strong>Code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#define belayLeft   1 //left pot
#define belayRight  0 //right pot

//to store tension on upward and downard tension on belay device
int upwardPull = 0;
int downwardPull = 0;

//LED pins in a row, left
int Blue1 = 3;
int Blue2 = 4;
int Green1 = 5;
int Green2 = 6;
int Yellow1 = 7;
int Yellow2 = 8;

//Blinking LED, right
int R1 = 9;

void setup() {
  Serial.begin(9600);

  pinMode(Blue1, OUTPUT);
  pinMode(Blue2, OUTPUT);
  pinMode(Green1, OUTPUT);
  pinMode(Green2, OUTPUT);
  pinMode(Yellow1, OUTPUT);
  pinMode(Yellow2, OUTPUT);
  pinMode(R1, OUTPUT);

  // put your setup code here, to run once:
  
}

void loop() {
  // read tension on both sides of belay device
  upwardPull = analogRead(belayLeft);
  downwardPull = analogRead(belayRight);

  //show range of tension in upwards belay
  if (upwardPull &lt;= 50){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, LOW);
    digitalWrite(Green1, LOW);
    digitalWrite(Green2, LOW);
    digitalWrite(Yellow1, LOW);
    digitalWrite(Yellow2, LOW);
  }

  else if (upwardPull &gt; 50 &amp;&amp; upwardPull &lt;= 100){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, HIGH);
    digitalWrite(Green1, LOW);
    digitalWrite(Green2, LOW);
    digitalWrite(Yellow1, LOW);
    digitalWrite(Yellow2, LOW);
  }

  else if (upwardPull &gt; 100 &amp;&amp; upwardPull &lt;= 150){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, HIGH);
    digitalWrite(Green1, HIGH);
    digitalWrite(Green2, LOW);
    digitalWrite(Yellow1, LOW);
    digitalWrite(Yellow2, LOW);
  }

  else if (upwardPull &gt; 150 &amp;&amp; upwardPull &lt;= 200){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, HIGH);
    digitalWrite(Green1, HIGH);
    digitalWrite(Green2, HIGH);
    digitalWrite(Yellow1, LOW);
    digitalWrite(Yellow2, LOW);
  }

  else if (upwardPull &gt; 200 &amp;&amp; upwardPull &lt;= 220){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, HIGH);
    digitalWrite(Green1, HIGH);
    digitalWrite(Green2, HIGH);
    digitalWrite(Yellow1, HIGH);
    digitalWrite(Yellow2, LOW);
  }

  else if (upwardPull &gt; 220){
    digitalWrite(Blue1, HIGH);
    digitalWrite(Blue2, HIGH);
    digitalWrite(Green1, HIGH);
    digitalWrite(Green2, HIGH);
    digitalWrite(Yellow1, HIGH);
    digitalWrite(Yellow2, HIGH);
  }


   //Red LED blinks if safety is not 'on'
   if (downwardPull &lt; 100){
    digitalWrite(R1, HIGH);
    delay(100);
    digitalWrite(R1, LOW);
    delay(100);
   }else{
    digitalWrite(R1, LOW);
  }

  // debugging
//    Serial.print("   left side of belay device ");
    Serial.println(upwardPull);
//    Serial.print("   right side of belay device");
//    Serial.println(downwardPull);

}</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=2026</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/12/HarmlessAgreeableAnemonecrab-mobile.mp4" length="367647" type="video/mp4" />

			</item>
		<item>
		<title>&#8220;Fore!&#8221; Wristband</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=1371</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=1371#respond</comments>
		
		<dc:creator><![CDATA[tianhony@andrew.cmu.edu]]></dc:creator>
		<pubDate>Thu, 24 Sep 2020 22:56:08 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=1371</guid>

					<description><![CDATA[Background &#8220;Nowadays, most golfers yell &#8220;fore&#8221; only after they&#8217;ve hit an errant shot toward an unsuspecting golfer, but the term which translates to &#8220;watch out!&#8221; or &#8220;heads up!&#8221; was originally intended to be used before teeing off.&#8221; &#8212;- quote from here Golf  balls can travel really fast in the air, and hitting by golf balls can &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=1371" class="more-link">Continue reading<span class="screen-reader-text"> "&#8220;Fore!&#8221; Wristband"</span></a>]]></description>
										<content:encoded><![CDATA[<h2>Background</h2>
<p>&#8220;Nowadays, most golfers yell &#8220;fore&#8221; only after they&#8217;ve hit an errant shot toward an unsuspecting golfer, but the term which translates to &#8220;watch out!&#8221; or &#8220;heads up!&#8221; was originally intended to be used before teeing off.&#8221;</p>
<p>&#8212;- quote from <a href="https://www.livescience.com/33190-why-do-golfers-yell-fore.html#:~:text=Nowadays%2C%20most%20golfers%20yell%20%22fore,be%20used%20before%20teeing%20off.">here</a></p>
<p>Golf  balls can travel really fast in the air, and hitting by golf balls can cause from severe swellings to permanent damages. When you are playing at the golf course, you yell &#8220;Fore!&#8221; when:</p>
<ul>
<li style="list-style-type: none">
<ul>
<li>you didn&#8217;t wait for the group in front of you to leave(rude!)</li>
<li>you hit a really bad ball and you are hitting onto other fairways(not where your ball is suppose to go), and you are not sure whether there are people there.</li>
</ul>
</li>
</ul>
<p>Because you might hit/injure them, or even just scare them.</p>
<p>When you hear &#8220;Fore!&#8221; on the golf course, there is usually less than a second for you to react. There are a few things that you can do:</p>
<ul>
<li style="list-style-type: none">
<ul>
<li>identify where the sound comes from</li>
<li>hide at a nearby golf cart or tree</li>
<li>put your hands on your head</li>
<li>stay low so that the ball does not hit your head</li>
</ul>
</li>
</ul>
<p>But usually, it&#8217;s hard to identify where the sound comes from within such a short period of time, so one usually attempts to do all of above very confused and hope for the best.</p>
<h2>Problem</h2>
<p>Ever since the early times in the sport of golf, people rely on yelling and hearing &#8220;Fore!&#8221; to warn each other about a flying ball coming at their directions. This has issues:</p>
<ul>
<li style="list-style-type: none">
<ul>
<li>People with hearing problems don&#8217;t receive the warning</li>
<li>There is not enough time for people to react to identify where the sound comes from</li>
</ul>
</li>
</ul>
<h2>Proposed Solution</h2>
<p><img loading="lazy" class=" wp-image-1377 alignleft" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-wristband.jpg" alt="" width="212" height="204" /></p>
<p>My proposed solution is a &#8220;Fore!&#8221; wristband. Everyone on the golf course will be wearing it, and it can do the followings:</p>
<ul>
<li style="list-style-type: none">
<ul>
<li>Sense when &#8220;Fore!&#8221; warning is made</li>
<li>Communicate the location/direction of the warning to other wristbands</li>
<li>Display the direction of the warning<img loading="lazy" class="aligncenter wp-image-1376 size-large" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain-1024x679.jpg" alt="" width="840" height="557" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain-1024x679.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain-300x199.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain-768x509.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain-1200x796.jpg 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-explain.jpg 1513w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></li>
</ul>
</li>
</ul>
<p>For proof of concept, I will(still don&#8217;t have my hardwares yet) use an <strong><em>accelerometer</em></strong> to detect whether a swing is made, a <em><strong>sound senso</strong></em>r to detect whether there is a loud yelling immediately following the swing, and an <em><strong>8&#215;8 led matrix </strong></em>for the display.<img loading="lazy" class="wp-image-1380 size-full aligncenter" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-diagram.jpg" alt="" width="641" height="92" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-diagram.jpg 641w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/fore-diagram-300x43.jpg 300w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></p>
<h2>Discussion</h2>
<p>The prototype design has a few flaws:</p>
<ul>
<li style="list-style-type: none">
<ul>
<li>The sound sensor is chosen so that the golfer does not need to make any additional actions of notify other golfers, but the sound sensor only detects for sound above a certain threshold. It&#8217;s common for golfers to yell things other than &#8220;Fore!&#8221; immediately after the swings. For surrounding golfers, the issue should not be too big because the distance makes their yellings quieter. But for the golfer wearing the wristband, this would raise a problem of sending false alarms to other golfers. Possible solutions can be running speech recognition to ensure that &#8220;Fore!&#8221; is the word, or adding some additional conditions to avoid false alarms.</li>
<li>In my prototype, I omitted the wireless communication. But the communication can cause some problems if the wristbands are put in use in the real world, since it&#8217;s not uncommon for golf courses to have poor signals. So radio signals set up and maintained by the golf  course may be a good solution.</li>
</ul>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=1371</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sensing glove for Scuba Divers</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=1373</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=1373#respond</comments>
		
		<dc:creator><![CDATA[Zerui Huo]]></dc:creator>
		<pubDate>Thu, 24 Sep 2020 22:54:53 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=1373</guid>

					<description><![CDATA[Problem Diving is an exciting and enjoyable sport. However, it can also be dangerous if the divers are not ware of the condition of their equipment, their companions, and the environment. Most divers are trained to understand their equipment well, but it is still difficult to keep track of one&#8217;s diving buddies and the environment &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=1373" class="more-link">Continue reading<span class="screen-reader-text"> "Sensing glove for Scuba Divers"</span></a>]]></description>
										<content:encoded><![CDATA[<h1>Problem</h1>
<p>Diving is an exciting and enjoyable sport. However, it can also be dangerous if the divers are not ware of the condition of their equipment, their companions, and the environment. Most divers are trained to understand their equipment well, but it is still difficult to keep track of one&#8217;s diving buddies and the environment even for experienced divers. It becomes quite difficult to keep track of others when a diving group has 3 people, and it is difficult to know one&#8217;s surrounding when the visibility is low in a cave or at night. Most of the time, the divers have to focus on what is ahead of them. Frequent checking around for people and surrounding would slow down the movement and distract the divers.</p>
<h1>Solution</h1>
<p>I previously saw that LED fibers are now integrated into some designs of the cloths. Therefore, I have this idea that a glove with LED on the back can be used as a sensing/locating system to tell the divers the positions of their companions of whether there is a rock or hard surface behind them. The idea is that The diver will wear 4 ultrasonic ranger for the front, back, left, and right. When the sensor detects objects in a certain range, a signal will be sent to the glove and shown as a light-up LED.</p>
<figure id="attachment_1379" aria-describedby="caption-attachment-1379" style="width: 768px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-1379 size-large" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-768x1024.jpg" alt="" width="768" height="1024" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-768x1024.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-225x300.jpg 225w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-1152x1536.jpg 1152w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-1536x2048.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-1200x1600.jpg 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3401-scaled.jpg 1920w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /><figcaption id="caption-attachment-1379" class="wp-caption-text">The sensing glove</figcaption></figure>
<p>With the information shown on the divers&#8217; glove, they no longer need to look back or around to check on the situation. More importantly, this will be very useful during night dive when the only visible area is 2-4 m pointed by the flashlight.</p>
<h1>Proof of Concept</h1>
<p>Because of the lack of materials, I only use 1 ultrasonic sensor to stimulate the function of one of the four ultrasonic sensor. I originally planned to use a LED matrix as it is more accurate to the original design. But LEDs were used instead because I cannot get one of the LED matrix. The LEDs represent the angle or direction of the detected object, with the bottom LED being 0-30 degree and the top LED being 150-180 degree. Ideally, the distance is reflected by the distance of the light-up LED from the center block. The servo motor is used to rotate the ultrasonic sensor so that objects from a wider range of angles can be detected.</p>
<figure id="attachment_1381" aria-describedby="caption-attachment-1381" style="width: 768px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-1381 size-large" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-768x1024.jpg" alt="" width="768" height="1024" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-768x1024.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-225x300.jpg 225w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-1152x1536.jpg 1152w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-1536x2048.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-1200x1600.jpg 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3399-scaled.jpg 1920w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /><figcaption id="caption-attachment-1381" class="wp-caption-text">The set up of the hardware</figcaption></figure>
<p><a>Turning sensor</a></p>
<p>I used my hand to hold the ultrasonic sensor for the stimulation because the jumpers on the sensor stop the servo motor from moving freely. I tried to mimic the rotation made by the servo motor, but error still occurs as my hand cannot synchronize perfectly with the servo motor .</p>
<p><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3397.mov">Demo of the device</a></p>
<p><img loading="lazy" class="alignnone size-large wp-image-1384" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem-1024x605.jpg" alt="" width="840" height="496" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem-1024x605.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem-300x177.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem-768x454.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem-1200x709.jpg 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-Sketch_schem.jpg 1437w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>Code:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp">#include &lt;NewPing.h&gt;
#include &lt;Servo.h&gt;

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 100 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
#define SERVO_PIN 10
#define LED_0  2
#define LED_30  3
#define LED_60  4
#define LED_90  5
#define LED_120  6
#define LED_150  7


NewPing Sonar_1(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

Servo Servo1; // you can call the servo whatever you want

//Timer
//Clock 1 is the timer for the servo
unsigned long clock1 = 0; // variable for timing
const int INTERVAL1 = 5; // milliseconds between updates

//Global variables
int angle;
bool bounce = true;

int direc_distance[181];
int angle_of_objects[10];

//Functions
//Sweeping the servo motor
void sweep_servo() {
  if (bounce == true) {
    angle = angle + 1;
    Servo1.write(angle);

    dir_dis(angle);

    if (angle == 180) {
      bounce = false;

      clear_position();



      //Serial.print("0-180: ");
      check_position();


      Serial.println(angle_of_objects[0]);
      //Serial.println(angle_of_objects[1]);
      show_position();


    }
    return;
  }

  if (bounce == false) {
    angle = angle - 1;
    Servo1.write(angle);
    dir_dis(angle);

    if (angle == 0) {
      bounce = true;
      clear_position();

      //Serial.print("180-0: ");
      check_position();

      Serial.println(angle_of_objects[0]);
      //Serial.println(angle_of_objects[1]);

      show_position();


    }

  }


}

//The function that records the angle and the distance to the array direc_distance
void dir_dis (int angle) {

  direc_distance[angle] = Sonar_1.ping_cm();
}

void check_position() {
  //The for loop to find the angles of the locations of the objects

  int index;
  //Serial.print(direc_distance[0]);
  for (int i; i &lt; 181; i++) {
    int start_angle;
    int end_angle;
    int mid_angle;

    if (direc_distance[i] != 0) {
      start_angle = i;

      //Serial.print(i);
      //Serial.print(",start angle:");

      while (direc_distance[i] != 0 and abs(direc_distance[i + 1] - direc_distance[i]) &lt; 20) {
        i = i + 1;
        //Serial.println(direc_distance[i]);
        if (i == 180) {
          break;
        }
      }
      end_angle = i;

      mid_angle = (end_angle - start_angle) / 2;


      //Serial.println(start_angle);
      //Serial.print(",end angle:");
      //Serial.print(end_angle);
      //Serial.print(",mid angle:");
      //Serial.println(mid_angle);

      //Serial.print("This is mid angle:");
      //Serial.println(mid_angle);
      angle_of_objects[index] = mid_angle;
      if (index = 9) {
        return;
      }
      index = index + 1;
    }

  }
}

void light_LED(int angle) {
  if (angle == 0) {
    digitalWrite(LED_0, HIGH);
  }

  if (angle == 30) {
    digitalWrite(LED_30, HIGH);
  }

  if (angle == 60) {
    digitalWrite(LED_60, HIGH);
  }

  if (angle == 90) {
    digitalWrite(LED_90, HIGH);
  }

  if (angle == 120) {
    digitalWrite(LED_120, HIGH);
  }

  if (angle == 150) {
    digitalWrite(LED_150, HIGH);
  }

 

}

int select_angle(int angle) {
  if (angle &lt; 30) {
    return 0;
  }

  if (angle &gt;= 30 and angle &lt; 60) {
    return 30;
  }


  if (angle &gt;= 60 and angle &lt; 90) {
    return 60;
  }

  if (angle &gt;= 90 and angle &lt; 120) {
    return 90;
  }

  if (angle &gt;= 120 and angle &lt; 150) {
    return 120;
  }

  if (angle &gt;= 150 and angle &lt; 180) {
    return 150;
  }
}



void show_position() {
  //Turns off all the LED lights
  digitalWrite(LED_0, LOW);
  digitalWrite(LED_30, LOW);
  digitalWrite(LED_60, LOW);
  digitalWrite(LED_90, LOW);
  digitalWrite(LED_120, LOW);
  digitalWrite(LED_150, LOW);


  int angles[] = {0, 30, 60, 90, 120, 150, 180};

  for (int i; i &lt; 10; i++) {
    if (angle_of_objects[i] == 0) {
      Serial.println("Done");
      return;
    }


    int angle_light = select_angle(angle_of_objects[i]);



    Serial.println(angle_light);
    light_LED(angle_light);
  }
}

//This function clears the stored angles of the positions of the objects
void clear_position() {
  for (int i; i &lt; 10; i++) {
    angle_of_objects[i] = 0;
  }
}

void setup() {
  pinMode(LED_0, OUTPUT);
  pinMode(LED_30, OUTPUT);
  pinMode(LED_60, OUTPUT);
  pinMode(LED_90, OUTPUT);
  pinMode(LED_120, OUTPUT);
  pinMode(LED_150, OUTPUT);
 

  Servo1.attach(SERVO_PIN);

  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.

  Servo1.write(0);
  //digitalWrite(LED_180, HIGH);
  delay(2000);



}

void loop() {




  //The servo clock
  if (millis() &gt;=  clock1) {
    //decreases the minute value in the timer for each task
    sweep_servo();

    clock1 = millis() + INTERVAL1 ;

    //Serial.println(angle_of_objects[0]);


  }
}</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=1373</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/IMG_3397.mov" length="14847609" type="video/quicktime" />

			</item>
		<item>
		<title>Synesthesia watch, how to design for parents with hearing disability</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=1348</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=1348#respond</comments>
		
		<dc:creator><![CDATA[mvlachos@andrew.cmu.edu]]></dc:creator>
		<pubDate>Thu, 24 Sep 2020 20:12:13 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=1348</guid>

					<description><![CDATA[&#160; &#160; &#160; &#160; &#160; &#160; Problem-solving diagram &#8211; Train of thinking Multi-purpose wearable with multiple screens Computational design logic During this current stage, two pushbuttons and two potentiometers were chosen to represent the sound recognition. Button_1 represents &#8216;coughing&#8217;, button_2 &#8216;sneezing&#8217;, potentiometer_1 the strength of coughing and potentiometer_2 the continuity of sneezing. The inputs were &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=1348" class="more-link">Continue reading<span class="screen-reader-text"> "Synesthesia watch, how to design for parents with hearing disability"</span></a>]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p><span id="more-1348"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: left"><strong>Problem-solving diagram &#8211; Train of thinking</strong></p>
<p><img loading="lazy" class="alignnone wp-image-1350" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming.jpg" alt="" width="2421" height="1386" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming.jpg 2324w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-300x172.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-1024x586.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-768x440.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-1536x879.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-2048x1172.jpg 2048w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/BrainStorming-1200x687.jpg 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p style="text-align: left"><strong>Multi-purpose wearable with multiple screens</strong></p>
<p><strong><img loading="lazy" class="alignnone wp-image-1355 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731.jpg" alt="" width="2480" height="781" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731.jpg 2480w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-300x94.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-1024x322.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-768x242.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-1536x484.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-2048x645.jpg 2048w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/multipleScreens-e1600978811731-1200x378.jpg 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></strong></p>
<p style="text-align: left"><strong>Computational design logic</strong></p>
<p><strong><img loading="lazy" class="wp-image-1357 size-full aligncenter" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-scaled.jpg" alt="" width="996" height="2560" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-scaled.jpg 996w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-117x300.jpg 117w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-768x1973.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-598x1536.jpg 598w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-797x2048.jpg 797w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Diagram-1200x3083.jpg 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></strong></p>
<p>During this current stage, two pushbuttons and two potentiometers were chosen to represent the sound recognition. Button_1 represents &#8216;coughing&#8217;, button_2 &#8216;sneezing&#8217;, potentiometer_1 the strength of coughing and potentiometer_2 the continuity of sneezing. The inputs were sent through serialPort to the p5.js library of javascript to draw visuals outputs.</p>
<p style="text-align: left"><strong>I/O notational system</strong></p>
<p><strong><img loading="lazy" class="alignnone wp-image-1359 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-scaled.jpg" alt="" width="2560" height="1810" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-scaled.jpg 2560w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-300x212.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-1024x724.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-768x543.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-1536x1086.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-2048x1448.jpg 2048w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Untitled-1-1200x849.jpg 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></strong></p>
<p style="text-align: left"><strong>Just some little practise..</strong></p>
<p>What is the child&#8217;s condition according to the graphs <strong>(1),(2)</strong> and <strong>(3)</strong>?</p>
<p><strong>(1)</strong></p>
<p><img loading="lazy" class="alignnone wp-image-1361 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/2-1.jpg" alt="" width="846" height="593" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/2-1.jpg 846w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/2-1-300x210.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/2-1-768x538.jpg 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>Intense coughing. Very mild sneezing. It may be about a flu that starts from the throat/lungs and not the nose.</p>
<p><strong>(2)</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The child is pretty much healthy today.</p>
<p><strong>(3)</strong></p>
<p><img loading="lazy" class="alignnone wp-image-1363 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/1-2.jpg" alt="" width="868" height="603" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/1-2.jpg 868w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/1-2-300x208.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/1-2-768x534.jpg 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>The child sneezes multiple times in a row. There is a mild coughing, too. It is either about an environmental allergy or a mild flu starting from the nose.</p>
<p><strong>Code &#8211; Serial Communication between different platforms.</strong></p>
<p>The following convention was made. As the goal for the current project was the visual representation of coughing/sneezing and not their auditory recognition using sensors and deep learning, the latter ones were replaced by simple methods and electronic components. The user himself/herself manipulates two push buttons and two analog potentiometers to keep track of the times he/she coughed or sneezed(buttons) and their intensity/duration (potentiometers). The values are <em><strong>sent serially</strong></em> to the platform p5.js through the<em><strong> p5.serial control</strong></em>. After the sensor values are read and proccessed in p5.js,  the graphics on the parents&#8217; smart watch are activated.</p>
<p><strong>Demo: <a href="https://youtu.be/TGh9t0Zz7Tc">https://youtu.be/TGh9t0Zz7Tc</a></strong></p>
<p><strong>Circuit design:</strong></p>
<p><strong><img loading="lazy" class="alignnone wp-image-1791 size-large" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-1024x518.jpg" alt="" width="840" height="425" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-1024x518.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-300x152.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-768x389.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-1536x777.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic-1200x607.jpg 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/schematic.jpg 1755w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></strong></p>
<p><strong>Arduino Code: </strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp">/* --------------------------------------------------------------- */
// Two leds. Each turns on, when the corresponding switch is pushed down.
const int redPin = 2;
const int whitePin = 5;
// Analogy: One button pushed down when the person coughs, and the other when the person sneezes.
const int button1 = 7;
const int button2 = 8;
int button_1; int button_2;
char cough; char sneeze;
// Analogy: One potentiometer represents the intensity of coughing and the other the intesity of sneezing.
const int potPin1 = A0; const int potPin2 = A5;
unsigned int potVal1; unsigned int potVal2;

/* --------------------------------------------------------------- */
void setup() {
  pinMode(redPin, OUTPUT); pinMode(whitePin, OUTPUT);
  pinMode(button1, INPUT); pinMode(button2, INPUT);
  pinMode(potPin1, INPUT); pinMode(potPin2, INPUT);

  // We need serial port to send the values p5 serial port control
  Serial.begin(9600);
}

/* --------------------------------------------------------------- */
void loop() {
  /* --------------------------------------------------------------- */
  // button_1 represents coughing. When button_1 == 1, the person just coughed (cough == 1)
  button_1 = digitalRead(button1);
  if (button_1) {
    cough = 1;
  } else {
    cough = 0;
  }
  // When the persons coughs (cough == 1), we can adjust the tensity of coughing
  while (cough == 1) {
    potVal1 = analogRead(potPin1);
    int mappedPot1 = map(potVal1, 0, 1023, 5, 30);
  }
  /* --------------------------------------------------------------- */
  // button_2 represents sneezing. When button_2 == 1, the person just sneezed (sneeze == 1)
  button_2 = digitalRead(button2);
  if (button_2) {
    sneeze = 1;
  } else {
    sneeze = 0;
  }
  // When the persons sneezes (sneeze == 1), we can adjust the tensty of sneezing
  while (sneeze == 1) {
    potVal2 = analogRead(potPin2);
    int mappedPot1 = map(potVal1, 0, 1023, 5, 30); int mappedPot2 = map(potVal2, 0, 1023, 1, 9);
  }

  // that helps us see that the button are actually pushed.
  leds();
  /* --------------------------------------------------------------- */
  // Now we print the values we want to communicate with p5.js
  Serial.print(button_1);
  Serial.print(",");
  Serial.print(button_2);
  Serial.print(",");
  Serial.print(mappedPot1);
  Serial.print(",");
  Serial.println(mappedPot2);

  //delay(500);

}
  /* --------------------------------------------------------------- */
// different leds turn on when different buttons are pushed down.
void leds() {
  if (button_1 == 1) {
    digitalWrite(redPin, HIGH);
  }
  else {
    digitalWrite(redPin, LOW);
  }

  if (button_2 == 1) {
    digitalWrite(whitePin, HIGH);
  }
  else {
    digitalWrite(whitePin, LOW);
  }

}</pre>
<p><strong>5p.js code:</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="js" data-enlighter-theme="classic" data-enlighter-linenumbers="false">// VARIABLES ********************************************************
// variables for Serial communication
let serial;
let sensors = [];
let cough = false; // we start with 'no coughing detected'
let sneeze = false; // we start with 'no sneezing detected'
let howBadCaughing; // intensity of coughing measured by Arduino
let howLoadSneezing; // intensity of coughing measure by Arduino
let timeCough = true; // indicates when the program is ready to read the next coughing
let timeSneeze = true; // indicates when the program is ready to read the next sneezing

// variables for Particles
const startForce = 100;
const particle_maxVel = 30; // how far they spread around
const particle_maxAcc = 5; // how fast they spread around
let spawnNum; // number of particles produced by one click
let startSz; 
let shrinkRate = 0.5; // how fast they shrink
const maxParticles = 20;

// variables for Particles' Color
let R1,G1,B1;

// SET UP ********************************************************
function setup() {
  // canvas
  createCanvas(800, 800);
  background(255);
  
  // Activate Serial communication
  serial = new p5.SerialPort();
  serial.list();
  serial.open('COM4');
  serial.on('connected', serverConnected);
  serial.on('list', gotList);
  serial.on('data', gotData);
  serial.on('error', gotError);
  serial.on('open', gotOpen);
  serial.on('close', gotClose);
  
  // create a universal system, in which we are going to create    different particle spirals
  system = new ParticleSystem(); 
  // Color
  R1 = random(255); G1 = random(255); B1 = random(255);  
}

// DRAW ********************************************************
function draw() {
  // Here, according to the reading values of the sensors, we draw parametric graphics each time the person sneezes or coughs
  if (sensors[0] == 1 &amp;&amp; timeCough){
    timeCough = false;
    pos = new p5.Vector(random(100, width-100),random(100,height-100));
    system.addParticle(pos,"caugh");
      }
  
  if (sensors[1] == 1 &amp;&amp; timeSneeze){
    timeSneeze = false;
    pos = new p5.Vector(random(100, width-100),random(100,height-100));
    system.addParticle(pos,"sneeze");
      }
  // here we define the parameters of each graphic. According to how bad coughing and sneezing are, the particle spirals change parameters.
  howBadCaughing = sensors[2];
  howLoadSneezing = sensors[3];
  startSz = howBadCaughing;
  spawnNum = howLoadSneezing;

  // we update/draw the system.
  system.updateSystem();
  
}

// FUNCTIONS ********************************************************
// Serial: Here we collect the raw data sent from Arduino in the form of a string.We split the various values around ',' and save into a list named sensors

function serverConnected() {
 print("Connected to Server");
}
function gotList(thelist) {
 print("List of Serial Ports:");

 for (let i = 0; i &lt; thelist.length; i++) {
  print(i + " " + thelist[i]);
 }
}
function gotOpen() {
 print("Serial Port is Open");
}
function gotClose(){
 print("Serial Port is Closed");
 let latestData = "Serial Port is Closed";
}
function gotError(theerror) {
 print(theerror);
}
function gotData() {
 let currentString = serial.readLine();
  trim(currentString);
 if (!currentString) return;
 sensors = split(currentString,",");
 //console.log(currentString);
 latestData = currentString;
}

// by pressing the key 'a', the program becomes ready for the next coughing/sneezing reading
function keyTyped() {
  if (key === 'a') {
    timeCough = true;
    timeSneeze = true;
  } 
}

// CLASSES ********************************************************
class Particle{
  constructor(location,type){
    this.loc = new p5.Vector(location.x, location.y);
    this.vel = new p5.Vector(0, 0);
    this.acc = new p5.Vector(0, 0);  
    this.angle = 0;
    this.magnitude = 0;
    this.type = type
    
    if (this.type == "caugh"){
      this.size = startSz;
    }
    else if (this.type == "sneeze") {
      this.size = 13;
    }
    
    this.isDead = false;
    
  } // constructor
  
  update() {
    // move in random direction with random speed
    this.angle += random(0,2*PI);
    this.magnitude = random(0,startForce);
    
    // apply a force and limit its strength
    this.acc.x += cos(this.angle)*this.magnitude;
    this.acc.y += sin(this.angle)*this.magnitude;
    this.acc.limit(particle_maxAcc);
    
    // add to current velocity
    this.vel.add(this.acc);
    
    this.vel.limit(particle_maxVel);
    
    // Apply result to current location
    this.loc.add(this.vel); 
    
    // reduce size
    this.size -= shrinkRate;
    if (this.size&lt;=0) {
      this.isDead = true }
  
    
  } // Particle update
  
  display() {
    push();
        
    if (this.type == "caugh") {
    rectMode(RADIUS);
    rectMode(CENTER);
    stroke(color(random(255),random(255),random(255)));
    let c = color(R1,G1,B1,random(255));
    fill(c);
    rect(this.loc.x,this.loc.y,this.size,this.size);
    } 
    
    else if (this.type == "sneeze") {
    ellipseMode(RADIUS);
    ellipseMode(CENTER);
    stroke(color(random(255),random(255),random(255)));
    let c = color(255-R1,255-G1,255-B1,random(255));
    fill(c);
    ellipse(this.loc.x,this.loc.y,this.size,this.size);        
    }
    
    pop();
    
  } // display
  
} // class Particle

class ParticleSystem {
  constructor() {
    this.loc2 = new p5.Vector(0,0);
    this.particles = [];
    this.type = ""
  } // constructor
  
  addParticle(newLoc,type) {
    this.loc2.x = newLoc.x; this.loc2.y = newLoc.y; 
    this.type = type;
    
    if (this.type == "caugh"){
      this.spawnNum = 4;
    }
    else if (this.type == "sneeze") {
      this.spawnNum = spawnNum;
    }

    if (this.particles.length + this.spawnNum &lt; maxParticles) {
      for (let i=0; i &lt; this.spawnNum; i++) {
        append(this.particles,new Particle(this.loc2,this.type));
      }
    }
  } // addParticle
  
  updateSystem(){
    for (let i =0;i&lt;this.particles.length;i++) {
      let p = this.particles[i];
      
      p.update();
      
      if (p.isDead) {
        this.particles.splice(i,1); 
      } else { p.display();
      }
      
    } // for
   
  } // updateSystem
  
} // particleSystem class</pre>
<pre class="EnlighterJSRAW" data-enlighter-language="js">/*! p5.serialport.js v0.0.1 2015-07-23 */
/**
 * @module p5.serialport
 * @submodule p5.serialport
 * @for p5.serialport
 * @main
 */
/**
 *  p5.serialport
 *  Shawn Van Every (Shawn.Van.Every@nyu.edu)
 *  ITP/NYU
 *  LGPL
 *  
 *  https://github.com/vanevery/p5.serialport
 *
 */
(function(root, factory) {
  if (typeof define === 'function' &amp;&amp; define.amd)
    define('p5.serialport', ['p5'], function(p5) {
      (factory(p5));
    });
  else if (typeof exports === 'object')
    factory(require('../p5'));
  else
    factory(root['p5']);
}(this, function(p5) {

  // =============================================================================
  //                         p5.SerialPort
  // =============================================================================


  /**
   * Base class for a serial port. Creates an instance of the serial library and prints "hostname":"serverPort" in the console.
   *
   * @class p5.SerialPort
   * @constructor
   * @param {String} [hostname] Name of the host. Defaults to 'localhost'.
   * @param {Number} [serverPort] Port number. Defaults to 8081.
   * @example
   * 	var portName = '/dev/cu.usbmodem1411'; //enter your portName
   *  		
   *	function setup() {
   *		 createCanvas(400, 300);
   *		 serial = new p5.SerialPort()
   *		 serial.open(portName);
   *	}
   */
  p5.SerialPort = function(_hostname, _serverport) {
    var self = this;
    this.bufferSize = 1; // How much to buffer before sending data event
    this.serialBuffer = [];
    //this.maxBufferSize = 1024;
    this.serialConnected = false;
    this.serialport = null;
    this.serialoptions = null;
    this.emitQueue = [];
    this.clientData = {};
    this.serialportList = [];

    if (typeof _hostname === 'string') {
      this.hostname = _hostname;
    } else {
      this.hostname = "localhost";
    }

    if (typeof _serverport === 'number') {
      this.serverport = _serverport;
    } else {
      this.serverport = 8081;
    }

    try {
      this.socket = new WebSocket("ws://" + this.hostname + ":" + this.serverport);
      console.log(("ws://" + this.hostname + ":" + this.serverport));
    } catch (err) {
      if (typeof self.errorCallback !== "undefined") {
        self.errorCallback("Couldn't connect to the server, is it running?");
      }
    }

    this.socket.onopen = function(event) {
      console.log('opened socket');
      serialConnected = true;

      if (typeof self.connectedCallback !== "undefined") {
        self.connectedCallback();
      }
      
      if (self.emitQueue.length &gt; 0) {
        for (var i = 0; i &lt; self.emitQueue.length; i ++){
          self.emit(self.emitQueue[i]);
        }
        self.emitQueue = [];
      }
    };

    this.socket.onmessage = function(event) {
      var messageObject = JSON.parse(event.data);
      // MESSAGE ROUTING
      if (typeof messageObject.method !== "undefined") {
        if (messageObject.method == 'echo') {
        } else if (messageObject.method === "openserial") {
          if (typeof self.openCallback !== "undefined") {
            self.openCallback();
          }
        } else if (messageObject.method === "data") {
          // Add to buffer, assuming this comes in byte by byte
          self.serialBuffer.push(messageObject.data);
          if (typeof self.dataCallback !== "undefined") {
            // Hand it to sketch
            if (self.serialBuffer.length &gt;= self.bufferSize) {
              self.dataCallback();
            }
          }
          if (typeof self.rawDataCallback !== "undefined") {
            self.rawDataCallback(messageObject.data);
          }
        } else if (messageObject.method === 'list') {
          self.serialportList = messageObject.data;
          if (typeof self.listCallback !== "undefined") {
            self.listCallback(messageObject.data);
          }
        } else if (messageObject.method === "close") {
          if (typeof self.closeCallback !== "undefined") {
            self.closeCallback();
          }
        } else if (messageObject.method === "write") {
          // Success Callback?
        } else if (messageObject.method === "error") {
          //console.log(messageObject.data);
          if (typeof self.errorCallback !== "undefined") {
            self.errorCallback(messageObject.data);
          }
        } else {
          // Got message from server without known method
          console.log("Unknown Method: " + messageObject);
        }
      } else {
        console.log("Method Undefined: " + messageObject);
      }
    };

    this.socket.onclose = function(event) {
      if (typeof self.closeCallback !== "undefined") {
        self.closeCallback();
      }
    };

    this.socket.onerror = function(event) {
      if (typeof self.errorCallback !== "undefined") {
        self.errorCallback();
      }
    };
  };

/** 
 *
 * @method emit
 * @private
 * @return
 * @example
 * 
 */
  p5.SerialPort.prototype.emit = function(data) {
    if (this.socket.readyState == WebSocket.OPEN) {
      this.socket.send(JSON.stringify(data));
    } else {
      this.emitQueue.push(data);
    }
  };

/**
 * Tells you whether p5 is connected to the serial port. 
 *
 * @method isConnected
 * @return {Boolean} true or false
 * @example
 * 		var serial; // variable to hold an instance of the serialport library
 * 		var portName = '/dev/cu.usbmodem1411';
 * 		
 * 		function setup() {
 * 			createCanvas(400, 300);
 *	 		serial = new p5.SerialPort();
 *	 		serial.open(portName);
 *	 		println(serial.isConnected());
 * 		}
 */
  p5.SerialPort.prototype.isConnected = function() {
    if (self.serialConnected) { return true; }
    else { return false; }
  };

/**
 * Lists serial ports available to the server.
 * Synchronously returns cached list, asynchronously returns updated list via callback.
 * Must be called within the p5 setup() function.
 * Doesn't work with the p5 editor's "Run in Browser" mode.
 *
 * @method list
 * @return {Array} array of available serial ports
 * @example
 * 		function setup() {
 * 		createCanvas(windowWidth, windowHeight);
 * 		serial = new p5.SerialPort();
 * 		serial.list();
 * 		serial.open("/dev/cu.usbmodem1411");
 * 		}
 *
 * For full example: &lt;a href="https://itp.nyu.edu/physcomp/labs/labs-serial-communication/two-way-duplex-serial-communication-using-p5js/"&gt;Link&lt;/a&gt;
 * @example
 * 		function printList(portList) {
 * 		  // portList is an array of serial port names
 * 		  for (var i = 0; i &lt; portList.length; i++) {
 * 		    // Display the list the console:
 * 		    println(i + " " + portList[i]);
 * 		  }
 * 		}
 */
  p5.SerialPort.prototype.list = function(cb) {
    if (typeof cb === 'function') {
      this.listCallback = cb;
    }
    this.emit({
      method: 'list',
      data: {}
    });

    return this.serialportList;
  };

/**
 * Opens the serial port to enable data flow.
 * Use the {[serialOptions]} parameter to set the baudrate if it's different from the p5 default, 9600.
 * 
 * @method open
 * @param  {String} serialPort Name of the serial port, something like '/dev/cu.usbmodem1411'
 * @param  {Object} [serialOptions] Object with optional options as {key: value} pairs.
 *                                Options include 'baudrate'.
 * @param  {Function} [serialCallback] Callback function when open completes
 * @example
 * 		// Change this to the name of your arduino's serial port
 * 		serial.open("/dev/cu.usbmodem1411");
 *
 * @example
 * 		// All of the following are valid:
 *		serial.open(portName);
 *		serial.open(portName, {}, onOpen);
 *		serial.open(portName, {baudrate: 9600}, onOpen)
 *		
 *		function onOpen() {
 *		  print('opened the serial port!');
 *		}
 */
  p5.SerialPort.prototype.open = function(_serialport, _serialoptions, cb) {

    if (typeof cb === 'function') {
      this.openCallback = cb;
    }

    this.serialport = _serialport;

    if (typeof _serialoptions === 'object') {
      this.serialoptions = _serialoptions;
    } else {
      //console.log("typeof _serialoptions " + typeof _serialoptions + " setting to {}");
      this.serialoptions = {};
    }
    // If our socket is connected, we'll do this now, 
    // otherwise it will happen in the socket.onopen callback
    this.emit({
      method: 'openserial',
      data: {
        serialport: this.serialport,
        serialoptions: this.serialoptions
      }
    });
  };

/**
 * Sends a byte to a webSocket server which sends the same byte out through a serial port.
 * @method write
 * @param  {String, Number, Array} Data Writes bytes, chars, ints, bytes[], and strings to the serial port.
 * @example
 * You can use this with the included Arduino example called PhysicalPixel.
 * Works with P5 editor as the socket/serial server, version 0.5.5 or later.
 * Written 2 Oct 2015 by Tom Igoe. For full example: &lt;a href="https://github.com/vanevery/p5.serialport/tree/master/examples/writeExample"&gt;Link&lt;/a&gt;
 * 		
 * 		function mouseReleased() {
 *	  		  serial.write(outMessage);
 *			  if (outMessage === 'H') {
 *			    outMessage = 'L';
 *			  } else {
 *			    outMessage = 'H';
 *			  }
 *		}
 *
 * For full example: &lt;a href="https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-serial-output-from-p5-js/"&gt;Link&lt;/a&gt;
 * @example		
 * 		function mouseDragged() {
 *   		  // map the mouseY to a range from 0 to 255:
 *			  outByte = int(map(mouseY, 0, height, 0, 255));
 *			  // send it out the serial port:
 *			  serial.write(outByte);
 *		}
 */
  p5.SerialPort.prototype.write = function(data) {
    //Writes bytes, chars, ints, bytes[], Strings to the serial port
    var toWrite = null;
    if (typeof data == "number") {
      // This is the only one I am treating differently, the rest of the clauses are meaningless
      toWrite = [data];
    } else if (typeof data == "string") {
      toWrite = data;
    } else if (Array.isArray(data)) {
      toWrite = data;
    } else {
      toWrite = data;
    }

    this.emit({
      method: 'write',
      data: toWrite
    });
  };

/**
 * Returns a number between 0 and 255 for the next byte that's waiting in the buffer. 
 * Returns -1 if there is no byte, although this should be avoided by first checking available() to see if data is available.
 *
 * @method read
 * @return {Number} Value of the byte waiting in the buffer. Returns -1 if there is no byte.
 * @example
 * 		function serialEvent() {
 *   		inByte = int(serial.read());
 *			byteCount++;
 *		}
 *
 * @example
 * 		function serialEvent() {
 *	  		// read a byte from the serial port:
 *			var inByte = serial.read();
 *			// store it in a global variable:
 *			inData = inByte;
 *		}
 */
  p5.SerialPort.prototype.read = function() {
    if (this.serialBuffer.length &gt; 0) {
      return this.serialBuffer.shift();
    } else {
      return -1;
    }
  };

/**
 * Returns the next byte in the buffer as a char. 
 * 
 * @method readChar
 * @return {String} Value of the Unicode-code unit character byte waiting in the buffer, converted from bytes. Returns -1 or 0xffff if there is no byte.
 * @example
 * 		var inData;
 *		
 *		function setup() {
 *		  // callback for when new data arrives
 *		  serial.on('data', serialEvent); 
 *		  
 *		function serialEvent() {
 *		  // read a char from the serial port:
 *		  inData = serial.readChar();
 *		}
 */
  p5.SerialPort.prototype.readChar = function() {
    if (this.serialBuffer.length &gt; 0) {
      /*var currentByte = this.serialBuffer.shift();
      console.log("p5.serialport.js: " + currentByte);
      var currentChar = String.fromCharCode(currentByte);
      console.log("p5.serialport.js: " + currentChar);
      return currentChar;
      */
      return String.fromCharCode(this.serialBuffer.shift());
    } else {
      return -1;
    }
  };

/**
 * Returns a number between 0 and 255 for the next byte that's waiting in the buffer, and then clears the buffer of data. Returns -1 if there is no byte, although this should be avoided by first checking available() to see if data is available.
 * @method readBytes
 * @return {Number} Value of the byte waiting in the buffer. Returns -1 if there is no byte.
 * @example
 * 		var inData;
 *		
 *		function setup() {
 *		  // callback for when new data arrives
 *		  serial.on('data', serialEvent); 
 *		  
 *		function serialEvent() {
 *		  // read bytes from the serial port:
 *		  inData = serial.readBytes();
 *		}
 */
  p5.SerialPort.prototype.readBytes = function() {
    if (this.serialBuffer.length &gt; 0) {
      var returnBuffer = this.serialBuffer.slice();

      // Clear the array
      this.serialBuffer.length = 0;

      return returnBuffer;
    } else {
      return -1;
    }
  };

/**
 * Returns all of the data available, up to and including a particular character.
 * If the character isn't in the buffer, 'null' is returned. 
 * The version without the byteBuffer parameter returns a byte array of all data up to and including the interesting byte. 
 * This is not efficient, but is easy to use. 
 * 
 * The version with the byteBuffer parameter is more efficient in terms of time and memory. 
 * It grabs the data in the buffer and puts it into the byte array passed in and returns an integer value for the number of bytes read. 
 * If the byte buffer is not large enough, -1 is returned and an error is printed to the message area. 
 * If nothing is in the buffer, 0 is returned.
 *
 * @method readBytesUntil
 * @param {[byteBuffer]} 
 * @return {[Number]} [Number of bytes read]
 * @example
 *		// All of the following are valid:
 *		charToFind.charCodeAt();
 *		charToFind.charCodeAt(0);
 *		charToFind.charCodeAt(0, );
 */
  p5.SerialPort.prototype.readBytesUntil = function(charToFind) {
    console.log("Looking for: " + charToFind.charCodeAt(0));
    var index = this.serialBuffer.indexOf(charToFind.charCodeAt(0));
    if (index !== -1) {
      // What to return
      var returnBuffer = this.serialBuffer.slice(0, index + 1);
      // Clear out what was returned
      this.serialBuffer = this.serialBuffer.slice(index, this.serialBuffer.length + index);
      return returnBuffer;
    } else {
      return -1;
    }
  };

/**
 * Returns all the data from the buffer as a String. 
 * This method assumes the incoming characters are ASCII. 
 * If you want to transfer Unicode data: first, convert the String to a byte stream in the representation of your choice (i.e. UTF8 or two-byte Unicode data). 
 * Then, send it as a byte array.
 *
 * @method readString
 * @return
 * @example
 * 
 *
 *
 * 
 */
  p5.SerialPort.prototype.readString = function() {
    //var returnBuffer = this.serialBuffer;
    var stringBuffer = [];
    //console.log("serialBuffer Length: " + this.serialBuffer.length);
    for (var i = 0; i &lt; this.serialBuffer.length; i++) {
      //console.log("push: " + String.fromCharCode(this.serialBuffer[i]));
      stringBuffer.push(String.fromCharCode(this.serialBuffer[i]));
    }
    // Clear the buffer
    this.serialBuffer.length = 0;
    return stringBuffer.join("");
  };

/**
 * Returns all of the data available as an ASCII-encoded string.
 *
 * @method readStringUntil
 * @param {String} stringToFind String to read until.
 * @return {String} ASCII-encoded string until and not including the stringToFind.
 * @example
 *
 * For full example: &lt;a href="https://github.com/tigoe/p5.serialport/blob/master/examples/twoPortRead/sketch.js"&gt;Link&lt;/a&gt;
 * 		 
 * 		 var serial1 = new p5.SerialPort();
 *		 var serial2 = new p5.SerialPort();
 *		 var input1 = '';
 *		 var input2 = '';
 *		
 *		 function serialEvent(){
 *		 		data = serial1.readStringUntil('\r\n');
 *				if (data.length &gt; 0){
 *				input1 = data;
 *				}
 *		 }
 *		 
 *		 function serial2Event() {
 *		 		var data = serial2.readStringUntil('\r\n');
 *				if (data.length &gt; 0){
 *				input2 = data;
 *				}
 *		 }
 */
  p5.SerialPort.prototype.readStringUntil = function(stringToFind) {

    var stringBuffer = [];
    //console.log("serialBuffer Length: " + this.serialBuffer.length);
    for (var i = 0; i &lt; this.serialBuffer.length; i++) {
      //console.log("push: " + String.fromCharCode(this.serialBuffer[i]));
      stringBuffer.push(String.fromCharCode(this.serialBuffer[i]));
    }
    stringBuffer = stringBuffer.join("");
    //console.log("stringBuffer: " + stringBuffer);

    var returnString = "";
    var foundIndex = stringBuffer.indexOf(stringToFind);
    //console.log("found index: " + foundIndex);
    if (foundIndex &gt; -1) {
      returnString = stringBuffer.substr(0, foundIndex);
      this.serialBuffer = this.serialBuffer.slice(foundIndex + stringToFind.length);
    }
    //console.log("Sending: " + returnString);
    return returnString;
  };


/**
 * Returns all of the data available as an ASCII-encoded string until a line break is encountered.
 * 
 * @method readLine
 * @return {String} ASCII-encoded string
 * @example
 * 
 * You can use this with the included Arduino example called AnalogReadSerial.
 * Works with P5 editor as the socket/serial server, version 0.5.5 or later.
 * Written 2 Oct 2015 by Tom Igoe. For full example: &lt;a href="https://github.com/vanevery/p5.serialport/tree/master/examples/readAndAnimate"&gt;Link&lt;/a&gt;
 * 		
 * 		function gotData() {
 *   		  var currentString = serial.readLine();  // read the incoming data
 *			  trim(currentString);                    // trim off trailing whitespace
 *			
 *			  if (!currentString) return; {            // if the incoming string is empty, do no more 
 *			    console.log(currentString);
 *			    }
 *			    
 *			  if (!isNaN(currentString)) {  // make sure the string is a number (i.e. NOT Not a Number (NaN))
 *			    textXpos = currentString;   // save the currentString to use for the text position in draw()
 *			    }
 *			}
 */
  p5.SerialPort.prototype.readLine = function() {
    return this.readStringUntil("\r\n");
  }; 

/**
 * Returns the number of bytes available.
 *
 * @method available
 * @return {Number} The length of the serial buffer array, in terms of number of bytes in the buffer.
 * @example
 *		function draw() {
 *			// black background, white text:
 *			background(0);
 *			fill(255);
 *			// display the incoming serial data as a string:
 *			var displayString = "inByte: " + inByte + "\t Byte count: " + byteCount;
 *			displayString += "  available: " + serial.available();
 *			text(displayString, 30, 60);
 *			}
 * */
  p5.SerialPort.prototype.available = function() {
    return this.serialBuffer.length;
  };

/**
 * Returns the last byte of data from the buffer.
 *
 * @method last
 * @return {Number}
 * @example
 * 
 * */
  p5.SerialPort.prototype.last = function() {
    //Returns last byte received
    var last = this.serialBuffer.pop();
    this.serialBuffer.length = 0;
    return last;
  };

/**
 * Returns the last byte of data from the buffer as a char.
 *
 * @method lastChar
 * @example
 * 
 * */
  p5.SerialPort.prototype.lastChar = function() {
    return String.fromCharCode(this.last());
  };

/**
 * Clears the underlying serial buffer.
 *
 * @method clear
 * @example
 */
  p5.SerialPort.prototype.clear = function() {
    //Empty the buffer, removes all the data stored there.
    this.serialBuffer.length = 0;
  };

/**
 * Stops data communication on this port. 
 * Use to shut the connection when you're finished with the Serial.
 *
 * @method stop
 * @example
 * 
 */
  p5.SerialPort.prototype.stop = function() {
  };

/**
 * Tell server to close the serial port. This functions the same way as serial.on('close', portClose).
 * 
 * @method close
 * @param {String} name of callback
 * @example
 *		
 *		var inData;
 *		
 *		function setup() {
 *		  serial.open(portOpen);
 *		  serial.close(portClose); 
 *		}
 *  	
 *  	function portOpen() {
 *		  println('The serial port is open.');
 *		}  
 *		 
 *		function portClose() {
 *		  println('The serial port closed.');
 *		}  
 */
  p5.SerialPort.prototype.close = function(cb) {
    // 
    if (typeof cb === 'function') {
      this.closeCallback = cb;
    }
    this.emit({
      method: 'close',
      data: {}
    });
  };

/**
 * Register clients that connect to the serial server. 
 * 
 * This is for use with the p5 Serial Control application so the application 
 * can access and render the names of clients who have connected. Note that 
 * calling this method does not log the list of registered clients. To do that, 
 * you'd use:
 * serial.on('registerClient', logClientData)
 *
 * The example demonstates the registerClient method, as well as how you'd log
 * the list of clients.
 * 
 * @method registerClient
 * @example
 *    
 * function setup() {
 *   // Create a new p5 Serial Port object
 *   serial = new p5.SerialPort();
 *   // List the available ports
 *   serial.list();
 *   // On port open, call the gotOpen callback
 *   serial.on('open', gotOpen);
 *   // Register the clients that have connected to the server
 *   serial.registerClient();
 *   // After registerClient method is done, call the logClientData callback
 *   serial.on('registerClient', logClientData)
 * }
 * 
 * // Callback to log the client data
 * function logClientData(data) {
 *   console.log("Client data: ", data)
 * }
 * 
 * // Callback to log a message when the port is opened
 * function gotOpen() {
 *   console.log("Serial port is open.")
 * }
 */
  // p5.SerialPort.prototype.registerClient = function(cb) {
  //   if (typeof cb === 'function') {
  //     this.registerCallback = cb;
  //   }
  //   this.emit({
  //     method: 'registerClient',
  //     data: {}
  //   });
  //   return this.clientData;
  // };

/**
 * // Register callback methods from sketch
 * 
 */
  p5.SerialPort.prototype.onData = function(_callback) {
    this.on('data',_callback);
  };

  p5.SerialPort.prototype.onOpen = function(_callback) {
    this.on('open',_callback);
  };

  p5.SerialPort.prototype.onClose = function(_callback) {
    this.on('close',_callback);
  };

  p5.SerialPort.prototype.onError = function(_callback) {
    this.on('error',_callback);
  };

  p5.SerialPort.prototype.onList = function(_callback) {
    this.on('list',_callback);
  };

  p5.SerialPort.prototype.onConnected = function(_callback) {
    this.on('connected',_callback);
  };

  p5.SerialPort.prototype.onRawData = function(_callback) {
    this.on('rawdata',_callback);
  };

  // Version 2
  p5.SerialPort.prototype.on = function(_event, _callback) {
    if (_event == 'open') {
      this.openCallback = _callback;
    } else if (_event == 'data') {
      this.dataCallback = _callback;
    } else if (_event == 'close') {
      this.closeCallback = _callback;
    } else if (_event == 'error') {
      this.errorCallback = _callback;
    } else if (_event == 'list') {
      this.listCallback = _callback;
    } else if (_event == 'connected') {
      this.connectedCallback = _callback;
    } else if (_event == 'rawdata') {
      this.rawDataCallback = _callback;
    }
  };
}));
</pre>
<pre class="EnlighterJSRAW" data-enlighter-language="html">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"&gt;&lt;/script&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"&gt;&lt;/script&gt;
    &lt;script language="javascript" type="text/javascript" src="p5.serialport.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
    &lt;meta charset="utf-8" /&gt;

  &lt;/head&gt;
  &lt;body&gt;
    &lt;script src="sketch.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=1348</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Actually Press Start for Your Laundry/Dryer</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=1316</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=1316#respond</comments>
		
		<dc:creator><![CDATA[sakamath@andrew.cmu.edu]]></dc:creator>
		<pubDate>Thu, 24 Sep 2020 02:45:53 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=1316</guid>

					<description><![CDATA[Problem: I was having a lot of trouble coming up with something for this crit, but thankfully (at least for me) one of my housemates had forgotten to click start on the dryer and when she went to get her clothes an hour later, they of course were still wet. With our oven, I&#8217;ve forgotten &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=1316" class="more-link">Continue reading<span class="screen-reader-text"> "Actually Press Start for Your Laundry/Dryer"</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>I was having a lot of trouble coming up with something for this crit, but thankfully (at least for me) one of my housemates had forgotten to click start on the dryer and when she went to get her clothes an hour later, they of course were still wet. With our oven, I&#8217;ve forgotten to press start multiple times since moving in a month ago and the setup is literally just inputting the baking temperature. Thankfully, it beeps a few times to let me know that I never actually pressed start. If I were deaf, listening to music, or there was a lot of noise coming in from outside though, this wouldn&#8217;t help at all. When it comes to doing laundry, simply not pressing start can be a huge drain of time. However, this crucial last step is so easy to forget in even the smallest pre-steps like inputting a baking time, but especially so for laundry considering it takes a decent amount of time to load clothes.  For washing and drying clothes, a visual notification would save a ton of time and would ensure that as long as you aren&#8217;t blind, you will know you forgot to press start regardless of your ability to hear.</p>
<p><strong>Proposed Solution:</strong></p>
<p>My proposed solution is to notify the user to press start with an obnoxiously flashing LED strip along the walk away from the machine so as to catch their attention easily. The device would only light the LED strip if a few conditions are met so that energy isn&#8217;t wasted and the user who loads clothes slower than an arbitrary average isn&#8217;t unnecessarily annoyed. First, clothes would have to be loaded into the machine. This could be detected by a broken IR beam at the bottom middle of the machine. Secondly, the lid must be closed. Rather than use a tilt sensor which would limit this to machines with lids that are vertical when open and horizontal when closed, I&#8217;ve chose a photo resistor as the inside of the machine will be dark when closed. Finally, the notification will only occur if the user has walked a few steps away from the machine, detected by an ultrasonic ranger, as there&#8217;s no need for it if they are standing right in front of it and very well may not have forgotten. If they&#8217;ve walked out of the room, here signified by a time elapsed and no return in front of the machine, the LED strip automatically turns off.</p>
<p><strong>Proof of Concept:</strong></p>
<div style="width: 720px;" class="wp-video"><video class="wp-video-shortcode" id="video-1316-2" width="720" height="480" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/go-bk-and-press-button.mp4?_=2" /><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/go-bk-and-press-button.mp4">https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/go-bk-and-press-button.mp4</a></video></div>
<p style="text-align: center"><em>This shows the intended use where in the user sees the flashing LEDs and goes back to press start.</em></p>
<div style="width: 840px;" class="wp-video"><video class="wp-video-shortcode" id="video-1316-3" width="840" height="473" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/press-start-to-begin-with.mp4?_=3" /><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/press-start-to-begin-with.mp4">https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/press-start-to-begin-with.mp4</a></video></div>
<p style="text-align: center"><em>This shows how nothing happens if the start button is pressed to begin with.</em></p>
<div style="width: 840px;" class="wp-video"><video class="wp-video-shortcode" id="video-1316-4" width="840" height="473" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/lights-turn-off-if-youve-left.mp4?_=4" /><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/lights-turn-off-if-youve-left.mp4">https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/lights-turn-off-if-youve-left.mp4</a></video></div>
<p style="text-align: center"><em>This shows how the lights turn off if you&#8217;ve left.</em></p>
<div style="width: 840px;" class="wp-video"><video class="wp-video-shortcode" id="video-1316-5" width="840" height="473" preload="metadata" controls="controls"><source type="video/mp4" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Nothing-if-just-close-lid.mp4?_=5" /><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Nothing-if-just-close-lid.mp4">https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Nothing-if-just-close-lid.mp4</a></video></div>
<p style="text-align: center"><em>This shows how nothing will happen if the lid is closed but nothing is in the machine.</em></p>
<p style="text-align: center"><img loading="lazy" class="aligncenter wp-image-1334 size-medium" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-300x300.jpg" alt="" width="300" height="300" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-300x300.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-1024x1024.jpg 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-150x150.jpg 150w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-768x768.jpg 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-1536x1536.jpg 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-2048x2048.jpg 2048w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Photo-resistor-and-ir-breakbeam-sensor-in-box-1200x1200.jpg 1200w" sizes="(max-width: 300px) 85vw, 300px" /><em>Photoresistor and IR breakbeam sensor in box</em></p>
<p><img loading="lazy" class="aligncenter wp-image-1337 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/circuit.jpg" alt="" width="955" height="396" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/circuit.jpg 955w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/circuit-300x124.jpg 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/circuit-768x318.jpg 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p style="text-align: center"><em>My Circuit</em></p>
<pre class="EnlighterJSRAW" data-enlighter-language="cpp">const int IRpin = 3;
int IRstate;

const int buttonPin = 10;
int buttonPressed = 0;

#include &lt;PololuLedStrip.h&gt;
PololuLedStrip&lt;13&gt; ledStrip;//LED in pin 7
const int LEDPIN = 13;
const int LED_COUNT = 10;//in full project would be a lot longer strip of LEDs
rgb_color red[LED_COUNT];
rgb_color black[LED_COUNT];

#include &lt;NewPing.h&gt;
int triggerPin = 12;
int echoPin = 11;
int maxDistance = 400;
NewPing sonar(triggerPin, echoPin, maxDistance);

int photoPin = A5;

void setup() {
  pinMode(IRpin, INPUT);
  pinMode(buttonPin, INPUT);
  digitalWrite(IRpin, HIGH); 
  pinMode(LEDPIN, OUTPUT);
  pinMode(photoPin, INPUT);

  Serial.begin(9600);
}

void loop() {
  IRstate = digitalRead(IRpin);
  
  int photoVal = analogRead(photoPin);
  Serial.println(photoVal);
  int distance = sonar.ping_cm();
  for (uint16_t i = 0; i &lt; LED_COUNT; i++) {
                black[i] = rgb_color(0, 0, 0);
              }
              ledStrip.write(black, LED_COUNT);
  if (IRstate == LOW) {//broken
    //Serial.println("broken");
    //Serial.println(distance);
    //Serial.println(photoVal);
    if (photoVal &lt; 150) {//lid closed
      if (digitalRead(buttonPin)) {
        buttonPressed = 1;
      }
      if (not buttonPressed) {
        if (distance &gt; 10) { //would've done 91cm, ~3ft for real thing
          static int startTime = millis();
          if (millis() - startTime &lt; 7000) {//7s for demo, but would be about 30 for actual thing
            static int blinkStart = millis();
            for (uint16_t i = 0; i &lt; LED_COUNT; i++) {//this rotates through each LED on the strip so that each one will be red
              byte x = millis() - 20 * i;
              red[i] = rgb_color(255 - x, 0, 0);
            }
            ledStrip.write(red, LED_COUNT);
            if (millis() - blinkStart &gt;= 10) {
              for (uint16_t i = 0; i &lt; LED_COUNT; i++) {
                black[i] = rgb_color(0, 0, 0);
              }
              ledStrip.write(black, LED_COUNT);
              blinkStart = millis();
            }
          }
        }
        
      }
    }
  }
}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=1316</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/go-bk-and-press-button.mp4" length="7476550" type="video/mp4" />
<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/press-start-to-begin-with.mp4" length="13194406" type="video/mp4" />
<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/lights-turn-off-if-youve-left.mp4" length="16116302" type="video/mp4" />
<enclosure url="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Nothing-if-just-close-lid.mp4" length="8842223" type="video/mp4" />

			</item>
		<item>
		<title>Privacy for cats</title>
		<link>https://courses.ideate.cmu.edu/48-339/f2020/?p=1319</link>
					<comments>https://courses.ideate.cmu.edu/48-339/f2020/?p=1319#respond</comments>
		
		<dc:creator><![CDATA[kyungsec@andrew.cmu.edu]]></dc:creator>
		<pubDate>Wed, 23 Sep 2020 09:04:09 +0000</pubDate>
				<category><![CDATA[Crit 1: Visual]]></category>
		<guid isPermaLink="false">https://courses.ideate.cmu.edu/48-339/f2020/?p=1319</guid>

					<description><![CDATA[For cats, the litter box is not only a place to do one&#8217;s duty; it is also a safe space. Never stare at your cat when one&#8217;s in the litter box. Either they are there to use the toilet or for a safe space, cats feel the extreme emotional pressure when humans stare at them &#8230; <a href="https://courses.ideate.cmu.edu/48-339/f2020/?p=1319" class="more-link">Continue reading<span class="screen-reader-text"> "Privacy for cats"</span></a>]]></description>
										<content:encoded><![CDATA[<p>For cats, the litter box is not only a place to do one&#8217;s duty; it is also a safe space. Never stare at your cat when one&#8217;s in the litter box. Either they are there to use the toilet or for a safe space, cats feel the extreme emotional pressure when humans stare at them while they are in the litterbox.</p>
<p>My cat Nala is the shiest cat you will ever meet. She hides inside the litter box from Ginger, our other cat, when she gets chased. After having many occasions where we tried to look for Nala and found her in the litterbox and unintentionally interrupting her privacy, I decided to come up with a device.</p>
<p>This device shows you if the litterbox is occupied, and it also tells you when it needs to be emptied.</p>
<figure id="attachment_1321" aria-describedby="caption-attachment-1321" style="width: 1674px" class="wp-caption alignnone"><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default.png"><img loading="lazy" class="wp-image-1321 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default.png" alt="" width="1674" height="1212" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default.png 1674w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default-300x217.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default-1024x741.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default-768x556.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default-1536x1112.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/default-1200x869.png 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-1321" class="wp-caption-text">Default screen</figcaption></figure>
<p>It includes two sensors: the PIR sensor and a methane gas sensor. The PIR sensor will be placed inside the litterbox to tell one if it is occupied. The gas detector detects various types of gases that create an odor, but methane gas mainly. It tells you when the box has to be emptied.</p>
<figure id="attachment_1322" aria-describedby="caption-attachment-1322" style="width: 1686px" class="wp-caption alignnone"><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector.png"><img loading="lazy" class="wp-image-1322 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector.png" alt="" width="1686" height="1236" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector.png 1686w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector-300x220.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector-1024x751.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector-768x563.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector-1536x1126.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Gas-detector-1200x880.png 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-1322" class="wp-caption-text">When the gas detector detects the methane gas</figcaption></figure>
<p>When the litterbox needs to be emptied, the red LED turns on and it displays the message &#8220;Empty the box!&#8221;. Through various range testing, the adequate value that corresponded with times of the toilet being used was &#8220;110.&#8221;</p>
<figure id="attachment_1323" aria-describedby="caption-attachment-1323" style="width: 1654px" class="wp-caption alignnone"><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor.png"><img loading="lazy" class="wp-image-1323 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor.png" alt="" width="1654" height="1166" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor.png 1654w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor-300x211.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor-1024x722.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor-768x541.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor-1536x1083.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/PIR-sensor-1200x846.png 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-1323" class="wp-caption-text">When the PIR sensor detects the movement</figcaption></figure>
<p>When the cat is inside the box, the blue LED turns on and it graphically displays what the cat is doing inside the box.</p>
<figure id="attachment_1320" aria-describedby="caption-attachment-1320" style="width: 1930px" class="wp-caption alignnone"><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated.png"><img loading="lazy" class="wp-image-1320 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated.png" alt="" width="1930" height="1324" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated.png 1930w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated-300x206.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated-1024x702.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated-768x527.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated-1536x1054.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/activated-1200x823.png 1200w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-1320" class="wp-caption-text">When both sensors are on</figcaption></figure>
<p>This is when both sensors are activated.</p>
<p>&nbsp;</p>
<p>Video demonstration of how this works:</p>
<p><a href="https://drive.google.com/file/d/1c-2hyGFoSVJmicfLqxxD7Vq3-VhMbg-t/view?usp=sharing">https://drive.google.com/file/d/1c-2hyGFoSVJmicfLqxxD7Vq3-VhMbg-t/view?usp=sharing</a></p>
<p>&nbsp;</p>
<p>Now that we  know that it works, it was time to actually get real.</p>
<p><img loading="lazy" class="alignnone wp-image-1325 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/test.png" alt="" width="992" height="1326" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/test.png 992w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/test-224x300.png 224w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/test-766x1024.png 766w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/test-768x1027.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></p>
<p>For some reason, my 9V battery was not working; so I had it connect to my computer. It already told me that the box needs to be cleaned.</p>
<p><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1.png"><br />
<img loading="lazy" class="alignnone wp-image-1326 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1.png" alt="" width="990" height="1322" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1.png 990w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1-225x300.png 225w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1-767x1024.png 767w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger1-768x1026.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a></p>
<p>So I came back after cleaning; the display does not say that it needs to be cleaned anymore, so I needed to get a participant. Nala knew what was going on so I couldn&#8217;t get her inside the box, so I tried to get Ginger to be my first participant.</p>
<p><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2.png"><img loading="lazy" class="alignnone wp-image-1324 size-full" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2.png" alt="" width="914" height="1224" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2.png 914w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2-224x300.png 224w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2-765x1024.png 765w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/ginger2-768x1028.png 768w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a></p>
<p>He seemed quite convinced, but he seemed uninterested because he already emptied his stomach before the testing.</p>
<p>&nbsp;</p>
<p>The questions might be:</p>
<p>Why the gas detector?</p>
<p>-The commonly used sensor for movements would be the ultrasonic sensor; however, cats are very sensitive to sounds. So I used the PIR sensor that detects the infrared light coming from moving objects with heat.</p>
<p>Why do we need this to be visual?</p>
<p>-I have been working with cats since the introduction to physical computing class. My cat Nala is now 8 years old, so I wanted to do something fun with her and also wanted to make her life better and more convenient because all cats deserve the best life. As much as humans, cats need some privacy as well, and this gets often interrupted when we share the space. Cats can&#8217;t say &#8220;Hey I need some space&#8221;/&#8221;I need this to be cleaned&#8221; or when you find them in the litter box/private settings, their privacy is already interrupted. So I thought the mutual ground that we have is having things visual.</p>
<p>&nbsp;</p>
<p>Schematic:</p>
<p><a href="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM.png"><img loading="lazy" class="alignnone size-large wp-image-1345" src="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-1024x569.png" alt="" width="840" height="467" srcset="https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-1024x569.png 1024w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-300x167.png 300w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-768x427.png 768w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-1536x853.png 1536w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM-1200x667.png 1200w, https://courses.ideate.cmu.edu/48-339/f2020/wp-content/uploads/2020/09/Screen-Shot-2020-09-24-at-11.24.22-PM.png 1800w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a></p>
<pre>#include &lt;Wire.h&gt;
#include &lt;LiquidCrystal.h&gt;


//const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


int GasPin = A0; 
int CatPin = 6; 
int LED1 = 8; 
int LED2 = 7;

void setup() {

lcd.begin(16,2);
pinMode(GasPin ,INPUT); 
pinMode(CatPin, INPUT); 
pinMode(LED1, OUTPUT); 
pinMode(LED2, OUTPUT);
pinMode(CatPin, INPUT); 
Serial.begin(9600);


lcd.print("=^._.^= S");



}


void loop() {




digitalWrite(LED1,LOW);


if (digitalRead(CatPin) == HIGH){ 
digitalWrite(LED1,HIGH); 
delay(1000);
lcd.setCursor(11,0);
lcd.print("O o o");
}

else { 
digitalWrite(LED1,LOW); 
//delay(1000);
lcd.setCursor(11,0);
lcd.print(" ");
}

if ((analogRead(GasPin))&lt;190){
Serial.println(analogRead(GasPin));
digitalWrite(LED2, LOW);
lcd.setCursor(0,1);
lcd.print(" ");
}
else {
Serial.println(analogRead(GasPin));
digitalWrite(LED2, HIGH);
lcd.setCursor(0,1);
lcd.print("Empty the box!");
}



}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://courses.ideate.cmu.edu/48-339/f2020/?feed=rss2&#038;p=1319</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
