{"id":167,"date":"2009-10-18T16:56:49","date_gmt":"2009-10-18T21:56:49","guid":{"rendered":"http:\/\/elegans.uky.edu\/blog\/?p=167"},"modified":"2009-10-18T16:56:49","modified_gmt":"2009-10-18T21:56:49","slug":"stepper-motor-controller","status":"publish","type":"post","link":"https:\/\/jimlund.org\/blog\/?p=167","title":{"rendered":"Stepper motor controller"},"content":{"rendered":"<p>Stepper motors are easier to control than servos, but they typically produce lower power.  A number of people have built stepper motor run CNC projects, so for small or mid-size CNC control they work.<\/p>\n<p>I have three bipolar stepper motors, but seven 6-wire unipolar steppers plus other unipolar steppers with other wire counts so it makes sense to design a unipolar stepper controller.<\/p>\n<p>A unipolar stepper has three coils all of which get driven in the same direction by PWM signals amplified and isolated by a driver circuit.  Because the drive current is always in the same direction an H-bridge is not required, rather a simpler driver can be used.  <\/p>\n<p>The simplest way to drive the stepper is to activate each coil in turn slowly enough that the motor has time to move a step before the next step is given.  A smoother and more power efficient method called microstepping uses PWM to transition gradually from one step to the next (<a href=\"pics\/00907a.pdf\">Microchip App Note<\/a>).  This requires four signals from the PIC to the driver.  The PIC18F4x31 chips can output 8 PWM signals and so could drive two motors.<\/p>\n<p>An intelligent driver with integrated stepping like the Allegro <a href=\"pics\/970701.pdf\">SLA7070MR<\/a> ($7) at only requires a direction and step signal.  A <a href=\"http:\/\/microchip.com\">PIC16F88<\/a> has 16 IO lines, enough to drive 4+ unipolar steppers, and PIC18 or PIC30 can run 4+ unipolar steppers plus has PWM lines to drive additional hobby servos.  The PIC18 can have a USB interface and so could run a CNC by itself.  <\/p>\n<p>A more robust stepper controller interfaced to an SLA70xx driver would have a RESET pin, a common one running to all the drivers, and M<sub>0<\/sub> line monitoring the each stepper, and shared M<sub>1<\/sub> and M<sub>2<\/sub> lines running to all the drivers, so three common lines, and three per driver, so fifteen for four motors.  Then figure each axis would have a pair of end stop switches, so four input lines for those, and one input line for a big STOP button.  So altogether 20 IO lines for four axis control.<\/p>\n<p>Two IO lines are required for USB.  The <a href=\"pics\/41303E.pdf\">PIC18F46K20<\/a> ($3), a 40-pin DIP, has 36 IO lines, four of which can be PWM and several A\/D input lines.  This PIC could run four axes and have separate lines for USB, in circuit programming, and still have lines available to run PWM hobby servos, input temperature, etc.<\/p>\n<p>Some CNC setups have centering switches, so that could be useful.  Other CNC systems use the axis end stop switch to find their initial position.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Stepper motors are easier to control than servos, but they typically produce lower power. A number of people have built stepper motor run CNC projects, so for small or mid-size CNC control they work. I have three bipolar stepper motors, but seven 6-wire unipolar steppers plus other unipolar steppers with other wire counts so it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-167","post","type-post","status-publish","format-standard","hentry","category-hobbies"],"_links":{"self":[{"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167"}],"version-history":[{"count":0,"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions"}],"wp:attachment":[{"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}