{"id":2335,"date":"2022-03-01T19:54:04","date_gmt":"2022-03-02T00:54:04","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2335"},"modified":"2022-03-01T19:57:15","modified_gmt":"2022-03-02T00:57:15","slug":"crit1-development-stepper-motor","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2335","title":{"rendered":"Crit1 Development: Stepper Motor Progress"},"content":{"rendered":"<p>I have 2 alternatives to power the turning plant- a DC motor or a stepper motor. I have run through a test of a DC motor (attached to a fan) and 2 tests for a stepper motor. I was inclined to try to use the stepper motor, but neither of the stepper motor tests have worked. It appears that the power supply module I&#8217;m using (which is supposed to be compatible with the driver and stepper motor I&#8217;m using) is failing to provide power to the driver and the stepper motor. Not clear yet where the failure is happening, although the dim LED light on the power supply module suggests that the 9V battery power supply I am using is not adequate. I will need to test another power supply to see if I can get the stepper motor to work. Since the DC motor with fan seemed to have varying success depending on the speed, I tried two stepper motor tests just in case a difference in the speed would make the stepper motor move.<\/p>\n<p>UPDATE 2\/28: With a new power supply (wall plug), the stepper motor code is working. Next step is to make a sketch that combines the stepper motor and the light sensor TEMT6000.<\/p>\n<p>Stepper Motor Test 1 Sketch:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;Stepper.h&gt;\r\nint stepsPerRevolution=2048; \/\/see motor spec sheet\r\nint motSpeed=10;\r\nint dt=500;\r\nStepper stepmot(stepsPerRevolution, 8,10,9,11);\/\/see motor and driver specs\r\n\r\nvoid setup() {\r\n  \/\/ put your setup code here, to run once:\r\n  Serial.begin(9600);\r\n  stepmot.setSpeed(motSpeed);\r\n\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ put your main code here, to run repeatedly:\r\n  stepmot.step(stepsPerRevolution);\r\n  delay(dt);\r\n  stepmot.step(-stepsPerRevolution);\r\n  delay(dt);\r\n\r\n\r\n}<\/pre>\n<p>Stepper Motor Test 2 Sketch:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;Stepper.h&gt;\r\nconst float STEPS_PER_REV=32; \/\/see motor spec sheet\r\nconst float GEAR_RED = 64;\r\nconst float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED;\r\nint stepsReq;\r\nint motSpeed=10;\r\nint dt=500;\r\n \r\nStepper steppermotor(STEPS_PER_REV, 8,10,9,11);\/\/see motor and driver specs\r\n\r\nvoid setup() {\r\n  \/\/ put your setup code here, to run once:\r\n  Serial.begin(9600);\r\n\r\n\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ put your main code here, to run repeatedly:\r\n  steppermotor.setSpeed(1);\r\n  stepsReq=4;\r\n  steppermotor.step(stepsReq);\r\n  delay(2000);\r\n\r\n  stepsReq = STEPS_PER_OUT_REV \/ 2;\r\n  steppermotor.setSpeed(100);\r\n  steppermotor.step(stepsReq);\r\n  delay(1000);\r\n\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have 2 alternatives to power the turning plant- a DC motor or a stepper motor. I have run through a test of a DC motor (attached to a fan) and 2 tests for a stepper motor. I was inclined to try to use the stepper motor, but neither of the stepper motor tests have &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2335\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Crit1 Development: Stepper Motor Progress&#8221;<\/span><\/a><\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2335"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2335"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions"}],"predecessor-version":[{"id":2347,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions\/2347"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}