<?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>ArduinoFun.com Blog &#187; Arduino Project</title>
	<atom:link href="http://arduinofun.com/blog/index.php/tag/arduino-project/feed/" rel="self" type="application/rss+xml" />
	<link>http://arduinofun.com/blog</link>
	<description>- Think It - Build It - Share It -</description>
	<lastBuildDate>Thu, 01 Apr 2010 22:39:59 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CoasterBot Part I</title>
		<link>http://arduinofun.com/blog/2010/04/01/coasterbot-part-i/</link>
		<comments>http://arduinofun.com/blog/2010/04/01/coasterbot-part-i/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 22:27:16 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Project Files]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Robot]]></category>
		<category><![CDATA[coasterbot]]></category>
		<category><![CDATA[jameco]]></category>
		<category><![CDATA[make zine]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=462</guid>
		<description><![CDATA[Jameco and Make Zine are holding a contest to build a &#8220;CoasterBot,&#8221; a mini robot development platform using CD/DVD media as the main body components. I signed up, and this will be my first post documenting my progress. I have my chassis ready so far, and plan to use my Arduino.
In the Make: Robot build newsletter [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jameco.com/Jameco/PressRoom/makerobotbuild.html?CID=HPRBBannerA" target="_blank">Jameco</a> and <a href="http://makezine.com/robotbuild/" target="_blank">Make Zine</a> are holding a contest to build a &#8220;CoasterBot,&#8221; a mini robot development platform using CD/DVD media as the main body components. I signed up, and this will be my first post documenting my progress. I have my chassis ready so far, and plan to use my Arduino.</p>
<p>In the Make: Robot build newsletter #3, <a href="http://kurtsrobotbuild.blogspot.com/" target="_blank">Kurt Meredith</a> was mentioned for his idea of thermoforming a CD. After viewing his blog, it gave me the idea to try using a hot air gun to bend the CD for my robot chassis.</p>
<p><img class="alignleft size-medium wp-image-463" title="Hot Air bending a CD" src="http://arduinofun.com/blog/wp-content/uploads/2010/04/100_2160-300x225.jpg" alt="Hot Air bending a CD" width="300" height="225" />I had two different CD&#8217;s, one was a TDK that had gold paint on it. This one folded over nicely, but the paint is now peeling on it. The other was some no name brand with no paint. Once I heated it up, it folded over but I could also hear some cracking. I broke a corner, but was able to fit it back by melting the two pieces together. Once I had both CDs folded the way I wanted them, I used some strong glue and stuck them together so that I had two sides to mount my servos to.</p>
<p><img class="alignleft size-medium wp-image-465" title="CoasterBot chassis" src="http://arduinofun.com/blog/wp-content/uploads/2010/04/100_2173-300x225.jpg" alt="CoasterBot chassis" width="300" height="225" />After the glue was dry, I was not happy with the rounded front and back, so took a Dremel to them and squared it off. The chassis seems fairly sturdy but I don&#8217;t think it would hold much weight without cracking my bends. I ran a bead of glue on the underside to help with this (I hope). I should have measured where I was going to place the servos and drilled those out first, but I wasn&#8217;t thinking that far ahead <img src='http://arduinofun.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>What I wound up doing was taking an old soldering iron, drawing out my holes and servo mounting areas and then burning them away. It worked, but it is kind of ugly. I was able to file down a lot of the areas so they were fairly smooth.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2010%2F04%2F01%2Fcoasterbot-part-i%2F&amp;linkname=CoasterBot%20Part%20I"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2010/04/01/coasterbot-part-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Shapeways.com adds $50.00 Coupon for Arduino Fun Contest</title>
		<link>http://arduinofun.com/blog/2009/11/18/shapeways-com-adds-50-00-coupon-for-arduino-fun-contest/</link>
		<comments>http://arduinofun.com/blog/2009/11/18/shapeways-com-adds-50-00-coupon-for-arduino-fun-contest/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:14:36 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[ArduinoFun News]]></category>
		<category><![CDATA[3D printing]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Contest]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Tutorial]]></category>
		<category><![CDATA[Shapeways]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=283</guid>
		<description><![CDATA[ShapeWays.com has added a $50.00 Coupon to the ArduinoFun &#8211; Build It- contest! Have you ever wanted to turn your 3D designs into reality? Enter Shapeways! Just upload your design, we print it and ship it to you &#8211; it&#8217;s easy. Within ten working days you&#8217;ll hold your own design in your hands.
But that&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_284" class="wp-caption alignleft" style="width: 226px"><a href="http://www.shapeways.com"><img class="size-full wp-image-284" title="ShapeWays.com" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sw.jpg" alt="ShapeWays.com" width="216" height="52" /></a><p class="wp-caption-text">ShapeWays.com</p></div>
<p><a href="http://www.shapeways.com">ShapeWays.com</a> has added a $50.00 Coupon to the <a href="http://arduinofun.com/blog/2009/11/01/fun-with-arduino-contest/">ArduinoFun &#8211; Build It- contest</a>! Have you ever wanted to turn your 3D designs into reality? Enter Shapeways! Just upload your design, we print it and ship it to you &#8211; it&#8217;s easy. Within ten working days you&#8217;ll hold your own design in your hands.</p>
<p>But that&#8217;s not all &#8211; we&#8217;re offering you everything you need to meet fellow Shapeways users, share your work and find inspiration.</p>
<p>We&#8217;re using a technique called &#8216;3D Printing&#8217; which has proven itself as a high-quality production technique, but up to now has always been very expensive. By creating a large community we are able to produce much cheaper, meaning better prices for you.</p>
<p><a href="http://arduinofun.com/blog/2009/11/01/fun-with-arduino-contest/">Enter your Arduino project today!</a></p>
<p><strong>Prizes: </strong></p>
<ul>
<li>1st place winner will receive an <a href="http://arduino.cc/en/Main/ArduinoBoardMega">Arduino Mega</a> and a $50.00 Coupon for <a href="http://www.shapeways.com/">ShapeWays.com</a></li>
<li>2nd place winner will receive an <a href="http://arduino.cc/en/Main/ArduinoBoardProMini">Arduino Pro Mini 328 – 3.3V/8MHz</a></li>
<li>3rd place winner will receive an <a href="http://wingshieldindustries.com/products/screwshield/">Arduino Screw Shield</a></li>
</ul>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F18%2Fshapeways-com-adds-50-00-coupon-for-arduino-fun-contest%2F&amp;linkname=Shapeways.com%20adds%20%2450.00%20Coupon%20for%20Arduino%20Fun%20Contest"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2009/11/18/shapeways-com-adds-50-00-coupon-for-arduino-fun-contest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secret Knock Detecting Door Lock (Build It)</title>
		<link>http://arduinofun.com/blog/2009/11/02/secret-knock-detecting-door-lock-build-it/</link>
		<comments>http://arduinofun.com/blog/2009/11/02/secret-knock-detecting-door-lock-build-it/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 00:36:51 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Contest Entries]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Projects]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[Arduino Tutorial]]></category>
		<category><![CDATA[H-Bridge]]></category>
		<category><![CDATA[Knock Sensor]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Piezo]]></category>
		<category><![CDATA[Sensor]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=234</guid>
		<description><![CDATA[Contest Entry by Steve Hoefer
How many times have you seen a secret hideout with a secret knock?  It&#8217;s a staple of cheesy dramas, Saturday afternoon movies, and tree houses throughout the world.
While working on another project I ran across the Arduino knock sensor tutorial.  Sensing a single knock is a great little project for learning [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_235" class="wp-caption alignleft" style="width: 326px"><img class="size-full wp-image-235" title="Side view" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/slk1.jpg" alt="Side view" width="316" height="239" /><p class="wp-caption-text">Side view</p></div>
<p><strong><a href="http://grathio.com/2009/11/secret-knock-detecting-door-lock.html">Contest Entry by <span><span>Steve Hoefer</span></span></a></strong></p>
<p>How many times have you seen a secret hideout with a secret knock?  It&#8217;s a staple of cheesy dramas, Saturday afternoon movies, and tree houses throughout the world.</p>
<p>While working on another project I ran across the <a href="http://www.arduino.cc/en/Tutorial/Knock">Arduino knock sensor tutorial</a>.  Sensing a single knock is a great little project for learning about microcontrollers, but what about sensing specific knocks?  <em>Seeeeecret </em>knocks?  And if we could detect a secret knock, shouldn&#8217;t it unlock a door?   If you can&#8217;t tell by looking this was cobbled together from spare stuff around the lab, it&#8217;s not much more than a piezo speaker, a tiny gear reduction motor, and an <a href="http://www.arduino.cc/">Arduino</a>. And PVC pipe.</p>
<p><span id="more-234"></span></p>
<p><strong>UPDATE: 12/31/09</strong> &#8211; Since this posting, Steve has updated the blog a bit, tweaked the code a bit and published a full Instructable.</p>
<p><a href="http://grathio.com/2009/11/secret-knock-detecting-door-lock.html">http://grathio.com/2009/11/secret-knock-detecting-door-lock.html</a></p>
<p><a href="http://www.instructables.com/id/Secret-Knock-Detecting-Door-Lock/">http://www.instructables.com/id/Secret-Knock-Detecting-Door-Lock/</a></p>
<p>**<strong>Disclaimer</strong>: This was built with stuff I had lying around the lab.  How about a video to explain:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="320" height="265" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/zE5PGeh2K9k&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="320" height="265" src="http://www.youtube.com/v/zE5PGeh2K9k&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>A microphone (okay, really a speaker) presses against the door and listens for knocks.  If it hears the right number of knocks in the right cadence it triggers the motor to turn the deadbolt and unlock the door.  If the sequence isn&#8217;t recognized, the system resets and listens for knocks again.</p>
<p>The default code is <a href="http://en.wikipedia.org/wiki/Shave_and_a_Haircut">Shave and a Hair Cut</a> but if that&#8217;s too obvious you can enter a new knock sequence by holding down the red button and knocking your new secret knock (up to 20 knocks).  The rhythm of your favorite song, Morse code, whatever!  The widget will play back your knock (by blinking the lights) so you can be sure it heard everything correctly.</p>
<p>The whole thing is attached to the door with suction cups</p>
<p>The components are simple, most of the work is done in the microcontroller.  The source code for the Arduino is available at the bottom of the page if you&#8217;re curious.</p>
<p><strong>How does it work?</strong></p>
<p>First it records the time between knocks.  If there is a long wait for a knock it stops listening and starts analyzing.</p>
<div id="attachment_236" class="wp-caption alignleft" style="width: 190px"><a href="http://grathio.com/assets_c/2009/10/knock_lock_circuit-256.html"><img class="size-full wp-image-236" title="Basic circuity" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/slk2.jpg" alt="Basic circuity" width="180" height="240" /></a><p class="wp-caption-text">Basic circuity</p></div>
<p>First it checks the number of knocks.  If that&#8217;s right, we go on to more vigorous authentication.   First it converts the absolute timing of the knocks to the rhythm of the knocks.  This lets us knock fast or slow and as long as we get the rhythm right it will unlock.  That way I can still unlock the door if I&#8217;m tired or full of caffeine.  After this it compares the timing with the secret key and if any individual knock is off by too much or the whole thing is off by a certain average amount the door stays locked.  If not, we trigger the motor to turn and the lock to unlock.  If the programming button is pressed it saves the rhythm information and then plays it back.</p>
<p>The detection is surprisingly accurate and can even be dialed up so it&#8217;s precise enough  to detect an individual person&#8217;s variation on a knock, similar to a Morse coder&#8217;s &#8216;<a href="http://books.google.com/books?id=k3XeGh9PXAYC&amp;lpg=PA677&amp;ots=PLV5LGJ712&amp;dq=code%20breaking%20world%20war%20II%20fist%20-first&amp;pg=PA677#v=onepage&amp;q=&amp;f=false">fist</a>&#8216;.  (Though when the verifying is this tight it also triggers false negatives which are annoying.)</p>
<p>To keep things simple (and it&#8217;s because it&#8217;s what I had available) a motor is attached to the deadbolt using two pieces of spring steel bolted across the D shaft of the motor so that the connection will slip when the lock turns as far as it can. A more precise (and probably durable) way to do it would be to use a servo to turn the lock or have a detector sense when the lock had reached its extent.  Or replace the dead bolt with a solenoid.  Or whatever else you can think of.</p>
<div id="attachment_237" class="wp-caption alignleft" style="width: 329px"><img class="size-full wp-image-237" title="Circuit fitting" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/slk3.jpg" alt="Circuit fitting" width="319" height="239" /><p class="wp-caption-text">Circuit fitting</p></div>
<p>The rest of the electronics are nothing special.  Its so simple that just adding feedback LEDs almost doubled the parts count.  The Arduino has a lot of unused potential on this project.</p>
<p>No proper schematic yet, but there&#8217;s a layout and parts list at the bottom of the page. Look for a fully documented <a href="http://www.instructables.com/">Instructable</a> soon.</p>
<p>With some extra electronics (an <a href="http://en.wikipedia.org/wiki/H-bridge">H-bridge</a>) it would be possible to have the door automatically lock as well as unlock. Other improvements or changes that someone could do:</p>
<ul>
<li>Adding a knob to adjust the sensitivity.</li>
<li>Building it into an actual door knocker.</li>
<li>Using a more economical microcontroller and enabling a sleep mode for better battery life.</li>
<li>Making the whole package small enough to fit inside the door.</li>
<li>Storing several knocks so several people can have their own private knocks.</li>
<li>Adding a real-time clock and using different knocks for different days of the week or times of day.</li>
<li>Listening for door bell presses rather than door knocks.</li>
<li>Adding a servo or solenoid powered knocker to provide feedback through the door.  It could then offer a challenge-response security where the door starts a knock sequence and the user has to finish it correctly.</li>
<li>Rather than listening for knocks, putting a photoresistor in the peep hole and detecting flashes of light from a pocket flashlight or simply by placing your hand over the peephole. Or an infrared receiver and use special key presses on a remote control.</li>
</ul>
<div id="attachment_241" class="wp-caption alignleft" style="width: 310px"><a href="http://grathio.com/assets_c/2009/10/knock_sensor_layout_and_parts_list-277.html"><img class="size-medium wp-image-241" title="Knock sensor layout" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/knock_sensor_layout-300x153.jpg" alt="Knock sensor layout (click for larger view)" width="300" height="153" /></a><p class="wp-caption-text">Knock sensor layout (click for larger view)</p></div>
<p>Do I have to point out that this is not a great security measure since overhearing a knock sequence is pretty trivial?  No.  But it&#8217;s fun to make and play with.</p>
<p><strong>Here&#8217;s my code:</strong> If you have trouble with cut and paste below you can <a href="http://grathio.com/assets/secret_knock_detector.pde">download the .pde file here</a>.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/* Detects patterns of knocks and triggers a motor to unlock</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">it if the pattern is correct.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">By Steve Hoefer http://grathio.com</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">Version 0.1.09.10.24</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Analog Pin 0: Piezo speaker (connected to ground with 1M pulldown resistor)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Digital Pin 2: Switch to enter a new code. &nbsp;Short this to enter programming mode.</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">Digital Pin 3: DC gear reduction motor attached to the lock. (Or a motor controller or</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">a solenoid or other unlocking mechanisim.)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Digital Pin 4: Green LED.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Digital Pin 5: Red LED.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Pin definitions</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> knockSensor = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Piezo sensor on pin 0.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> programSwitch = <span class="nu0">2</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// If this is high we program a new code.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> lockMotor = <span class="nu0">3</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Gear motor used to turn the lock.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> redLED = <span class="nu0">4</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Status LED</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">const</span> <span class="kw4">int</span> greenLED = <span class="nu0">5</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Status LED</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Tuning constants.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Could be made vars and hooked to potentiometers for soft configuration, etc.</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">const</span> <span class="kw4">int</span> threshold = <span class="nu0">4</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Minimum signal from the piezo to register as a knock</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> rejectValue = <span class="nu0">25</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// If an individual knock is off by this percentage of a knock we don&#8217;t unlock..</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> averageRejectValue = <span class="nu0">15</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// If the average timing of the knocks is off by this percent we don&#8217;t unlock.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> knockFadeTime = <span class="nu0">150</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// milliseconds we allow a knock to fade before we listen for another one. (Debounce timer.)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> lockTurnTime = <span class="nu0">450</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// milliseconds that we run the motor to get it to go a half turn.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> maximumKnocks = <span class="nu0">20</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Maximum number of knocks to listen for.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">const</span> <span class="kw4">int</span> knockComplete = <span class="nu0">1200</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Longest time to wait for a knock before we assume that it&#8217;s finished.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Variables.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> secretCode<span class="br0">&#91;</span>maximumKnocks<span class="br0">&#93;</span> = <span class="br0">&#123;</span><span class="nu0">50</span>, <span class="nu0">25</span>, <span class="nu0">25</span>, <span class="nu0">50</span>, <span class="nu0">100</span>, <span class="nu0">50</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">0</span><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Initial setup: &quot;Shave and a Hair Cut, two bits.&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> knockReadings<span class="br0">&#91;</span>maximumKnocks<span class="br0">&#93;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// When someone knocks this array fills with delays between knocks.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> knockSensorValue = <span class="nu0">0</span>; <span class="co1">// Last reading of the knock sensor.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> setup<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">pinMode<span class="br0">&#40;</span>knockSensor, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">pinMode<span class="br0">&#40;</span>lockMotor, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">pinMode<span class="br0">&#40;</span>redLED, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">pinMode<span class="br0">&#40;</span>greenLED, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">pinMode<span class="br0">&#40;</span>programSwitch, INPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">//Serial.begin(19200);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Uncomment the Serial.bla lines for debugging.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//Serial.println(&quot;Program start.&quot;); &nbsp;// This line too.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// Green LED on, everything is go.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> loop<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Listen for any knock at all.</span></div>
</li>
<li class="li2">
<div class="de2">knockSensorValue = analogRead<span class="br0">&#40;</span>knockSensor<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>knockSensorValue &gt;=threshold<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">listenToSecretKnock<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Records the timing of knocks.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> listenToSecretKnock<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//Serial.println(&quot;knock starting&quot;); &nbsp; &nbsp;// debug.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> i = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// First lets reset the listening array.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i=threshold<span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; <span class="co1">//got another knock&#8230;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//record the delay time.</span></div>
</li>
<li class="li1">
<div class="de1">now=millis<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">knockReadings<span class="br0">&#91;</span>currentKnockNumber<span class="br0">&#93;</span> = now-startTime;</div>
</li>
<li class="li2">
<div class="de2">currentKnockNumber ++; &nbsp; <span class="co1">//increment the counter</span></div>
</li>
<li class="li1">
<div class="de1">startTime=now;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// and reset our timer for the next knock</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay<span class="br0">&#40;</span>knockFadeTime<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// again, a little delay to let the knock decay.</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">now=millis<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//did we timeout or run out of knocks?</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> <span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>now-startTime &lt; knockComplete<span class="br0">&#41;</span> &amp;amp;&amp;amp; <span class="br0">&#40;</span>currentKnockNumber &lt; maximumKnocks<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//we&#8217;ve got our knock recorded, lets see if it&#8217;s valid</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>validateKnock<span class="br0">&#40;</span><span class="br0">&#41;</span> == <span class="kw2">true</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">triggerDoorUnlock<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//Serial.println(&quot;Secret knock failed.&quot;);</span></div>
</li>
<li class="li2">
<div class="de2">digitalWrite<span class="br0">&#40;</span>greenLED, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// We didn&#8217;t unlock, so blink the red LED as visual feedback.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i&lt;<span class="nu0">4</span>;i++<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; digitalWrite<span class="br0">&#40;</span>redLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; delay<span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; digitalWrite<span class="br0">&#40;</span>redLED, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; delay<span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Runs the motor (or whatever) to unlock the door.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> triggerDoorUnlock<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//Serial.println(&quot;Door unlocked!&quot;);</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">int</span> i=<span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// turn the motor on for a bit.</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>lockMotor, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// And the green LED too.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">delay <span class="br0">&#40;</span>lockTurnTime<span class="br0">&#41;</span>; &nbsp; <span class="co1">// Wait a bit.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>lockMotor, LOW<span class="br0">&#41;</span>; &nbsp;<span class="co1">// Turn the motor off.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Blink the green LED a few times for more visual feedback.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>; i &lt; <span class="nu0">5</span>; i++<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay<span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay<span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Sees if our knock matches the secret.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// returns true if it&#8217;s a good knock, false if it&#8217;s not.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// todo: break it into smaller functions for readability.</span></div>
</li>
<li class="li1">
<div class="de1">boolean validateKnock<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">int</span> i=<span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// simplest check first: Did we get the right number of knocks?</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> currentKnockCount = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> secretKnockCount = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">int</span> maxKnockInterval = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// We use this later to normalize the times.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">currentKnockCount++;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>secretCode<span class="br0">&#91;</span>i<span class="br0">&#93;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp;<span class="co1">//todo: precalculate this.</span></div>
</li>
<li class="li1">
<div class="de1">secretKnockCount++;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span> <span class="br0">&#40;</span>knockReadings<span class="br0">&#91;</span>i<span class="br0">&#93;</span> &gt; maxKnockInterval<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// collect normalization data while we&#8217;re looping.</span></div>
</li>
<li class="li1">
<div class="de1">maxKnockInterval = knockReadings<span class="br0">&#91;</span>i<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// If we&#8217;re recording a new knock, save the info and get out of here.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>digitalRead<span class="br0">&#40;</span>programSwitch<span class="br0">&#41;</span>==HIGH<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i&lt; maximumKnocks ; i++<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">digitalWrite<span class="br0">&#40;</span>redLED, LOW<span class="br0">&#41;</span>; <span class="co1">// only turn it on if there&#8217;s a delay</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>secretCode<span class="br0">&#91;</span>i<span class="br0">&#93;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">delay<span class="br0">&#40;</span> map<span class="br0">&#40;</span>secretCode<span class="br0">&#91;</span>i<span class="br0">&#93;</span>,<span class="nu0">0</span>, <span class="nu0">100</span>, <span class="nu0">0</span>, maxKnockInterval<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Expand the time back out to what it was. &nbsp;Roughly.</span></div>
</li>
<li class="li1">
<div class="de1">digitalWrite<span class="br0">&#40;</span>greenLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">digitalWrite<span class="br0">&#40;</span>redLED, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">delay<span class="br0">&#40;</span><span class="nu0">50</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="kw2">false</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">// We don&#8217;t unlock the door when we are recording a new knock.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>currentKnockCount != secretKnockCount<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="kw2">false</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* &nbsp;Now we compare the relative intervals of our knocks, not the absolute time between them.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">(ie: if you do the same pattern slow or fast it should still open the door.)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">This makes it less picky, which while making it less secure can also make it</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">less of a pain to use if you&#8217;re tempo is a little slow or fast.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> totaltimeDifferences=<span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> timeDiff=<span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i rejectValue<span class="br0">&#41;</span><span class="br0">&#123;</span> <span class="co1">// Individual value too far out of whack</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">return</span> <span class="kw2">false</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">totaltimeDifferences += timeDiff;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// It can also fail if the whole thing is too inaccurate.</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span> <span class="br0">&#40;</span>totaltimeDifferences/secretKnockCount&gt;averageRejectValue<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="kw2">false</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="kw2">true</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F02%2Fsecret-knock-detecting-door-lock-build-it%2F&amp;linkname=Secret%20Knock%20Detecting%20Door%20Lock%20%28Build%20It%29"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2009/11/02/secret-knock-detecting-door-lock-build-it/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Silly String Shooting Spider (Build It)</title>
		<link>http://arduinofun.com/blog/2009/11/01/silly-string-shooting-spider-contest-entry/</link>
		<comments>http://arduinofun.com/blog/2009/11/01/silly-string-shooting-spider-contest-entry/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 00:43:22 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Contest Entries]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Duemilanove]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[ATmega328]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Parallax Ping Sonar]]></category>
		<category><![CDATA[Relay]]></category>
		<category><![CDATA[Sensor]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=215</guid>
		<description><![CDATA[Contest Entry by Todd Harrison
I had great fun this Halloween with a silly string shooting spider!  My plan was to use an Arduino micro-controller developer board to control my son’s “Teenage Mutant Ninja Turtle” RC car that already shoots silly string.  I didn’t get the spider to actually squirt the silly string but when you’re looking at [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_216" class="wp-caption alignleft" style="width: 330px"><strong><a><img class="size-full wp-image-216" title="Silly String Spider" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sillyspider.jpg" alt="Silly String Spider" width="320" height="239" /></a></strong><p class="wp-caption-text">Silly String Spider</p></div>
<p><strong><a href="http://www.toddfun.com/2009/10/31/silly-string-shooting-halloween-spider/">Contest Entry by Todd Harrison</a></strong></p>
<p>I had great fun this Halloween with a silly string shooting spider!  My plan was to use an Arduino micro-controller developer board to control my son’s “<a href="http://www.amazon.com/Playmates-Teenage-Mutant-Turtles-Spewer/dp/B0007SMKK8" target="_blank">Teenage Mutant Ninja Turtle</a>” RC car that already shoots silly string.  I didn’t get the spider to actually squirt the silly string but when you’re looking at a big black spider and something shoots silly string at you from the same direction it scares you just the same.</p>
<p>I was inspired to do this 4 hour marathon build by a blog posting by Eric on <a title="www.Instructables.com" href="http://www.instructables.com/id/Arduino-controlled-Silly-String-shooter/" target="_blank">www.Instructables.com</a>. Eric created a silly string shooting pumpkin which was so incredible I just had to build a spider for Halloween that did the same.<span id="more-215"></span></p>
<p>My major problem was that once I heard about Eric’s pumpkin I only had a day to get the supplies and about 4 hours of free time to wire-up something, code it and get it out in the front yard before the kids started coming for tricks or treats.</p>
<p><strong>Here is a component breakdown of the final prop.</strong></p>
<ul>
<li>The red dot and arrow point      to the <a href="http://www.amazon.com/Playmates-Teenage-Mutant-Turtles-Spewer/dp/B0007SMKK8" target="_blank">RC car </a>hiding under      a bush.</li>
<li>2) <a href="http://www.amazon.com/Playmates-Teenage-Mutant-Turtles-Spewer/dp/B0007SMKK8" target="_blank">RC car</a> remote      control.</li>
<li>3) <a href="http://www.radioshack.com/product/index.jsp?productId=2062478" target="_blank">Relay</a> used by pin 2      on the Arduino to fire the remote control’s silly string button.</li>
<li>4) <a href="http://www.arduino.cc/" target="_blank">Arduino</a> board: <a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove" target="_blank">Duemilanove with ATmega328</a> Purchased      from <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=17&amp;products_id=50" target="_blank">adafruit.com</a></li>
<li>5) Small blue servo to yank      on the spiders leg: <a href="http://www.hobbypartz.com/kahaoubrmo11.html" target="_blank">TowerPro SG-50</a>.</li>
<li>6) Two red LEDs for spider      eyes. Not on the spider I know, I ran out of dev time</li>
<li>7) <a href="http://www.makershed.com/ProductDetails.asp?ProductCode=MKPX5" target="_blank">Parallax Ping)))</a> sonar sensor, held up with helping hands.</li>
<li>8 ) Big black spider</li>
</ul>
<div id="attachment_217" class="wp-caption alignleft" style="width: 330px"><img class="size-full wp-image-217" title="Silly String Spider Parts" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sillyspider2.jpg" alt="Silly String Spider Parts" width="320" height="239" /><p class="wp-caption-text">Silly String Spider Parts</p></div>
<p>I originally wanted the string to shoot from the spider’s behind but I really didn’t have time for that so I hid the RC car in the bushes behind the spider and loaded it with a fresh can of silly string.  All I really had to do was get the Arduino to sense somebody getting to close to the spider’s face and then “POW!” fire the silly string using the car’s remote control.</p>
<p>Just for extra effect I wanted the spider to move using a servo and have red LED eyes that blinked.  I also wanted the blinking and servo movement to ramp up faster and faster as a person got closer. To get this effect I used a <a href="http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/Level/a/ProductID/92/Default.aspx?SortField=ProductName,ProductName" target="_blank">Parallax</a> Ping))) sonar sensor to track the approaching prey as well as to calculate an agitation delay.  The agitation delay was used to make the spider look more and more upset as the person got closer. If somebody was at a great distance the LED eyes flashed slow and the spider made slow jerking motions, but as the distance delay multiplier shortened the eyes flash furiously fast and the spider would jerk like mad!  If the trick-or-treater dared get closer the Arduino would fire a relay connected to the remote control and they would get a face full of silly string.</p>
<div id="attachment_221" class="wp-caption alignleft" style="width: 330px"><img class="size-full wp-image-221" title="Silly String Spider Board Control" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/ssboard.jpg" alt="Silly String Spider Board Control" width="320" height="239" /><p class="wp-caption-text">Silly String Spider Board Control</p></div>
<p>A lot of people did have the nerve to walk up on the spider but in the dark it took them a second to even realize they had just been doused in the face with silly string, but then they would laugh and do it again just for fun.  It only really scared a few that didn’t expect anything or were just standing behind the intended victim who was fortunately to short to get hit.</p>
<p>I didn’t get time to mount the eyes in the spider’s head but the red flashing LEDs on the control board seemed to have the same effect as they would have had if they were on the spider.  They were only needed to get the kids attention in the dark.</p>
<p><strong>Arduino Sketch:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#include</span></div>
</li>
<li class="li1">
<div class="de1">Servo myservo; &nbsp;<span class="co1">// create servo object to control a servo</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> pingPin = <span class="nu0">7</span>; <span class="co1">// pin for ping sensor</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">int</span> stringPin = <span class="nu0">2</span>; <span class="co1">// pin that will fire the silly string remote</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> LED_Eyes_Pin = <span class="nu0">11</span>; <span class="co1">// pin for the two eyes</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> multiplier; <span class="co1">// multiplier for delay</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> delay_time; <span class="co1">// time to delay before next step</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw4">void</span> setup<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; pinMode<span class="br0">&#40;</span>LED_Eyes_Pin, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; pinMode<span class="br0">&#40;</span>stringPin, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; myservo.<span class="me1">attach</span><span class="br0">&#40;</span><span class="nu0">9</span><span class="br0">&#41;</span>; &nbsp;<span class="co1">// attaches the servo on pin 9 to the servo object</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; Serial.<span class="me1">begin</span><span class="br0">&#40;</span><span class="nu0">9600</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; digitalWrite<span class="br0">&#40;</span>stringPin, LOW<span class="br0">&#41;</span>; &nbsp; &nbsp;<span class="co1">//make sure this is off so we don’t shoot string</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> loop<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; ping<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; eyes_and_servo<span class="br0">&#40;</span><span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; delay<span class="br0">&#40;</span>delay_time<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; ping<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; eyes_and_servo<span class="br0">&#40;</span><span class="nu0">100</span>,<span class="nu0">255</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; delay<span class="br0">&#40;</span>delay_time<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> eyes_and_servo<span class="br0">&#40;</span><span class="kw4">int</span> servo_pos, <span class="kw4">int</span> eye_pulse<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; analogWrite<span class="br0">&#40;</span>LED_Eyes_Pin, eye_pulse<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; myservo.<span class="me1">write</span><span class="br0">&#40;</span>servo_pos<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> ping<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span> &nbsp;<span class="kw4">long</span> duration, inches;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// We give a short LOW pulse beforehand to ensure a clean HIGH pulse.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; pinMode<span class="br0">&#40;</span>pingPin, OUTPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; digitalWrite<span class="br0">&#40;</span>pingPin, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; delayMicroseconds<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; digitalWrite<span class="br0">&#40;</span>pingPin, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; delayMicroseconds<span class="br0">&#40;</span><span class="nu0">5</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; digitalWrite<span class="br0">&#40;</span>pingPin, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// The same pin is used to read the signal from the PING))): a HIGH</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// pulse whose duration is the time (in microseconds) from the sending</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// of the ping to the reception of its echo off of an object.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; pinMode<span class="br0">&#40;</span>pingPin, INPUT<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; duration = pulseIn<span class="br0">&#40;</span>pingPin, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// convert the time into a distance</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; inches = microsecondsToInches<span class="br0">&#40;</span>duration<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; multiplier = inches/<span class="nu0">10</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; delay_time = inches * multiplier;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>delay_time &gt; <span class="nu0">1000</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>delay_time = <span class="nu0">500</span>;<span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>delay_time &lt; <span class="nu0">300</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp;digitalWrite<span class="br0">&#40;</span>stringPin, HIGH<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;delay<span class="br0">&#40;</span><span class="nu0">500</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;digitalWrite<span class="br0">&#40;</span>stringPin, LOW<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;delay<span class="br0">&#40;</span><span class="nu0">2000</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; Serial.<span class="me1">print</span><span class="br0">&#40;</span>delay_time<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; Serial.<span class="me1">print</span><span class="br0">&#40;</span>” delay time; inches are= “<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; Serial.<span class="me1">print</span><span class="br0">&#40;</span>inches<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; Serial.<span class="me1">println</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">long</span> microsecondsToInches<span class="br0">&#40;</span><span class="kw4">long</span> microseconds<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> microseconds / <span class="nu0">74</span> / <span class="nu0">2</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p><strong>Project Videos</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="320" height="240" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/nG1tazzDkAU&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="320" height="240" src="http://www.youtube.com/v/nG1tazzDkAU&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="320" height="240" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/HOJeZQfNOQI&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="320" height="240" src="http://www.youtube.com/v/HOJeZQfNOQI&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F01%2Fsilly-string-shooting-spider-contest-entry%2F&amp;linkname=Silly%20String%20Shooting%20Spider%20%28Build%20It%29"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2009/11/01/silly-string-shooting-spider-contest-entry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino Halloween Dropping Spider (Build It)</title>
		<link>http://arduinofun.com/blog/2009/11/01/arduino-halloween-dropping-spider-contest-entry/</link>
		<comments>http://arduinofun.com/blog/2009/11/01/arduino-halloween-dropping-spider-contest-entry/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 20:32:34 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Contest Entries]]></category>
		<category><![CDATA[Adafruit Protoshield]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Duemilanove]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[Arduino Twitter]]></category>
		<category><![CDATA[Futaba Servos]]></category>
		<category><![CDATA[ioBridge Monitor]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Parallax]]></category>
		<category><![CDATA[PIR Motion Sensor]]></category>
		<category><![CDATA[Servo]]></category>
		<category><![CDATA[Wireless Webcam]]></category>
		<category><![CDATA[X10 Firecracker]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=196</guid>
		<description><![CDATA[ 
Contest Entry by Noel Portugal
My Halloween project consisted of a dropping spider triggered by a PIR motion sensor mounted on a Jackolantern. The motion sensor triggered a dropping spider, lights, sounds, low laying fog and finally a tweet with a picture attached. 
Setup: It&#8217;s all pretty basic. The arduino controlled the PIR motion sensor, the servos [...]]]></description>
			<content:encoded><![CDATA[<p><strong> </strong></p>
<div id="attachment_206" class="wp-caption alignleft" style="width: 330px"><strong><strong><img class="size-full wp-image-206" title="Halloween Dropping Spider" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/DSC_0171.JPG" alt="Halloween Dropping Spider" width="320" height="214" /></strong></strong><p class="wp-caption-text">Halloween Dropping Spider</p></div>
<p><strong>Contest Entry by <a href="http://noelportugal.blogspot.com/2009/11/halloween-dropping-spider-jackolantern.html">Noel Portugal</a></strong></p>
<p>My Halloween project consisted of a dropping spider triggered by a PIR motion sensor mounted on a Jackolantern. The motion sensor triggered a dropping spider, lights, sounds, low laying fog and finally a <a href="http://twitter.com/ioalerts">tweet</a> with a picture attached.<strong> </strong></p>
<p><strong>Setup</strong>: It&#8217;s all pretty basic. The arduino controlled the PIR motion sensor, the servos for dropping spider reel, Jackolantern LED lights, toy with scary sound, and the X10 CM17A. Then the arduino sent a serial message to the ioBridge serial API telling to GET the URL of my site. Then on my site I had a bash script with a while loop looking for request coming from the ioBridge server, then the script played a sound, grab the picture from a wireless webcam and post it to twitter via twitpic&#8217;s API using cURL.<span id="more-196"></span></p>
<p><strong> </strong></p>
<div id="attachment_197" class="wp-caption alignleft" style="width: 330px"><strong><strong><img class="size-full wp-image-197" title="Arduino Halloween Dropping Spider" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/DSC_0187.JPG" alt="Arduino Halloween Dropping Spider" width="320" height="214" /></strong></strong><p class="wp-caption-text">Arduino Halloween Dropping Spider</p></div>
<p><strong>Arduino Sketch</strong><br />
<a href="http://noelportugal.googlepages.com/DroppingSpider.pde">Here is the arduino sketch</a>. I used the X10Firecracker and the Servo libraries as well as the PIR sensor example from the <a href="http://www.arduino.cc/playground/Code/PIRsense">arduino playground</a>.</p>
<p><strong>Spider Reel</strong><br />
I end up using an VHS tape as a reel. I had to modify one servo to have continuous rotation. I used <a href="http://www.kronosrobotics.com/an116/GAN116.shtml">this guide</a> to do so. The second servo just did the lift part.</p>
<p><strong>ioBridge Monitor</strong><br />
To establish the arduino-ioBridge serial communication I was planning to use an RF solution, but due to time constraints I had to use a long speaker cable to connect the arduino TX to ioBridge&#8217;s Serial Board RX with one wire and the second for GND.</p>
<p>This is the bash script I used to trigger a sound as well as send a twitpic.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#!/bin/bash</span></div>
</li>
<li class="li1">
<div class="de1">booCounter=$<span class="nu0">1</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="kw2">true</span>;do</div>
</li>
<li class="li1">
<div class="de1">status=`tail -n <span class="nu0">1</span> /private/var/log/apache2/access_log | cut -f <span class="nu0">1</span> -d <span class="st0">&quot;-&quot;</span>`</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;$status&quot;</span> = <span class="st0">&quot;00.00.000.000 &quot;</span> <span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">then</div>
</li>
<li class="li1">
<div class="de1">echo <span class="st0">&quot;Boo&quot;</span> &gt;&gt; /private/var/log/apache2/access_log</div>
</li>
<li class="li1">
<div class="de1">afplay /full/path/Halloween/werewolf.<span class="me1">mp3</span></div>
</li>
<li class="li1">
<div class="de1">msg=<span class="st0">&quot;Boo, victim $booCounter just got really scared&quot;</span></div>
</li>
<li class="li2">
<div class="de2">sleep <span class="nu0">5</span></div>
</li>
<li class="li1">
<div class="de1">curl -O http:<span class="co1">//www.mywebcam.com/IMAGE.JPG</span></div>
</li>
<li class="li1">
<div class="de1">curl -F media=@/full/path/Halloween/IMAGE.<span class="me1">JPG</span> -F <span class="st0">&quot;username=username&quot;</span> -F <span class="st0">&quot;password=password&quot;</span> -F</div>
</li>
<li class="li1">
<div class="de1"><span class="st0">&quot;message=$msg&quot;</span> http:<span class="co1">//twitpic.com/api/uploadAndPost</span></div>
</li>
<li class="li1">
<div class="de1">let booCounter=booCounter<span class="nu0">+1</span></div>
</li>
<li class="li2">
<div class="de2">fi</div>
</li>
<li class="li1">
<div class="de1">done</div>
</li>
</ol>
</div>
<p>I used my mac os x Apache 2 server. I had to give write permissions to the access_log so I could append a bogus line as a &#8220;break&#8221;.</p>
<p><strong>These are the parts that I used for this project:</strong></p>
<p><a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove">Arduino Duemilanove </a><br />
o <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;products_id=51">Adafruit Protoshield</a></p>
<p><a href="http://iobridge.com/">ioBridge IO-204</a><br />
o <a href="http://iobridge.com/store/">ioBridge Serial Smart Board</a></p>
<p>x10 Firecracker <a href="http://kbase.x10.com/wiki/Firecracker">CM17A</a><br />
o x10 Transeiver, Appliance and lamp modules</p>
<p>VHS tape<br />
o <a href="http://iobridge.com/store/">2 Futaba S3003 servos</a><br />
o Nylon rope</p>
<p>Plastic Jackolantern<br />
o <a href="http://www.radioshack.com/product/index.jsp?productId=2906724">Parallax PIR sensor</a><br />
o 2 red LEDs<br />
+ 2 1K resistors<br />
o <a href="http://www.target.com/Big-Time-Toys-Checklane-Yada/dp/B001F3EPQQ">Checklane Yada Yada Yada</a> (thanks Erick for the tip <a href="http://www.instructables.com/id/Arduino-controlled-Silly-String-shooter/">http://www.instructables.com/id/Arduino-controlled-Silly-String-shooter/</a>)<br />
+ 1 2N2222 tranisistor<br />
+ 1 10k resistor</p>
<p>Fog Machine<br />
o <a href="http://www.radioshack.com/product/index.jsp?productId=2049721">125VAC/10A DPDT Plug-In Relay</a> (as a switch combined with x10)<br />
o Styrofoam cooler and dryer hose and Ice to create low laying fog.</p>
<p>Wireless webcam<br />
Lights and accesories<br />
o Incandescent black light, strobe light, black light bulbs.</p>
<p><strong>Project Video:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="320" height="265" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ahfG8N8Z2YI&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="320" height="265" src="http://www.youtube.com/v/ahfG8N8Z2YI&amp;hl=en&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F01%2Farduino-halloween-dropping-spider-contest-entry%2F&amp;linkname=Arduino%20Halloween%20Dropping%20Spider%20%28Build%20It%29"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2009/11/01/arduino-halloween-dropping-spider-contest-entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Source ADM-Robot 1.0 (part 1)</title>
		<link>http://arduinofun.com/blog/2009/11/01/open-source-adm-robot-1-0-part-1/</link>
		<comments>http://arduinofun.com/blog/2009/11/01/open-source-adm-robot-1-0-part-1/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 18:37:13 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Project Files]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Project]]></category>
		<category><![CDATA[Arduino Robot]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[GridConnect]]></category>
		<category><![CDATA[Open Source Project]]></category>
		<category><![CDATA[Open Source Robot]]></category>
		<category><![CDATA[PCB]]></category>
		<category><![CDATA[Printed Circuit Board]]></category>
		<category><![CDATA[Recycling]]></category>
		<category><![CDATA[Robot]]></category>
		<category><![CDATA[Science Fair Projects]]></category>
		<category><![CDATA[WiFly]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=174</guid>
		<description><![CDATA[It&#8217;s that time of year again&#8230; where the sounds of knowledge fill the home labs, garages and basements across the globe. Here in the ArduinoFun lab, we have been busy working on this years project ADM-Robot 1.0 aka Recycle-bot.
I will be posting progress photos and notes as we go along to document the process for [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_175" class="wp-caption alignleft" style="width: 330px"><img class="size-full wp-image-175" title="Drew and Jacob - Soldering boards" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sf1.jpg" alt="Drew and Jacob - Soldering boards" width="320" height="240" /><p class="wp-caption-text">Drew and Jacob - Soldering boards</p></div>
<p>It&#8217;s that time of year again&#8230; where the sounds of knowledge fill the home labs, garages and basements across the globe. Here in the ArduinoFun lab, we have been busy working on this years project ADM-Robot 1.0 aka Recycle-bot.</p>
<p>I will be posting progress photos and notes as we go along to document the process for our science fair project.</p>
<p>What is ADM 1.0? Basically we built an Arduino, added a Dual Motor Controller to it and a small prototyping area. Hence the name ADM (Arduino Dual Motor).  The board works and is programmed just like a normal Arduino. For the science fair, part of the rules stated we could not use an actual Arduino board, but were able to build or modify our own.<span id="more-174"></span></p>
<div id="attachment_176" class="wp-caption alignleft" style="width: 330px"><img class="size-full wp-image-176" title="Shawn and Jacob - Drilling component holes" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sf2.jpg" alt="Shawn and Jacob - Drilling component holes" width="320" height="240" /><p class="wp-caption-text">Shawn and Jacob - Drilling component holes</p></div>
<p>Below is a zip file which contains the files that will allow you to create your own PCB file. According to Drew and Jacob, Recycle bot will be used in school to help drive interest in getting classmates to start recycling. &#8220;Having a cool robot moving around the lunch room to collect your recyclables will encourage everyone to participate because it is so cool!&#8221;</p>
<p>We will be using a metal trash can that we found at the store that just looks like it was meant to be a robot.</p>
<p>To make a copy of the PCB, you can follow the <a href="http://www.instructables.com/id/Creating-Printed-Circuit-Boards-with-a-INKJET-Prin/">Instructable that I created</a> that uses a home Inkjet printer. The entire process works really well and the boards have turned out great.</p>
<p><a href="http://arduinofun.com/files/adm1.zip"></a></p>
<div id="attachment_183" class="wp-caption alignleft" style="width: 330px"><a><img class="size-full wp-image-183" title="Drew and Jacob - Prototyping ADM 1.0" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/sf3.jpg" alt="Drew and Jacob - Prototyping ADM 1.0" width="320" height="240" /></a><p class="wp-caption-text">Drew and Jacob - Prototyping ADM 1.0</p></div>
<p><a href="http://arduinofun.com/files/adm1.zip">This zip file</a> contains two PDF files (solder side &amp; component side), for printing your own circuit board.</p>
<p>Once we get a little further along I will start posting some videos, photos and Arduino sketches that we use.</p>
<p>We are also working with <a href="http://www.gridconnect.com/wiflygsxkit.html">GridConnect</a> on a project, and hopefully if all goes well ADM will be enabled with WiFly</p>
<p>Board Photos on My <a href="http://www.flickr.com/photos/34908673@N00/">Flickr</a> Page.</p>
<p><a href="http://www.flickr.com/photos/34908673@N00/4067482659/">Component Side</a>, <a href="http://www.flickr.com/photos/34908673@N00/4068232404/">Solder Side</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F01%2Fopen-source-adm-robot-1-0-part-1%2F&amp;linkname=Open%20Source%20ADM-Robot%201.0%20%28part%201%29"><img src="http://arduinofun.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://arduinofun.com/blog/2009/11/01/open-source-adm-robot-1-0-part-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
