{"id":1574,"date":"2014-12-03T01:23:33","date_gmt":"2014-12-03T01:23:33","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=1574"},"modified":"2014-12-03T01:59:27","modified_gmt":"2014-12-03T01:59:27","slug":"driving-tiny-stepper-arduino-without-driver","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2014\/12\/driving-tiny-stepper-arduino-without-driver\/","title":{"rendered":"Driving a tiny stepper on an Arduino (without a driver!)"},"content":{"rendered":"<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper2-1024x768.jpg\" alt=\"tiny_stepper2\" width=\"700\" height=\"525\" class=\"aligncenter size-large wp-image-1579\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper2-1024x768.jpg 1024w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper2-300x225.jpg 300w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper2.jpg 1632w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>I had this stepper knocking around in my junk draw. And figured it would be interesting to hook it up to an Arduino and play around with. Probing the motor showed it was a Bipolar stepper (no center tap) with 40Ohm windings. <\/p>\n<p>Not really wanting to waste an EasyDriver or motor shield on it I was thinking about what else I could do. Another option was to <a href=\"http:\/\/41j.com\/blog\/2012\/05\/dvd-drive-stepper-motor-unl2003-driver-and-arduino\/\">use a ULN2003 which I&#8217;ve done before<\/a> though it&#8217;s <a href=\"http:\/\/elabz.com\/driving-a-bipolar-stepper-motor-with-arduino-and-uln2803ag\/\">slightly problematic driving bipolar steppers with them<\/a>.<\/p>\n<p>In the end I figured the motor is tiny, and unlikely to require much current. The Arduino itself can source and sink up to 40mA so why not try driving it directly! <\/p>\n<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper1-1024x768.jpg\" alt=\"tiny_stepper1\" width=\"700\" height=\"525\" class=\"aligncenter size-large wp-image-1578\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper1-1024x768.jpg 1024w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper1-300x225.jpg 300w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tiny_stepper1.jpg 1632w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>Four Arduino pins are used, a pair for each winding on the stepper:<\/p>\n<p><a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tinystep_dia.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tinystep_dia-1024x676.jpg\" alt=\"tinystep_dia\" width=\"700\" height=\"462\" class=\"aligncenter size-large wp-image-1580\" srcset=\"https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tinystep_dia-1024x676.jpg 1024w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tinystep_dia-300x198.jpg 300w, https:\/\/41j.com\/blog\/wp-content\/uploads\/2014\/12\/tinystep_dia.jpg 1280w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>I then used code adapted from <a href=\"http:\/\/elabz.com\/driving-a-bipolar-stepper-motor-with-arduino-and-uln2803ag\/\">elabz<\/a> to drive the stepper (listing in the notes below). I should really also add some current limiting resistors, as without them I think I&#8217;ll be drawing about 100mA and am liable to kill my Arduino if I keep running it in this configuration. Video below shows the stepper working and describes the setup: <\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/UKp91J0ongs\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>I really like these parts, and I&#8217;ll have to think of a project to use them in. I&#8217;ve been interested in imaging IC dies and these stepper could be used to make a cute little low profile XY stage with just enough torque to move a die around.<\/p>\n<h2>Notes<\/h2>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\nint motorPin1=2;\r\nint motorPin2=3;\r\nint motorPin3=4;\r\nint motorPin4=5;\r\n\r\nvoid setup() {\r\n  \/\/ set the digital pin as output:\r\n  pinMode(motorPin1, OUTPUT);      \r\n  pinMode(motorPin2, OUTPUT);      \r\n  pinMode(motorPin3, OUTPUT);      \r\n  pinMode(motorPin4, OUTPUT);\r\n}\r\n\r\nvoid loop()\r\n{ \r\n  digitalWrite(motorPin1, HIGH);\r\n  digitalWrite(motorPin2, LOW);\r\n  digitalWrite(motorPin3, HIGH);\r\n  digitalWrite(motorPin4, LOW);\r\n  delay(50);\r\n \r\n  digitalWrite(motorPin1, HIGH);\r\n  digitalWrite(motorPin2, LOW);\r\n  digitalWrite(motorPin3, HIGH);\r\n  digitalWrite(motorPin4, HIGH);\r\n  delay(50); \r\n   \r\n  digitalWrite(motorPin1, HIGH);\r\n  digitalWrite(motorPin2, LOW);\r\n  digitalWrite(motorPin3, LOW);\r\n  digitalWrite(motorPin4, HIGH);\r\n  delay(50); \r\n   \r\n  digitalWrite(motorPin1, HIGH);\r\n  digitalWrite(motorPin2, HIGH);\r\n  digitalWrite(motorPin3, LOW);\r\n  digitalWrite(motorPin4, HIGH);\r\n  delay(50);\r\n   \r\n  digitalWrite(motorPin1, LOW);\r\n  digitalWrite(motorPin2, HIGH);\r\n  digitalWrite(motorPin3, LOW);\r\n  digitalWrite(motorPin4, HIGH);\r\n  delay(50);\r\n \r\n  digitalWrite(motorPin1, LOW);\r\n  digitalWrite(motorPin2, HIGH);\r\n  digitalWrite(motorPin3, HIGH);\r\n  digitalWrite(motorPin4, HIGH);\r\n  delay(50);\r\n \r\n  digitalWrite(motorPin1, LOW);\r\n  digitalWrite(motorPin2, HIGH);\r\n  digitalWrite(motorPin3, HIGH);\r\n  digitalWrite(motorPin4, LOW);\r\n  delay(50);\r\n   \r\n  digitalWrite(motorPin1, HIGH);\r\n  digitalWrite(motorPin2, HIGH);\r\n  digitalWrite(motorPin3, HIGH);\r\n  digitalWrite(motorPin4, LOW);\r\n  delay(50); \r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had this stepper knocking around in my junk draw. And figured it would be interesting to hook it up to an Arduino and play around with. Probing the motor showed it was a Bipolar stepper (no center tap) with 40Ohm windings. Not really wanting to waste an EasyDriver or motor shield on it I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1574","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-po","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=1574"}],"version-history":[{"count":4,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1574\/revisions"}],"predecessor-version":[{"id":1584,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1574\/revisions\/1584"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=1574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=1574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=1574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}