Differences

This shows you the differences between two versions of the page.

Link to this comparison view

products:ardx:circ-04 [2012/09/07 01:05] (current)
Line 1: Line 1:
  
 +<html>
 +<div id="CIRC-head">
 +<div id="CIRC-100"><table height="100px" width="100px" valign="center"><tr><td><span class="headText"><center>CIRC<br>04</center></span></td></tr></table></div>
 +<div id="CIRC-465"><table height="100px" width="465px" valign="center"><tr><td><span class="subText"><center>.:A Single Servo:.<br>.:Servos:.</center></span></td></tr></table></div>
 +<div id="CIRC-100"><img src="http://www.ardx.org/src/circ/CIRC-04-square-100.jpg" width="100" height="100"></div>
 +</div>
 +<span class="familyName"><center>(ARDX)   .:Arduino Expermentation Kit:.   (ARDX)</center></span>
 +<div id="CIRC-whitespace"></div>
 +<div id="CIRC-body">
 +<div id="CIRC-whitespace"></div><br>
 +<div id="CIRC-whatweredoing">
 +<span class="titleText">What We're Doing</span><br>
 +<span class="regularText">Spinning a motor is good fun but when it comes to projects where motion control is required they tend to leave us wanting more. The answer? Hobby servos. They are mass produced, widely available and cost anything from a couple of dollars to hundreds. Inside is a small gearbox (to make the movement more powerful) and some electronics (to make it easier to control). A standard servo is positionable from 0 to 180 degrees. Positioning is controlled through a timed pulse, between 1.25 milliseconds (0 degrees) and 1.75 milliseconds (180 degrees) (1.5 milliseconds for 90 degrees). Timing varies between manufacturer. If the pulse is sent every 25-50 milliseconds the servo will run smoothly. One of the great features of the Arduino is it has a software library that allows you to control two servos (connected to pin 9 or 10) using a single line of code.</span>
 +</div><br>
 +<div id="CIRC-whitespace"></div><br>
 +<div id="CIRC-thecircuit">
 +<span class="titleText">The Circuit</span><br>
 +<div id="CIRC-thepartsSideSpacer">
 +</div>
 +        <div id="CIRC-theparts">
 +          <span class="smallTitleText">The Parts</span><br>
 +          <span class="regularText">
 +<table>
 +<tr>
 +<td>
 +<img src="http://www.oomlout.com/parts/CIRC-01-3dsheet-60.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +CIRC-04<br>Breadboard Sheet<br>x1
 +</span>
 +</td>
 +<td>
 +<img src="http://www.oomlout.com/parts/HEAD-02-60.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +2 Pin Header<br>x4
 +</span>
 +</td>
 +<td>
 +<img src="http://www.oomlout.com/parts/HEAD-03-60.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +3 Pin Header<br>x1
 +</span>
 +</td>
 +<td>
 +
 +<img src="http://www.oomlout.com/parts/WIRE-01-60.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +Wire
 +</span>
 +</td>
 +</tr>
 +
 +<tr>
 +<td>
 +<img src="http://www.oomlout.com/parts/SERV-04-60.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +Mini Servo<br>x1
 +</span>
 +</td>
 +<td>
 +<img src="http://www.oomlout.com/parts/BLANK.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +
 +</span>
 +</td>
 +<td>
 +<img src="http://www.oomlout.com/parts/BLANK.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +
 +</span>
 +</td>
 +<td>
 +
 +<img src="http://www.oomlout.com/parts/BLANK.png" width="60px" height="36px">
 +</td>
 +<td>
 +<span class="partsText">
 +
 +</span>
 +</td>
 +</tr>
 +</table>
 +</span>
 +        </div><br>
 +        <div id="CIRC-whitespace"></div><br>
 +        <div id="CIRC-thepartsSideSpacer"></div>
 +          <div id="CIRC-circuitBox">
 +            <div id="CIRC-schematic"><center><span class="smallTitleText">Schematic</span><span class="smallTitleText"><img src="http://www.ardx.org/src/circ/ARDX-SC-04-150.png"></span></center></div>
 + <br>
 + <div id="CIRC-smallwhitespace">&nbsp;</div><br>
 +            <div id="CIRC-resources">
 + <center><span class="smallTitleText">Resources</span><br><span class="smallMediumDarkText"><b>.:download:.</b><br>breadboard layout sheet<br><b><a href="http://ardx.org/BBLS04">http://ardx.org/BBLS04</a></b><br><br><b>.:view:.</b><br>assembly video <b><br><a href="http://ardx.org/VIDE04">http://ardx.org/VIDE04</a></b></span></center>
 +            </div>
 +          </div>
 +        <div id="CIRC-circuitPicture">
 +          <center>
 +            <img src="http://www.ardx.org/src/circ/CIRC04-3dexploded-445.png" width="445">
 +          </center>
 +        </div>
 +      </div><br>
 +      <div id="CIRC-whitespace">&nbsp;</div><br>
 +<div id="CIRC-thecode">
 +        <span class="titleText">Code</span> <span class="smallDarkText">(no need to type everything in just)</span><br>
 +        <span class="mediumDarkText">File &gt; Examples &gt; Servo &gt; Sweep<br>(example from the great arduino.cc site, check it out for other great ideas)</span><br>
 +        <span class="code">        <prew>//&nbsp;Sweep<br>
 +//&nbsp;by&nbsp;BARRAGAN&nbsp;<http://barraganstudio.com>&nbsp;<br>
 +<br>
 +#include&nbsp;&lt;Servo.h&gt;&nbsp;<br>
 +&nbsp;<br>
 +Servo&nbsp;myservo;&nbsp;&nbsp;//&nbsp;create&nbsp;servo&nbsp;object&nbsp;to&nbsp;control&nbsp;a&nbsp;servo&nbsp;<br>
 +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a&nbsp;maximum&nbsp;of&nbsp;eight&nbsp;servo&nbsp;objects&nbsp;can&nbsp;be&nbsp;created&nbsp;<br>
 +&nbsp;<br>
 +int&nbsp;pos&nbsp;=&nbsp;0;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;variable&nbsp;to&nbsp;store&nbsp;the&nbsp;servo&nbsp;position&nbsp;<br>
 +&nbsp;<br>
 +void&nbsp;setup()&nbsp;<br>
 +{&nbsp;<br>
 +&nbsp;&nbsp;myservo.attach(9);&nbsp;&nbsp;//&nbsp;attaches&nbsp;the&nbsp;servo&nbsp;on&nbsp;pin&nbsp;9&nbsp;to&nbsp;the&nbsp;servo&nbsp;object&nbsp;<br>
 +}&nbsp;<br>
 +&nbsp;<br>
 +&nbsp;<br>
 +void&nbsp;loop()&nbsp;<br>
 +{&nbsp;<br>
 +&nbsp;&nbsp;for(pos&nbsp;=&nbsp;0;&nbsp;pos&nbsp;<&nbsp;180;&nbsp;pos&nbsp;+=&nbsp;1)&nbsp;&nbsp;//&nbsp;goes&nbsp;from&nbsp;0&nbsp;degrees&nbsp;to&nbsp;180&nbsp;degrees&nbsp;<br>
 +&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;in&nbsp;steps&nbsp;of&nbsp;1&nbsp;degree&nbsp;<br>
 +&nbsp;&nbsp;&nbsp;&nbsp;myservo.write(pos);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;tell&nbsp;servo&nbsp;to&nbsp;go&nbsp;to&nbsp;position&nbsp;in&nbsp;variable&nbsp;'pos'&nbsp;<br>
 +&nbsp;&nbsp;&nbsp;&nbsp;delay(15);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;waits&nbsp;15ms&nbsp;for&nbsp;the&nbsp;servo&nbsp;to&nbsp;reach&nbsp;the&nbsp;position&nbsp;<br>
 +&nbsp;&nbsp;}&nbsp;<br>
 +&nbsp;&nbsp;for(pos&nbsp;=&nbsp;180;&nbsp;pos>=1;&nbsp;pos&#45;=1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;goes&nbsp;from&nbsp;180&nbsp;degrees&nbsp;to&nbsp;0&nbsp;degrees&nbsp;<br>
 +&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
 +&nbsp;&nbsp;&nbsp;&nbsp;myservo.write(pos);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;tell&nbsp;servo&nbsp;to&nbsp;go&nbsp;to&nbsp;position&nbsp;in&nbsp;variable&nbsp;'pos'&nbsp;<br>
 +&nbsp;&nbsp;&nbsp;&nbsp;delay(15);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;waits&nbsp;15ms&nbsp;for&nbsp;the&nbsp;servo&nbsp;to&nbsp;reach&nbsp;the&nbsp;position&nbsp;<br>
 +&nbsp;&nbsp;}&nbsp;<br>
 +}&nbsp;<br>
 +<br>
 +        </prew></span>
 +      </div>
 +      <div id="CIRC-whitespace">&nbsp;</div><br>
 +<div id="CIRC-notWorking">
 +        <span class="titleText">Not Working?</span> <span class="smallDarkText">(3 things to try)</span>
 + <br><div id="CIRC-smallwhitespace">&nbsp;</div><br>
 + <div>
 +        <div id="CIRC-thepartsSideSpacer">&nbsp;</div>
 +        <div id="CIRC-nw1"><center><span class="regularText"><b>Servo Not Twisting? </b></span><br><span class="regularText">Even with colored wires it is still shockingly easy to plug a servo in backwards. This might be the case.</span></center></div>
 +        <div id="CIRC-thepartsSideSpacer">&nbsp;</div>
 +        <div id="CIRC-nw2"><center><span class="regularText"><b>Still Not Working</b></span><br><span class="regularText">A mistake we made a time or two was simply forgetting to connect the power (red and brown wires) to +5 volts and ground.</span></center></div>
 +        <div id="CIRC-thepartsSideSpacer">&nbsp;</div>
 +        <div id="CIRC-nw3"><center><span class="regularText"><b>Fits and Starts</b></span><br><span class="regularText">If the servo begins moving then twitches, and there's a flashing light on your Arduino board, the power supply you are using is not quite up to the challenge. Using a fresh battery instead of USB should solve this problem.</span></center></div>
 +        <div id="CIRC-thepartsSideSpacer">&nbsp;</div>
 +</div></div>
 +<div id="CIRC-whitespace">&nbsp;</div><br>
 +<div id="CIRC-makingBetter">
 +<span class="titleText">Making it Better?</span><br>&nbsp;<br>
 +<span class="regularText"><b>Potentiometer Control:</b> <BR>We have yet to experiment with inputs but if you would like to read ahead, there is an example program File &gt; Library-Servo &gt; Knob. This uses a potentiometer (CIRC08) to control the servo. You can find instructions online here: <a href="http://ardx.org/KNOB ">http://ardx.org/KNOB </a><BR>&nbsp; <BR><b>Self Timing:</b> <BR>While it is easy to control a servo using the Arduino's included library sometimes it is fun to figure out how to program something yourself. Try it. We're controlling the pulse directly so you could use this method to control servos on any of the Arduino's 20 available pins (you need to highly optimize this code before doing that). <BR> <BR><span class="bigCode">&nbsp;&nbsp;int servoPin = 9; <BR>&nbsp; <BR>void setup(){ <BR>&nbsp;&nbsp;pinMode(servoPin,OUTPUT); <BR>} <BR>&nbsp; <BR>void loop() { <BR>&nbsp;&nbsp;int pulseTime = 2100; //(the number of microseconds  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//to pause for (1500 90 degrees  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 900 0 degrees 2100 180 degrees)  <BR>&nbsp;&nbsp;digitalWrite(servoPin, HIGH); <BR>&nbsp;&nbsp;delayMicroseconds(pulseTime); <BR>&nbsp;&nbsp;digitalWrite(servoPin, LOW); <BR>&nbsp;&nbsp;delay(25); <BR>} <BR></span> <BR>&nbsp; <BR><b>Great Ideas:</b> <BR>Servos can be used to do all sorts of great things, here are a few of our favorites. <BR>&nbsp; <BR>&nbsp;&nbsp;Xmas Hit Counter <BR>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://ardx.org/XMAS ">http://ardx.org/XMAS </a><BR>&nbsp; <BR>&nbsp;&nbsp;Open Source Robotic Arm (uses a servo controller as well as the Arduino) <BR>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://ardx.org/RARM ">http://ardx.org/RARM </a><BR>&nbsp; <BR>&nbsp;&nbsp;Servo Walker <BR>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://ardx.org/SEWA ">http://ardx.org/SEWA </a>
 +</span></html>