{"id":2010,"date":"2019-11-29T11:44:23","date_gmt":"2019-11-29T19:44:23","guid":{"rendered":"http:\/\/www.donluc.com\/?p=2010"},"modified":"2019-11-29T11:44:23","modified_gmt":"2019-11-29T19:44:23","slug":"project-12-robotics-easydriver-mk01","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=2010","title":{"rendered":"Project #12: Robotics &#8211; EasyDriver &#8211; Mk01"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2010-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/dl1911mk04.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/dl1911mk04.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/dl1911mk04.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04a.png\" alt=\"Robotics\" width=\"720\" height=\"674\" class=\"alignnone size-full wp-image-2012\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04a-300x281.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04b.png\" alt=\"Robotics\" width=\"720\" height=\"673\" class=\"alignnone size-full wp-image-2013\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04b-300x280.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04c.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2014\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04d.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2015\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04e.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04e.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2016\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04e.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/11\/DL1911Mk04e-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Small Stepper Motor<\/strong><\/p>\n<p>Stepper motors are great motors for position control. They can be found in desktop printers, plotters, 3D printers, CNC milling machines, and anything else requiring precise position control. Steppers are a special segment of brushless motors. They are purposely built for high-holding torque. This high-holding torque gives the user the ability to incrementally &#8220;step&#8221; to the next position. This results in a simple positioning system that doesn&#8217;t require an encoder. This makes stepper motor controllers very simple to build and use. These small steppers are a great way to get things moving, especially when positioning and repeatability is a concern. This is a Bipolar motor.<\/p>\n<p><strong>Pros<\/strong><\/p>\n<p>Excellent position accuracy<br \/>\nHigh holding torque<br \/>\nHigh reliability<br \/>\nMost steppers come in standard sizes<\/p>\n<p><strong>Cons<\/strong><\/p>\n<p>Small step distance limits top speed<br \/>\nIt&#8217;s possible to &#8220;skip&#8221; steps with high loads<br \/>\nDraws maximum current constantly<\/p>\n<p><strong>DL1911Mk04<\/strong><\/p>\n<p>1 x Adafruit RGB LCD Shield 16\u00d72 Character Display<br \/>\n1 x Arduino UNO &#8211; R3<br \/>\n1 x ProtoScrewShield<br \/>\n2 x EasyDriver &#8211; Stepper Motor Driver<br \/>\n2 x Small Stepper Motor<br \/>\n2 x Pololu Mounting<br \/>\n4 x Jumper Wires 3&#8243; M\/M<br \/>\n10 x Jumper Wires 6&#8243; M\/M<br \/>\n2 x Half-Size Breadboard<\/p>\n<p><strong>Arduino UNO<\/strong><\/p>\n<p>SP1 &#8211; Digital 3<br \/>\nDI1 &#8211; Digital 2<br \/>\nSP2 &#8211; Digital 5<br \/>\nDI2 &#8211; Digital 4<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL1911Mk04.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DL1911Mk04.ino\">\r\n\/\/ ***** Don Luc Electronics \u00a9 *****\r\n\/\/ Software Version Information\r\n\/\/ Project #12: Robotics - EasyDriver - Mk01\r\n\/\/ 11-04\r\n\/\/ DL1911Mk04p.ino 12-01\r\n\/\/ Arduino UNO\r\n\/\/ Screw Shield\r\n\/\/ Adafruit RGB LCD Shield\r\n\/\/ 2 x Small Stepper Motor\r\n\/\/ 2 x EasyDriver\r\n\r\n\/\/ include the library code:\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n\r\n\/\/ Adafruit RGB LCD Shield\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n\r\n\/\/ These #defines make it easy to set the backlight color\r\n#define OFF 0x0\r\n#define RED 0x1\r\n#define YELLOW 0x3\r\n#define GREEN 0x2\r\n#define TEAL 0x6\r\n#define BLUE 0x4\r\n#define VIOLET 0x5\r\n#define WHITE 0x7\r\n\r\n\/\/ Momentary Button\r\nint yy = 0;\r\nuint8_t momentaryButton = 0;\r\n\r\n\/\/ 2 x EasyDriver\r\nint dirPinR = 2;                           \/\/ EasyDriver Right\r\nint stepPinR = 3;                          \/\/ stepPin Right\r\nint dirPinL = 4;                           \/\/ EasyDriver Left\r\nint stepPinL = 5;                          \/\/ stepPin Left\r\nint i = 0;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n   \r\n  \/\/ Momentary Button\r\n  momentaryButton = RGBLCDShield.readButtons();\r\n\r\n  switch ( yy ) {\r\n    case 1:\r\n    \r\n      \/\/ Up\r\n      isSwitch1();\r\n      \r\n      break;\r\n    case 2:\r\n    \r\n      \/\/ Down\r\n      isSwitch2();\r\n      \r\n      break;\r\n    case 3:\r\n\r\n      \/\/ Right\r\n      isSwitch3();\r\n      \r\n      break;\r\n    case 4:\r\n\r\n      \/\/ Left\r\n      isSwitch4();\r\n      \r\n      break;\r\n    case 5:\r\n\r\n      \/\/ Stop\r\n      isSwitch5();\r\n      \r\n      break;\r\n    default:\r\n\r\n      \/\/ Stop\r\n      yy = 5;\r\n      RGBLCDShield.setBacklight(RED);\r\n      isSwitch5();\r\n\r\n   }\r\n   \r\n   if ( momentaryButton ) {\r\n    \r\n    if ( momentaryButton &amp; BUTTON_UP ) {\r\n      \r\n      yy = 1;\r\n      \/\/ Up\r\n      RGBLCDShield.setBacklight(GREEN);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_DOWN ) {\r\n      \r\n      yy = 2;\r\n      \/\/ Down\r\n      RGBLCDShield.setBacklight(VIOLET);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_LEFT ) {\r\n      \r\n      yy = 3;\r\n      \/\/ Right\r\n      RGBLCDShield.setBacklight(TEAL);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_RIGHT ) {\r\n\r\n      yy = 4;\r\n      \/\/ Left\r\n      RGBLCDShield.setBacklight(YELLOW);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_SELECT ) {\r\n\r\n      yy = 5;\r\n      \/\/ Stop\r\n      RGBLCDShield.setBacklight(RED);\r\n   \r\n    }\r\n    \r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getSwitch.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getSwitch.ino\">\r\n\/\/ Switch\r\n\/\/ Switch 1\r\nvoid isSwitch1(){\r\n\r\n   \/\/ Up\r\n   yy = 1;\r\n\r\n   \/\/ set the cursor to column 0, line 0\r\n   RGBLCDShield.setCursor(0,0);\r\n   RGBLCDShield.print(&quot;EasyDriver&quot;);        \/\/ EasyDriver  \r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Up&quot;);\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, LOW);              \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(100);\r\n\r\n   for (i = 0; i&lt;1000; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   { \r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n   }  \r\n\r\n}\r\n\/\/ Switch 2\r\nvoid isSwitch2(){\r\n\r\n   \/\/ Down\r\n   yy = 2;\r\n\r\n   \/\/ set the cursor to column 0, line 0\r\n   RGBLCDShield.setCursor(0,0);\r\n   RGBLCDShield.print(&quot;EasyDriver&quot;);         \/\/ EasyDriver  \r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Down&quot;);\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, HIGH);              \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(dirPinL, HIGH);              \/\/ Set the direction.\r\n   delay(100);\r\n\r\n   for (i = 0; i&lt;1000; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   {\r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n   } \r\n\r\n}\r\n\/\/ Switch 3\r\nvoid isSwitch3(){\r\n\r\n   \/\/ Right\r\n   yy = 3;\r\n\r\n   \/\/ set the cursor to column 0, line 0\r\n   RGBLCDShield.setCursor(0,0);\r\n   RGBLCDShield.print(&quot;EasyDriver&quot;);        \/\/ EasyDriver  \r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Hight&quot;);\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, LOW);               \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(dirPinL, HIGH);              \/\/ Set the direction.\r\n   delay(100);\r\n\r\n   for (i = 0; i&lt;1000; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   {\r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n   }    \r\n  \r\n}\r\n\/\/ Switch 4\r\nvoid isSwitch4(){\r\n\r\n   \/\/ Left\r\n   yy = 4;\r\n\r\n   \/\/ set the cursor to column 0, line 0\r\n   RGBLCDShield.setCursor(0,0);\r\n   RGBLCDShield.print(&quot;EasyDriver&quot;);        \/\/ EasyDriver  \r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Left&quot;);\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, HIGH);             \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(100);\r\n\r\n   for (i = 0; i&lt;1000; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   {\r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(170);                \/\/ This delay time is close to top speed.\r\n   }    \r\n    \r\n}\r\n\/\/ Switch 5\r\nvoid isSwitch5(){\r\n\r\n   \/\/ Stop\r\n   yy = 5;\r\n\r\n   \/\/ set the cursor to column 0, line 0\r\n   RGBLCDShield.setCursor(0,0);\r\n   RGBLCDShield.print(&quot;EasyDriver&quot;);        \/\/ EasyDriver  \r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Stop&quot;);\r\n\r\n   delay( 1000 );\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, LOW);              \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(100);\r\n   digitalWrite(stepPinR, LOW);             \/\/ This LOW to HIGH change is what creates the\r\n   digitalWrite(stepPinL, LOW);             \/\/ This LOW to HIGH change is what creates the \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  \/\/ Adafruit RGB LCD Shield\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 Electron&quot;);         \/\/ Don luc Electron\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(&quot;EasyDriver&quot;);               \/\/ EasyDriver\r\n\r\n  delay(5000);\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ 2 x EasyDriver\r\n  pinMode(dirPinR, OUTPUT);\r\n  pinMode(stepPinR, OUTPUT);\r\n  pinMode(dirPinL, OUTPUT);\r\n  pinMode(stepPinL, OUTPUT);\r\n\r\n}\r\n<\/pre>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/neosteamlabs.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/www.jlpconsultants.com\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Etsy:<\/strong> https:\/\/www.etsy.com\/shop\/NeoSteamLabs<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Small Stepper Motor Stepper motors are great motors for position control. They can be found in desktop printers, plotters, 3D printers, CNC milling machines, and anything else requiring precise position control. Steppers are a special segment of brushless motors. They are purposely built for high-holding torque. This high-holding torque &#8230; <a title=\"Project #12: Robotics &#8211; EasyDriver &#8211; Mk01\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=2010\" aria-label=\"Read more about Project #12: Robotics &#8211; EasyDriver &#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":[94,47,50,38,5,46,58,10,43],"tags":[86,6,87,19,85,24,9,27,95,34],"class_list":["post-2010","post","type-post","status-publish","format-standard","hentry","category-robotics-projerts","category-adafruit","category-arduino","category-digitalelectronics","category-microcontrollers","category-pololu","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-display","tag-electronics","tag-fritzing","tag-microcontroller","tag-programming","tag-projects-2","tag-robotic","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2010","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=2010"}],"version-history":[{"count":3,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2010\/revisions"}],"predecessor-version":[{"id":2019,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2010\/revisions\/2019"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}