{"id":1666,"date":"2018-07-10T14:08:46","date_gmt":"2018-07-10T21:08:46","guid":{"rendered":"http:\/\/www.donluc.com\/?p=1666"},"modified":"2018-07-10T14:08:46","modified_gmt":"2018-07-10T21:08:46","slug":"project-8-servo-potentiometer-servo-mk01","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=1666","title":{"rendered":"Project #8: Servo &#8211; Potentiometer Servo &#8211; Mk01"},"content":{"rendered":"<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03a.png\" alt=\"\" width=\"720\" height=\"639\" class=\"alignnone size-full wp-image-1667\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03a-300x266.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03b.png\" alt=\"\" width=\"720\" height=\"644\" class=\"alignnone size-full wp-image-1668\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03b-300x268.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03c.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1669\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03c-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03d.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1670\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03d-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1666-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03v.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03v.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk03v.mp4<\/a><\/video><\/div>\n<p><strong>Servo Motor<\/strong><\/p>\n<p>A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servo motors.<\/p>\n<p>Servo motors have been around for a long time and are utilized in many applications. They are small in size but pack a big punch and are very energy-efficient. These features allow them to be used to operate remote-controlled or radio-controlled toy cars, robots and airplanes. Servo motors are also used in industrial applications, robotics, in-line manufacturing, pharmaceutics and food services.<\/p>\n<p><strong>Circuit<\/strong><\/p>\n<p>Servo motors have three wires: power, ground, and signal. The power wire is red, and should be connected to the 5V pin on the Arduino board. The ground wire is black and should be connected to a ground pin on the board. The signal pin is orange and should be connected to pin 9 on the board.<\/p>\n<p>The potentiometer should be wired so that its two outer pins are connected to power (+5V) and ground, and its middle pin is connected to analog input 0 on the board.<\/p>\n<p><strong>DonLuc1805Mk07<\/strong><\/p>\n<p>1 x RGB LCD Shield 16\u00d72 Character Display<br \/>\n1 x Arduino UNO &#8211; R3<br \/>\n1 x ProtoScrewShield<br \/>\n1 x Servo Motor<br \/>\n1 x 100k Ohm Potentiometer<br \/>\n1 x Potentiometer Knob<br \/>\n4 x Jumper Wires 3&#8243; M\/M<br \/>\n4 x Jumper Wires 6&#8243; M\/M<br \/>\n1 x Half-Size Breadboard<\/p>\n<p><strong>Arduino UNO<\/strong><\/p>\n<p>Ser &#8211; Digital 9<br \/>\nPot &#8211; Analog A0<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DonLuc1807Mk03.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DonLuc1807Mk03.ino\">\r\n\/\/ ***** Don Luc *****\r\n\/\/ Software Version Information\r\n\/\/ Project #8: Servo Motor - Potentiometer - Mk01\r\n\/\/ 7-3\r\n\/\/ DonLuc1807Mk03 7-3\r\n\/\/ Servo Motor\r\n\/\/ Potentiometer Servo\r\n\r\n\/\/ include the library code:\r\n#include &lt;Adafruit_MCP23017.h&gt;\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n#include &lt;Servo.h&gt;\r\n\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n#define GREEN 0x2\r\n\r\n\/\/ Potentiometer Servo Motor\r\nServo isServo;                            \/\/ Create servo object to control a servo\r\nint iPot1 = A0;                           \/\/ Analog Potentiometer 1\r\nint iVal;                                 \/\/ Variable - Analog Potentiometer 1\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Potentiometer Servo Motor\r\n  iVal = analogRead(iPot1);               \/\/ Reads the value of the iPot1 (Value between 0 and 1023)\r\n  iVal = map(iVal, 0, 1023, 0, 180);      \/\/ Scale it to use it with the isServo (Value between 0 and 180)\r\n  isServo.write(iVal);                    \/\/ isServo sets the servo position according to the scaled value\r\n  delay(15);    \r\n\r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);\r\n  RGBLCDShield.print(&quot;Potentiometer&quot;);     \/\/ Potentiometer\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(iVal);                \/\/ Reads the value iVal\r\n  \r\n  delay(500);\r\n  \r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n  \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"setup.ino\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ set up the LCD&#039;s number of columns and rows: \r\n  RGBLCDShield.begin(16, 2);\r\n  RGBLCDShield.setBacklight(GREEN);\r\n  \r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);  \r\n  RGBLCDShield.print(&quot;Don Luc&quot;);         \/\/ Don luc\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(&quot;Potentiometer&quot;);   \/\/ Potentiometer Servo Motor\r\n\r\n  delay(5000);\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ Potentiometer Servo Motor\r\n  isServo.attach(9);                     \/\/ Attaches the Servo on pin 9 to the Servo Object\r\n\r\n}\r\n<\/pre>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Servo Motor A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servo &#8230; <a title=\"Project #8: Servo &#8211; Potentiometer Servo &#8211; Mk01\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=1666\" aria-label=\"Read more about Project #8: Servo &#8211; Potentiometer Servo &#8211; Mk01\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75,50,38,59,5,46,58,10],"tags":[],"class_list":["post-1666","post","type-post","status-publish","format-standard","hentry","category-servo","category-arduino","category-digitalelectronics","category-fritzing","category-microcontrollers","category-pololu","category-arduino-programming","category-projects"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1666"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1666\/revisions"}],"predecessor-version":[{"id":1672,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1666\/revisions\/1672"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}