<?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 Robot</title>
	<atom:link href="http://arduinofun.com/blog/index.php/tag/arduino-robot/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>Herbert The Beginner&#8217;s Robot (Build It!)</title>
		<link>http://arduinofun.com/blog/2010/01/01/herbert-the-beginners-robot-build-it/</link>
		<comments>http://arduinofun.com/blog/2010/01/01/herbert-the-beginners-robot-build-it/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 14:55:36 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Contest Entries]]></category>
		<category><![CDATA[386 audio amplifier circuits]]></category>
		<category><![CDATA[555 timer]]></category>
		<category><![CDATA[Adafruit Minty Boost]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Robot]]></category>
		<category><![CDATA[Arduino Tutorial]]></category>
		<category><![CDATA[Darlington transistors]]></category>
		<category><![CDATA[micro-controller]]></category>
		<category><![CDATA[Parallax Ping Sonar]]></category>
		<category><![CDATA[Parallax Ping ultrasonic sensor]]></category>
		<category><![CDATA[Pololu Qik 2s9v1 Dual Serial Motor Controllers]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[Solarbotics GM13a 150:1 mini metal gear motors]]></category>
		<category><![CDATA[transistor circuit]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=388</guid>
		<description><![CDATA[Contest entry by Annie (note: was submitted within the deadline, I wasn&#8217;t able to add to the blog until today)
In September of 2009 I found myself in a learning mood.  Throughout my life I have been fascinated by everything: science, math, history&#8230;you name it, I love to know about it.  In September I decided I [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_389" class="wp-caption alignleft" style="width: 310px"><img class="size-medium wp-image-389" title="Lil Herbert" src="http://arduinofun.com/blog/wp-content/uploads/2010/01/LilHerbertCloseup_0001-300x225.jpg" alt="Lil Herbert - Beginner Robot" width="300" height="225" /><p class="wp-caption-text">Lil Herbert - Beginner Robot</p></div>
<p>Contest entry by <a href="http://www.youtube.com/profile?user=AnnieNakki#g/u">Annie</a> (note: was submitted within the deadline, I wasn&#8217;t able to add to the blog until today)</p>
<p>In September of 2009 I found myself in a learning mood.  Throughout my life I have been fascinated by everything: science, math, history&#8230;you name it, I love to know about it.  In September I decided I was going to brush up on my electronics knowledge and see where it would take me.  I had studied electronics at a tech school during the 90s and I&#8217;d grown up in Silicon Valley so I wasn&#8217;t completely new to the endeavor.  But upon graduation from the tech program I immediately began working on computer network support and Key System/PBX telephone system programming rather than the nitty gritty world of capacitors, resistors and ICs and found my understanding of it all both fading and lacking. <span id="more-388"></span></p>
<p>As I practiced building little 555 timer and 386 audio amplifier circuits, I soaked in as much information as I could from forums and online electronics articles.  It was then that I began hearing   about something called Arduino.  Arduino?  What, pray tell, is an Arduino?</p>
<p>A pizza, perhaps?  As in &#8220;I&#8217;ll have a large pepperoni and Arduino with extra cheese!&#8221;  No, that wasn&#8217;t it.  Arduino&#8230;hmmmm.</p>
<p>A new Italian sports car?  &#8220;The new 2010 Arduino Coupe, 0 to 60 in 200 microseconds&#8221; (Of course with a little disclaimer at the bottom explaining that the Arduino driver is a pro, so kiddies, don&#8217;t try this at home!).  Well, that wasn&#8217;t it either.</p>
<p>A quick search of Wikipedia and then Amazon was my road to Damascus. I had found a microcontroller that was cheap, extremely easy to learn, a massive open-source community to hold my hand as I dipped my pinky toe into the microcontroller waters, and a seemingly unending variety of applications and add-ons.  By October 9th I had my first Arduino.  A Duemilanove.  It was (and still is) a thing of beauty in my eyes.</p>
<p>After a week of the usual &#8220;Hello World&#8221; blinking LED type projects, I decided I needed a long term project to build upon and to hone my skills.  Thus, Herbert was born.</p>
<p>Herbert started out with a discussion I had with my mom.  I was thinking of  some goals to set to help me learn all of the different aspects of micro-controller use.  I wanted to learn to write code.  I wanted to continue my work designing and building circuits.  I wanted to practice my soldering skills.  A robot project was the answer!</p>
<p><strong>The goals for Herbert were these:</strong></p>
<ul>
<li>Start from scratch.  To really understand the workings of Herbert I needed to build him from the ground up, no ready-made kits.</li>
<li>Have the Arduino control his movement; he must start out with simple forward, backward and turning motions autonomously.</li>
<li>Add sensors to let Herbert see the world.  His first sensor is a Parallax Ping ultrasonic sensor, but eventually he will have many different types.</li>
<li>Through code of my own creation, have Herbert avoid collisions by turning, stopping or reversing.  I felt it was important for my educational development to create my own code rather than borrow someone else&#8217;s.  I have seen some fancy avoidance programming out there that I admire greatly.  But I knew if I didn&#8217;t start from scratch I would miss out on the joys of failure.</li>
</ul>
<p>Have Herbert be a long range project.  I decided that he could be open ended.  As I solve one set of obstacles, I can move on and add new features.  Someday Herbert will talk, tell me the weather, read me my email and play songs off my computer for me.  It&#8217;s all just one step at a time.</p>
<p style="text-align: left;"><strong>The Basics</strong></p>
<div id="attachment_391" class="wp-caption alignleft" style="width: 201px"><img class="size-full wp-image-391" title="Robot Chassis" src="http://arduinofun.com/blog/wp-content/uploads/2010/01/ss1.jpg" alt="Robot Chassis" width="191" height="177" /><p class="wp-caption-text">Robot Chassis</p></div>
<p>I started building in late October.  I received an early Christmas present in the form of 4 motors, 4 wheels and a chassis.  I decided to  focus on a pulse width modulation circuit design to control the  independent speed of each motor.  After much studying on the web,   I built a circuit with 4 Darlington transistors to control the current   through the motors with the Arduino pins controlling the current  through each motor.  In addition, I added 4 reversed biased diodes to      protect the Arduino pins from kick-back voltage.</p>
<div id="attachment_393" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-393" title="Schematic" src="http://arduinofun.com/blog/wp-content/uploads/2010/01/ss2-300x123.jpg" alt="Schematic" width="300" height="123" /><p class="wp-caption-text">Schematic</p></div>
<p>This circuit worked great for my first foray across the living room floor.  I could change the motor speed by changing the PWM in the Arduino sketch and soon I had Herbert zipping around scaring the dogs.  I decided it was time to give him some &#8216;eyes&#8217;.  While shopping for parts at Radio Shack one day I stumbled upon the Parallax Ping))) Sensor.  It is an ultrasonic sensor that was perfect for what I was doing.  With only a 5v, Gnd and Signal pin, I knew I could get it up and running with the Arduino!</p>
<p>I modified my code and put the signal for the Ping sensor on pin 9 of the Arduino.  I attached the 5v and Gnd of the sensor to the respective spots on the Duemilanove.  At this point I broke from my stated goal of always writing my own code.  The truth is, I had not the slightest idea how to write my own functions at this point, let alone libraries.  Luckily, the Arduino IDE saved the day!  In Files-Examples-Sensors there is a sketch for the Parallax Ping))) sensor.</p>
<p>After testing the sensor on a breadboard, I wired it up on Herbert.  I then took the important parts of the Ping))) sketch and added them to my current working sketch.  Herbert saw the light and was on the move!  I had him driving forward, detecting objects in front of him and turning to avoid them.  Granted, my code needed polishing but it was a start!</p>
<p>At this point my goal was to have Herbert move forward.  If he detected an obstacle he would stop and sweep his ping sensor to the left and take a measurement.  Then he would swing the sensor to the right and take another measurement.  He would then compare the two to decide which was a clearer path.  I wrote the sketch and it worked&#8230;.once.  Somehow I had run into my first major bug and I was at a loss to figure it out.  Herbert was acting strange, not responding correctly and dancing around like a madman.</p>
<p>With little time before the contest deadline and wanting Herbert to make an appearance, I decided the strange problem must&#8217;ve been something to do with the cheap wheel motors I had (they had been giving me problems now and again already) and so I quickly ordered  4 Solarbotics GM13a 150:1 mini metal gear motors and tires to match.  They are much smaller than the no-name motors I had been using, but they are quiet and nice!  Herbert became Lil&#8217; Herbert.</p>
<p>I rebuilt Herbert with the new motors and wheels and ran into the same strange behavior.  Obviously the motors weren&#8217;t the problem.  I&#8217;m sure I now know what it is, and I will experiment after the contest deadline to see if I am right.  I&#8217;ve been using an Adafruit Minty Boost to power the Arduino.  It&#8217;s a little circuit that converts the 3 volts from 2 AA batteries to 5 volts and sits in an Altoids tin on Herbert&#8217;s chassis.  I now believe that having the Arduino power the ping sensor, a sweeping servo and itself is just too much for the Minty Boost, causing strange things to happen.  But, as I was running out of time, I chose to forego the sweeping of the servo until after the deadline.</p>
<p>So, this is where we stand.  Or where Herbert rolls as it were.  I was still using my transistor circuit to power the motors and pinging to avoid collisions.  The main problem with this setup is that the motors&#8217; current could only go one way.  I was able to drive Herbert forward and turn him, but he couldn&#8217;t reverse or turn on a dime.  At this time I decided that I knew enough about my transistor circuit/motor setup that I could investigate motor controller boards.  I knew I could build H-Bridge circuits to allow the motors to drive either direction, but I felt the compact nature of some of the control boards I had been looking at would help me keep Herbert compact.</p>
<p>So into the picture came 2 Pololu Qik 2s9v1 Dual Serial Motor Controllers.  They are little, efficient and allowed me to have Herbert go forward or backwards.  I once again sacrificed my vow to write my own code and used a library specifically for these boards.  My only trouble was the code was written for one board only, and I had two.  I fumbled my way through making 2 instances of the library and all was well.</p>
<p>As I write this it is 3:30 PM on December 31, 2009.  I have reached the contest deadline and can do no more.  Herbert can currently sense obstacles in front of him and turn to avoid them.  He can move forward and backward.  Sadly, there was no time to resolve his neck sweep issues in time.  But as Herbert travels around the house in the coming months he will be doing more and doing it more efficiently.  I will keep adding new videos to my You Tube page and Herbert will continue to annoy my dogs.</p>
<p>I have included<a href="http://www.arduinofun.com/files/herbert.zip"> two versions of Herbert&#8217;s sketches in the zipped folder</a>.  One is from the early days of the transistor circuit, and the other is from this very day with the motor controllers.</p>
<p>Herbert&#8217;s videos can be seen on my You Tube channel.  The first one, Herbert is Born, was from November.  The most recent is Lil Herbert.</p>
<p>Videos: <a href="http://www.youtube.com/profile?user=AnnieNakki#g/u">http://www.youtube.com/profile?user=AnnieNakki#g/u</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2010%2F01%2F01%2Fherbert-the-beginners-robot-build-it%2F&amp;linkname=Herbert%20The%20Beginner%26%238217%3Bs%20Robot%20%28Build%20It%21%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/2010/01/01/herbert-the-beginners-robot-build-it/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Start Here Arduino Robot (Build It!)</title>
		<link>http://arduinofun.com/blog/2009/12/30/start-here-arduino-robot-build-it/</link>
		<comments>http://arduinofun.com/blog/2009/12/30/start-here-arduino-robot-build-it/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 18:19:34 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Contest Entries]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Code]]></category>
		<category><![CDATA[Arduino Robot]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[Infrared  Sensors]]></category>
		<category><![CDATA[L239D Motor Driver]]></category>
		<category><![CDATA[Micro Servos]]></category>
		<category><![CDATA[Start Here Robot]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=372</guid>
		<description><![CDATA[Contest entry by Dane Edmonds. This is my first robot using Arduino , it uses a l239d motor driver and is basically my attempt at making a &#8220;start here&#8221; robot.
This is my first time using Arduino so I decided to build a robot that would help me learn arduino&#8217;s code , I wanted to start [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_373" class="wp-caption alignleft" style="width: 330px"><img class="size-full wp-image-373" title="Arduino Start Here Robot" src="http://arduinofun.com/blog/wp-content/uploads/2009/12/bir1.jpg" alt="Arduino Start Here Robot" width="320" height="240" /><p class="wp-caption-text">Arduino Start Here Robot</p></div>
<p>Contest entry by <a href="http://letsmakerobots.com/user/4333">Dane Edmonds</a>. This is my first robot using Arduino , it uses a l239d motor driver and is basically my attempt at making a <a href="http://letsmakerobots.com/start">&#8220;start here&#8221; robot</a>.</p>
<p>This is my first time using Arduino so I decided to build a robot that would help me learn arduino&#8217;s code , I wanted to start small and build up to harder things so I made the robot expandable , as I get better with coding I will add more things .  So I hope other people who are new to arduino can learn from this robot to</p>
<blockquote><p>Dane says: Arduino has meant a cheap and easy to use micro controller, giving people a chance to achieve their goals and has helped make school holidays less boring for me .</p></blockquote>
<p><a href="http://www.youtube.com/watch?v=561TOfpcI_Y">YouTube Video Available Here.</a></p>
<p><span id="more-372"></span></p>
<p><strong>Parts list :</strong></p>
<ul>
<li>1) Arduino starter pack X1 <a href="http://www.robotgear.com.au/Product.aspx/Details/337">http://www.robotgear.com.au/Product.aspx/Details/337</a></li>
<li>2) Solarbotics g8 motors and wheels X2 <a href="http://www.robotgear.com.au/Product.aspx/Details/316">http://www.robotgear.com.au/Product.aspx/Details/316</a></li>
<li>3) motor mounts for the g8s <a href="http://www.robotgear.com.au/Product.aspx/Details/323">http://www.robotgear.com.au/Product.aspx/Details/323</a> (I didn&#8217;t use them but they would be better) X2</li>
<li>4) infrared sensors X2 <a href="http://www.robotgear.com.au/Product.aspx/Details/309">http://www.robotgear.com.au/Product.aspx/Details/309</a></li>
<li>5) breadboard (about the same size as Arduino )</li>
<li>6) micro servos X2</li>
<li>7) l293d motor controller <a href="http://www.robotgear.com.au/Product.aspx/Details/345">http://www.robotgear.com.au/Product.aspx/Details/345</a></li>
<li> <img src='http://arduinofun.com/blog/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> some header pins (cut into 3 and solder wires to each pin)</li>
</ul>
<p><strong>Things you can add : </strong></p>
<ul>
<li><a href="http://www.robotgear.com.au/Product.aspx/Details/286">http://www.robotgear.com.au/Product.aspx/Details/286</a></li>
<li><a href="http://www.robotgear.com.au/Product.aspx/Details/347">http://www.robotgear.com.au/Product.aspx/Details/347</a></li>
</ul>
<p><strong>Build It! instructions:</strong></p>
<ul>
<li>1) cut thin scrap wood (about 8 millimeters thick) in to 2 squares of 13.5 cm x 13.5 cm</li>
<li>2) in one of the squares cut hole the same size as your servo base , about 1cm from one of the edges .</li>
<li>3) paint desired colour</li>
<li>4) using a hot glue gun glue the motors in place (as shown in top picture), with some small screws ,screw in the Arduino to the breadboard will have adhesive tape on the back, peel of plastic and stick in place.</li>
<li>5) using this walk through set up your motor controller <a href="http://letsmakerobots.com/node/2074">http://letsmakerobots.com/node/2074</a></li>
<li>6) drill 2 holes in the back corners of the wood to fit your spacers and one above the Arduino (do the same for the 2nd piece of wood .</li>
<li>7) put your servo in place , and screw into wood</li>
<li> <img src='http://arduinofun.com/blog/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' />  made a pan/tilt system with a bit of scrap metal , (you can do the same if you wish but is not needed )</li>
<li>9) screw in your infrared sensers(as shown below) attach header pins (look on the sensor connect VIN and GND to the bread board power lines  and OUT to a digital pin on your arduino.</li>
</ul>
<p><strong>Arduino Sketch</strong></p>
<pre>const <span style="color: #CC6600;">int</span> infra=3; 

const <span style="color: #CC6600;">int</span> infra2=4;  

  <span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><strong>setup</strong></span>()

 {    

<span style="color: #CC6600;">Serial</span>.<span style="color: #CC6600;">begin</span>(9600);
<span style="color: #CC6600;">pinMode</span>(13,<span style="color: #006699;">OUTPUT</span>);
<span style="color: #CC6600;">pinMode</span>(12,<span style="color: #006699;">OUTPUT</span>);
<span style="color: #CC6600;">pinMode</span> (11,<span style="color: #006699;">OUTPUT</span>);
<span style="color: #CC6600;">pinMode</span> (10,<span style="color: #006699;">OUTPUT</span>);
<span style="color: #CC6600;">pinMode</span> (infra,<span style="color: #006699;">INPUT</span>);
<span style="color: #CC6600;">pinMode</span> (infra2,<span style="color: #006699;">INPUT</span>); 

} 

 <span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><strong>loop</strong></span>()    {
<span style="color: #CC6600;">if</span> (<span style="color: #CC6600;">digitalRead</span>(infra)== <span style="color: #006699;">HIGH</span>)
{         driveforward();   

   }        

<span style="color: #CC6600;">if</span>(<span style="color: #CC6600;">digitalRead</span>(infra) == <span style="color: #006699;">LOW</span>)   

{       

  stopmot();      

  <span style="color: #CC6600;">delay</span> (500);      

  reverse();      

  <span style="color: #CC6600;">delay</span> (500);       

 right();        

<span style="color: #CC6600;">delay</span> (2000);  

  }         

  <span style="color: #CC6600;">else</span> <span style="color: #CC6600;">if</span> (<span style="color: #CC6600;">digitalRead</span>(infra2)== <span style="color: #006699;">LOW</span>)   

   { stopmot();       

 <span style="color: #CC6600;">delay</span> (500);      

  reverse();     

   <span style="color: #CC6600;">delay</span> (500);       

 left();        

<span style="color: #CC6600;">delay</span> (2000);     

 }   

         }             

  <span style="color: #CC6600;">void</span> driveforward()

 {   <span style="color: #CC6600;">digitalWrite</span>(13,<span style="color: #006699;">HIGH</span>);   

<span style="color: #CC6600;">digitalWrite</span>(10,<span style="color: #006699;">HIGH</span>);  

 <span style="color: #CC6600;">digitalWrite</span> (11,<span style="color: #006699;">LOW</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (12,<span style="color: #006699;">LOW</span>);

 } 

 <span style="color: #CC6600;">void</span> stopmot()

 {    

<span style="color: #CC6600;">digitalWrite</span>(13,<span style="color: #006699;">LOW</span>);  

 <span style="color: #CC6600;">digitalWrite</span>(12,<span style="color: #006699;">LOW</span>);   

<span style="color: #CC6600;">digitalWrite</span>(11,<span style="color: #006699;">LOW</span>);  

 <span style="color: #CC6600;">digitalWrite</span>(10,<span style="color: #006699;">LOW</span>);

 } 

<span style="color: #CC6600;">void</span> reverse() 

{ 

  <span style="color: #CC6600;">digitalWrite</span>(12,<span style="color: #006699;">HIGH</span>);  

 <span style="color: #CC6600;">digitalWrite</span>(11,<span style="color: #006699;">HIGH</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (13,<span style="color: #006699;">LOW</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (10,<span style="color: #006699;">LOW</span>);

 } 

 <span style="color: #CC6600;">void</span> right()

 {   

<span style="color: #CC6600;">digitalWrite</span> (10,<span style="color: #006699;">HIGH</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (13,<span style="color: #006699;">LOW</span>);  

 <span style="color: #CC6600;">digitalWrite</span> (12,<span style="color: #006699;">LOW</span>);  

 <span style="color: #CC6600;">digitalWrite</span> (11,<span style="color: #006699;">LOW</span>);

 } 

 <span style="color: #CC6600;">void</span> left()

 {  

 <span style="color: #CC6600;">digitalWrite</span> (13,<span style="color: #006699;">HIGH</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (11,<span style="color: #006699;">LOW</span>);  

 <span style="color: #CC6600;">digitalWrite</span>  (12,<span style="color: #006699;">LOW</span>); 

  <span style="color: #CC6600;">digitalWrite</span> (10,<span style="color: #006699;">LOW</span>);

}</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F12%2F30%2Fstart-here-arduino-robot-build-it%2F&amp;linkname=Start%20Here%20Arduino%20Robot%20%28Build%20It%21%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/12/30/start-here-arduino-robot-build-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino Autonomous Robot</title>
		<link>http://arduinofun.com/blog/2009/11/25/arduino-autonomous-robot/</link>
		<comments>http://arduinofun.com/blog/2009/11/25/arduino-autonomous-robot/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 20:59:10 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Project Files]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Code]]></category>
		<category><![CDATA[Arduino Robot]]></category>
		<category><![CDATA[Arduino Sketch]]></category>
		<category><![CDATA[Autonomous Robot]]></category>
		<category><![CDATA[IR Sensor]]></category>
		<category><![CDATA[Parallax Ping Sonar]]></category>
		<category><![CDATA[Robot]]></category>
		<category><![CDATA[Sensor]]></category>
		<category><![CDATA[Sharp Sensor]]></category>

		<guid isPermaLink="false">http://arduinofun.com/blog/?p=275</guid>
		<description><![CDATA[This is a repost of a previous project. I am still working to get the older post back online from when we upgraded Wordpress.
The robot was basically built using a Parallax Boe Bot chassis. Rather than using the Basic Stamp we added an Arduino with a proto shield to control the robot functions.
You can use [...]]]></description>
			<content:encoded><![CDATA[<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="src" value="http://www.youtube.com/v/6J_eh1HPu54" /><param name="align" value="left" /><param name="vspace" value="5" /><param name="hspace" value="5" /><embed type="application/x-shockwave-flash" width="320" height="240" src="http://www.youtube.com/v/6J_eh1HPu54" hspace="5" vspace="5" align="left"></embed></object>This is a repost of a previous project. I am still working to get the older post back online from when we upgraded Wordpress.</p>
<p>The robot was basically built using a Parallax Boe Bot chassis. Rather than using the Basic Stamp we added an <a href="http://store.arduinofun.com/freeduino-usb-complete-kit-arduino-duemilanove-compatible.html">Arduino</a> with a <a href="http://store.arduinofun.com/freeduino-protoshield-kit-for-arduino.html">proto shield</a> to control the robot functions.</p>
<p>You can use any type of chassis for this project. The robot moves about using a ping sonar and <a href="http://store.arduinofun.com/infrared-proximity-sensor--sharp-gp2y0a2021.html">IR sensors</a> to avoid running into any objects. As you can see in the video, it was a bit thrown off by our kitten. We added additional items such as a wireless camera that sends audio/video back to our TV.<span id="more-275"></span>The original design for this was created by an Instructable&#8217;s member and can be <a href="http://www.instructables.com/id/BOB-V20/">found here</a>.</p>
<p><strong>Items you will need for this project:</strong></p>
<ul>
<li><a href="http://store.arduinofun.com/freeduino-usb-complete-kit-arduino-duemilanove-compatible.html">Arduino/Freeduino</a> or <a href="http://store.arduinofun.com/breadboard-arduino-kit.html">Breadboard Arduino</a></li>
<li>(3) <a href="http://store.arduinofun.com/infrared-sensor-jumper-wire--3pin-js3.html">3-Wire Sensor Cables</a></li>
<li><a href="http://store.arduinofun.com/breadboard-400-tie-po400.html">Breadboard</a> (small) or <a href="http://store.arduinofun.com/breadboard-840-tie-po840.html">Breadboard</a> (large)</li>
<li><a href="http://store.arduinofun.com/freeduino-protoshield-kit-for-arduino.html">Protoshield</a></li>
<li>(3) <a href="http://store.arduinofun.com/infrared-proximity-sensor--sharp-gp2y0a2021.html">Sharp IR Sensors</a></li>
<li><a href="http://store.arduinofun.com/5v-1a-switching-voltage-regulat51.html">5V 1A Switching voltage regulator</a></li>
<li><a href="http://store.arduinofun.com/wire-jumper-kit-for-breadboards.html">Various lengths of wire</a></li>
<li><a href="http://store.arduinofun.com/5mm-red-and-green-leds-pk-of510.html">LED</a></li>
<li><a href="http://store.arduinofun.com/220-ohm-resistor-pk-22010.html">220 Ohm resistor</a></li>
<li><a href="http://store.arduinofun.com/4-aa-battery-holde4.html">Optional &#8211; 4 AA Battery Holder</a></li>
<li>Piezo Speaker/Element</li>
<li>Parallax Ping))) Ultrasonic Rangefinder</li>
<li>(2) Parallax Continuous Rotation Servos</li>
<li>1 Parallax Standard Rotation Servos</li>
<li>9.6V Ni-Cd Rechargeable Battery (or any other 8-AA cell <a href="http://store.arduinofun.com/4-aa-battery-holde4.html">battery     pack</a>/any rechargeable battery pack above 9V)</li>
<li>Optional Method: <a href="http://store.arduinofun.com/dual-motor-breakout-board.html">Dual Motor Breakout</a> and <a href="http://store.arduinofun.com/12vdc-mabuchi-rs380ph-12380.html">2 DC Motors</a> (<a href="http://arduinofun.com/blog/2009/10/25/duel-motor-driver/">Tutorial Available Here</a>)</li>
</ul>
<div id="attachment_310" class="wp-caption alignleft" style="width: 330px"><a href="http://www.flickr.com/photos/34908673@N00/4133522899/sizes/l/"><img class="size-full wp-image-310" title="Arduino Autonomous Robot" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/lars1.jpg" alt="Arduino Autonomous Robot" width="320" height="240" /></a><p class="wp-caption-text">Arduino Autonomous Robot</p></div>
<p>The standard servo will be used to mount the Ping Rangefinder. This will give you a back and forth sweep motion as the robot travels around. The two continuous rotation servos are used for the wheels. You do not need to use the Parallax brand of servos, other brands will work. You may have to adjust the PWM values in the source code to go with the servos you are using.</p>
<p>It is also possible to use <a href="http://store.arduinofun.com/motors.html">DC motors</a> and edit the code, which would be considerably cheaper. You could use a SN754410 Quad Half H-Bridge to drive two DC motors. <a href="http://arduinofun.com/blog/2009/10/25/duel-motor-driver/">Tutorial for how to do this is available here</a>.</p>
<p>The Arduino hook up is pretty simple. You will have the following:</p>
<ul>
<li>Pin (Analog) 0: Left Sensor</li>
<li>Pin (Analog) 1: Center Sensor</li>
<li>Pin (Analog) 2: Right Sensor</li>
<li>Pin 5: Pan Servo</li>
<li>Pin 6: Left Drive Servo</li>
<li>Pin 7: Ultrasonic Rangefinder ( &#8216;Ping)))&#8217; )</li>
<li>Pin 9: Right Drive Servo</li>
<li>Pin 11: Piezo Speaker</li>
</ul>
<div id="attachment_313" class="wp-caption alignleft" style="width: 330px"><a href="http://www.flickr.com/photos/34908673@N00/4133522649/sizes/l/"><img class="size-full wp-image-313" title="Shield Close-up" src="http://arduinofun.com/blog/wp-content/uploads/2009/11/lars2.jpg" alt="Shield Close-up" width="320" height="240" /></a><p class="wp-caption-text">Shield Close-up</p></div>
<p>Radioshack sells an RC car battery as well as connector repair kit. You can solder the repair kit connector onto the shield, and then be able to hook up your battery to power the servos with. You can use a separate <a href="http://store.arduinofun.com/4-aa-battery-holde4.html">battery holder</a> to power the Arduino.</p>
<p>Make all your connections onto <a href="http://store.arduinofun.com/freeduino-protoshield-kit-for-arduino.html">the shield</a>. This way everything can remain in place if you need to use your Arduino for something else and save you from needing to tear apart everything.</p>
<p>for power to the shield, you won&#8217;t need any extra filter capacitors since the <a href="http://store.arduinofun.com/5v-1a-switching-voltage-regulat51.html">5V switching  regulator</a> has them built in. We used a small project box to hold the battery in place, and was able to attach the wireless camera on top of it.</p>
<p>The Arduino and camera are power source 1, while the servos and sensors are power source 2 (the RC battery). A small piece of PVC pipe mounted onto a cable clip will help you to keep your wires all organized to a central point and be less likely to get caught or tangled up into something as the robot is moving around.</p>
<p><strong>Arduino Sketch</strong></p>
<pre><span style="color: #7E7E7E;">// Begin Robot Code</span>
<span style="color: #CC6600;">int</span> micVal;
<span style="color: #CC6600;">int</span> cdsVal;
<span style="color: #CC6600;">int</span> irLval;  <span style="color: #7E7E7E;">// Left IR</span>
<span style="color: #CC6600;">int</span> irCval;  <span style="color: #7E7E7E;">// Center IR</span>
<span style="color: #CC6600;">int</span> irRval;  <span style="color: #7E7E7E;">// Right IR</span>

<span style="color: #CC6600;">int</span> i;   <span style="color: #7E7E7E;">// Generic Counter</span>
<span style="color: #CC6600;">int</span> x;  <span style="color: #7E7E7E;">// Generic Counter</span>
<span style="color: #CC6600;">int</span> PLval;  <span style="color: #7E7E7E;">// Pulse Width for Left Servo</span>
<span style="color: #CC6600;">int</span> PRval;  <span style="color: #7E7E7E;">// Pulse Width for Right Servo</span>
<span style="color: #CC6600;">int</span> cntr;  <span style="color: #7E7E7E;">// Generic Counter Used for Determining amt. of Object Detections</span>
<span style="color: #CC6600;">int</span> counter; <span style="color: #7E7E7E;">// Generic Counter</span>
<span style="color: #CC6600;">int</span> clrpth;  <span style="color: #7E7E7E;">// amt. of Milliseconds Of Unobstructed Path</span>
<span style="color: #CC6600;">int</span> objdet;  <span style="color: #7E7E7E;">// Time an Object was Detected</span>
<span style="color: #CC6600;">int</span> task;  <span style="color: #7E7E7E;">// Routine to Follow for Clearest Path</span>
<span style="color: #CC6600;">int</span> pwm;  <span style="color: #7E7E7E;">// Pulse Width for Pan Servo</span>
<span style="color: #CC6600;">boolean</span> add;  <span style="color: #7E7E7E;">// Whether to Increment or Decrement PW Value for Pan Servo</span>
<span style="color: #CC6600;">int</span> distance;  <span style="color: #7E7E7E;">// Distance to Object Detected via Ultrasonic Ranger</span>
<span style="color: #CC6600;">int</span> oldDistance;  <span style="color: #7E7E7E;">// Previous Distance Value Read from Ultrasonic Ranger</span>

<span style="color: #CC6600;">float</span> scale = 1.9866666666666666666666666666667;  <span style="color: #7E7E7E;">// *Not Currently Used*</span>

<span style="color: #CC6600;">int</span> LeftPin = 6;  <span style="color: #7E7E7E;">// Left Servo</span>
<span style="color: #CC6600;">int</span> RightPin = 9;  <span style="color: #7E7E7E;">// Right Servo</span>
<span style="color: #CC6600;">int</span> PiezoPin = 11;  <span style="color: #7E7E7E;">// Piezo</span>
<span style="color: #CC6600;">int</span> PingServoPin = 5;  <span style="color: #7E7E7E;">// Pan Servo</span>
<span style="color: #CC6600;">int</span> irLPin = 0;            <span style="color: #7E7E7E;">// Analog 0; Left IR</span>
<span style="color: #CC6600;">int</span> irCPin = 1;            <span style="color: #7E7E7E;">// Analog 1; Center IR</span>
<span style="color: #CC6600;">int</span> irRPin = 2;            <span style="color: #7E7E7E;">// Analog 2; Right IR</span>

<span style="color: #CC6600;">int</span> ultraSoundSignal = 7; <span style="color: #7E7E7E;">// Ultrasound signal pin</span>
<span style="color: #CC6600;">int</span> val = 0;              <span style="color: #7E7E7E;">// Used for Ultrasonic Ranger</span>
<span style="color: #CC6600;">int</span> ultrasoundValue = 0;  <span style="color: #7E7E7E;">// Raw Distance Val</span>
<span style="color: #CC6600;">int</span> oldUltrasoundValue;  <span style="color: #7E7E7E;">// *Not used*</span>
<span style="color: #CC6600;">int</span> pulseCount;        <span style="color: #7E7E7E;">// Generic Counter</span>
<span style="color: #CC6600;">int</span> timecount = 0; <span style="color: #7E7E7E;">// Echo counter</span>
<span style="color: #CC6600;">int</span> ledPin = 13; <span style="color: #7E7E7E;">// LED connected to digital pin 13</span>

#define BAUD 9600
#define CmConstant 1/29.034

<span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><strong>setup</strong></span>() {
  <span style="color: #CC6600;">Serial</span>.<span style="color: #CC6600;">begin</span>(9600);
  <span style="color: #CC6600;">pinMode</span>(PiezoPin, <span style="color: #006699;">OUTPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(ledPin, <span style="color: #006699;">OUTPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(LeftPin, <span style="color: #006699;">OUTPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(RightPin, <span style="color: #006699;">OUTPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(PingServoPin, <span style="color: #006699;">OUTPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(irLPin, <span style="color: #006699;">INPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(irCPin, <span style="color: #006699;">INPUT</span>);
  <span style="color: #CC6600;">pinMode</span>(irRPin, <span style="color: #006699;">INPUT</span>);
  <span style="color: #CC6600;">for</span>(i = 0; i &lt; 500; i++) {
    <span style="color: #CC6600;">digitalWrite</span>(PiezoPin, <span style="color: #006699;">HIGH</span>);
    <span style="color: #CC6600;">delayMicroseconds</span>(1000);
    <span style="color: #CC6600;">digitalWrite</span>(PiezoPin, <span style="color: #006699;">LOW</span>);
    <span style="color: #CC6600;">delayMicroseconds</span>(1000);
  }
  <span style="color: #CC6600;">for</span>(i = 0; i &lt; 20; i++) {
  <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">HIGH</span>);
  <span style="color: #CC6600;">delayMicroseconds</span>(655 * 2);
  <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">LOW</span>);
  <span style="color: #CC6600;">delay</span>(20);
  }
  ultrasoundValue = 600;
  i = 0;
}

<span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><strong>loop</strong></span>()
{
  <span style="color: #7E7E7E;">//Scan();</span>
  Look();
  Go();
}
<span style="color: #CC6600;">void</span> Look() {
  irLval = <span style="color: #CC6600;">analogRead</span>(irLPin);
  irCval = <span style="color: #CC6600;">analogRead</span>(irCPin);
  irRval = <span style="color: #CC6600;">analogRead</span>(irRPin);
  <span style="color: #7E7E7E;">//if(counter &gt; 10) {</span>
    <span style="color: #7E7E7E;">//counter = 0;</span>
    <span style="color: #7E7E7E;">//readPing();</span>
  <span style="color: #7E7E7E;">//}</span>
  <span style="color: #CC6600;">if</span>(irLval &gt; 200) {
    PLval = 850;
    PRval = 820;
    x = 5;
    cntr = cntr + 1;
    clrpth = 0;
    objdet = <span style="color: #CC6600;">millis</span>();
  }
  <span style="color: #CC6600;">else</span> <span style="color: #CC6600;">if</span>(irCval &gt; 200) {
    PLval = 850;
    PRval = 820;
    x = 10;
    cntr = cntr + 1;
    clrpth = 0;
    objdet = <span style="color: #CC6600;">millis</span>();
  }
  <span style="color: #CC6600;">else</span> <span style="color: #CC6600;">if</span>(irRval &gt; 200) {
    PLval = 650;
    PRval = 620;
    x = 5;
    cntr = cntr + 1;
    clrpth = 0;
    objdet = <span style="color: #CC6600;">millis</span>();
  }
  <span style="color: #CC6600;">else</span> {
    x = 1;
    PLval = 850;
    PRval = 620;
    counter = counter + 1;
    clrpth = (<span style="color: #CC6600;">millis</span>() - objdet);
    <span style="color: #CC6600;">if</span>(add == <span style="color: #CC6600;">true</span>) {
      pwm = pwm + 50;
    }
    <span style="color: #CC6600;">else</span> <span style="color: #CC6600;">if</span>(add == <span style="color: #CC6600;">false</span>) {
      pwm = pwm - 50;
    }
    <span style="color: #CC6600;">if</span>(pwm &lt; 400) {
      pwm = 400;
      add = <span style="color: #CC6600;">true</span>;
    }
    <span style="color: #CC6600;">if</span>(pwm &gt; 950) {
      pwm = 950;
      add = <span style="color: #CC6600;">false</span>;
    }
    <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">HIGH</span>);
    <span style="color: #CC6600;">delayMicroseconds</span>(pwm * 2);
    <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">LOW</span>);
    <span style="color: #CC6600;">delay</span>(20);
    readPing();
    <span style="color: #CC6600;">if</span>(ultrasoundValue &lt; 500) {
      cntr = cntr + 1;
      <span style="color: #CC6600;">switch</span>(pwm) {
        <span style="color: #CC6600;">case</span> 400:
          x = 7;
          PLval = 650;
          PRval = 650;
          Go();
          break;
        <span style="color: #CC6600;">case</span> 500:
          x = 10;
          PLval = 650;
          PRval = 650;
          Go();
          break;
        <span style="color: #CC6600;">case</span> 600:
          x = 14;
          PLval = 850;
          PRval = 850;
          Go();
          break;
        <span style="color: #CC6600;">case</span> 700:
          x = 10;
          PLval = 850;
          PRval = 850;
          Go();
          break;
        <span style="color: #CC6600;">case</span> 950:
          x = 7;
          PLval = 850;
          PRval = 850;
          Go();
          break;
      }
    }
  }
  <span style="color: #7E7E7E;">//Serial.print("clrpth: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(clrpth);</span>
  <span style="color: #7E7E7E;">//Serial.print("objdet: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(objdet);</span>
  <span style="color: #7E7E7E;">//Serial.print("cntr: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(cntr);</span>
  <span style="color: #CC6600;">if</span>(cntr &gt; 25 &amp;&amp; clrpth &lt; 2000) {
    clrpth = 0;
    cntr = 0;
    Scan();
  }
}
<span style="color: #CC6600;">void</span> Go() {
  <span style="color: #CC6600;">for</span>(i = 0; i &lt; x; i++) {
    <span style="color: #CC6600;">digitalWrite</span>(LeftPin, <span style="color: #006699;">HIGH</span>);
    <span style="color: #CC6600;">delayMicroseconds</span>(PLval * 2);
    <span style="color: #CC6600;">digitalWrite</span>(LeftPin, <span style="color: #006699;">LOW</span>);
    <span style="color: #CC6600;">digitalWrite</span>(RightPin, <span style="color: #006699;">HIGH</span>);
    <span style="color: #CC6600;">delayMicroseconds</span>(PRval * 2);
    <span style="color: #CC6600;">digitalWrite</span>(RightPin, <span style="color: #006699;">LOW</span>);
    <span style="color: #CC6600;">delay</span>(20);
  }
}
<span style="color: #CC6600;">void</span> readPing() {  <span style="color: #7E7E7E;">// Get Distance from Ultrasonic Ranger</span>
 timecount = 0;
 val = 0;
 <span style="color: #CC6600;">pinMode</span>(ultraSoundSignal, <span style="color: #006699;">OUTPUT</span>); <span style="color: #7E7E7E;">// Switch signalpin to output</span>

<span style="color: #7E7E7E;">/* Send low-high-low pulse to activate the trigger pulse of the sensor</span>
<span style="color: #7E7E7E;"> * -------------------------------------------------------------------</span>
<span style="color: #7E7E7E;"> */</span>

<span style="color: #CC6600;">digitalWrite</span>(ultraSoundSignal, <span style="color: #006699;">LOW</span>); <span style="color: #7E7E7E;">// Send low pulse</span>
<span style="color: #CC6600;">delayMicroseconds</span>(2); <span style="color: #7E7E7E;">// Wait for 2 microseconds</span>
<span style="color: #CC6600;">digitalWrite</span>(ultraSoundSignal, <span style="color: #006699;">HIGH</span>); <span style="color: #7E7E7E;">// Send high pulse</span>
<span style="color: #CC6600;">delayMicroseconds</span>(5); <span style="color: #7E7E7E;">// Wait for 5 microseconds</span>
<span style="color: #CC6600;">digitalWrite</span>(ultraSoundSignal, <span style="color: #006699;">LOW</span>); <span style="color: #7E7E7E;">// Holdoff</span>

<span style="color: #7E7E7E;">/* Listening for echo pulse</span>
<span style="color: #7E7E7E;"> * -------------------------------------------------------------------</span>
<span style="color: #7E7E7E;"> */</span>

<span style="color: #CC6600;">pinMode</span>(ultraSoundSignal, <span style="color: #006699;">INPUT</span>); <span style="color: #7E7E7E;">// Switch signalpin to input</span>
val = <span style="color: #CC6600;">digitalRead</span>(ultraSoundSignal); <span style="color: #7E7E7E;">// Append signal value to val</span>
<span style="color: #CC6600;">while</span>(val == <span style="color: #006699;">LOW</span>) { <span style="color: #7E7E7E;">// Loop until pin reads a high value</span>
  val = <span style="color: #CC6600;">digitalRead</span>(ultraSoundSignal);
}

<span style="color: #CC6600;">while</span>(val == <span style="color: #006699;">HIGH</span>) { <span style="color: #7E7E7E;">// Loop until pin reads a high value</span>
  val = <span style="color: #CC6600;">digitalRead</span>(ultraSoundSignal);
  timecount = timecount +1;            <span style="color: #7E7E7E;">// Count echo pulse time</span>
}

<span style="color: #7E7E7E;">/* Writing out values to the serial port</span>
<span style="color: #7E7E7E;"> * -------------------------------------------------------------------</span>
<span style="color: #7E7E7E;"> */</span>

ultrasoundValue = timecount; <span style="color: #7E7E7E;">// Append echo pulse time to ultrasoundValue</span>

<span style="color: #7E7E7E;">//serialWrite('A'); // Example identifier for the sensor</span>
<span style="color: #7E7E7E;">//printInteger(ultrasoundValue);</span>
<span style="color: #7E7E7E;">//serialWrite(10);</span>
<span style="color: #7E7E7E;">//serialWrite(13);</span>

<span style="color: #7E7E7E;">/* Lite up LED if any value is passed by the echo pulse</span>
<span style="color: #7E7E7E;"> * -------------------------------------------------------------------</span>
<span style="color: #7E7E7E;"> */</span>

<span style="color: #CC6600;">if</span>(timecount &gt; 0){
  <span style="color: #CC6600;">digitalWrite</span>(ledPin, <span style="color: #006699;">HIGH</span>);
}
} 
<span style="color: #CC6600;">void</span> Scan() {   <span style="color: #7E7E7E;">// Scan for the Clearest Path</span>
  oldDistance = 30;
  task = 0;
  <span style="color: #CC6600;">for</span>(i = 1; i &lt; 5; i++) {
    <span style="color: #CC6600;">switch</span>(i) {
      <span style="color: #CC6600;">case</span> 1:
        <span style="color: #7E7E7E;">//Serial.println("Pos. 1");</span>
        pwm = 1125;    <span style="color: #7E7E7E;">///  incr. by 100 from 1085</span>
        break;
      <span style="color: #CC6600;">case</span> 2:
        <span style="color: #7E7E7E;">//Serial.println("Pos. 2");</span>
        pwm = 850; <span style="color: #7E7E7E;">//// increased by 100 from 850</span>
        break;
      <span style="color: #CC6600;">case</span> 3:
        <span style="color: #7E7E7E;">//Serial.println("Pos. 3");</span>
        pwm = 400;
        break;
      <span style="color: #CC6600;">case</span> 4:
        <span style="color: #7E7E7E;">//Serial.println("Pos. 4");</span>
        pwm = 235;
        break;
    }
    <span style="color: #CC6600;">for</span>(pulseCount = 0; pulseCount &lt; 20; pulseCount++) {  <span style="color: #7E7E7E;">// Adjust Pan Servo and Read USR</span>
      <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">HIGH</span>);
      <span style="color: #CC6600;">delayMicroseconds</span>(pwm * 2);
      <span style="color: #CC6600;">digitalWrite</span>(PingServoPin, <span style="color: #006699;">LOW</span>);
      readPing();
      <span style="color: #CC6600;">delay</span>(20);
    }
    distance = ((<span style="color: #CC6600;">float</span>)ultrasoundValue * CmConstant);   <span style="color: #7E7E7E;">// Calculate Distance in Cm</span>
    <span style="color: #CC6600;">if</span>(distance &gt; oldDistance) {  <span style="color: #7E7E7E;">// If the Newest distance is longer, replace previous reading with it</span>
      oldDistance = distance;
      task = i;   <span style="color: #7E7E7E;">// Set task equal to Pan Servo Position</span>
    }
  }
  <span style="color: #7E7E7E;">//Serial.print("Task: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(task);</span>
  <span style="color: #7E7E7E;">//Serial.print("distance: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(distance);</span>
  <span style="color: #7E7E7E;">//Serial.print("oldDistance: ");</span>
  <span style="color: #7E7E7E;">//Serial.println(oldDistance);</span>
  distance = 50;  <span style="color: #7E7E7E;">// Prevents Scan from Looping</span>
  <span style="color: #CC6600;">switch</span>(task) {   <span style="color: #7E7E7E;">// Determine which task should be carried out</span>
    <span style="color: #CC6600;">case</span> 0:  <span style="color: #7E7E7E;">// Center was clearest</span>
      x = 28;
      PLval = (850);
      PRval = (850);
      Go();
      break;
    <span style="color: #CC6600;">case</span> 1:  <span style="color: #7E7E7E;">// 90 degrees Left was Clearest</span>
      x = 14;
      PLval = (650);
      PRval = (650);
      Go();
      break;
    <span style="color: #CC6600;">case</span> 2:  <span style="color: #7E7E7E;">// 45 degrees left</span>
      x = 7;
      PLval = (650);
      PRval = (650);
      Go();
      break;
    <span style="color: #CC6600;">case</span> 3:  <span style="color: #7E7E7E;">// 45 degrees right</span>
      x = 7;
      PLval = (850);
      PRval = (850);
      Go();
      break;
    <span style="color: #CC6600;">case</span> 4:  <span style="color: #7E7E7E;">// 90 degrees right</span>
      x = 14;
      PLval = (850);
      PRval = (850);
      Go();
      break;
  }
}

<span style="color: #7E7E7E;">// End Robot Code</span></pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Farduinofun.com%2Fblog%2F2009%2F11%2F25%2Farduino-autonomous-robot%2F&amp;linkname=Arduino%20Autonomous%20Robot"><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/25/arduino-autonomous-robot/feed/</wfw:commentRss>
		<slash:comments>3</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>
