{"id":737,"date":"2019-09-29T07:23:07","date_gmt":"2019-09-29T06:23:07","guid":{"rendered":"https:\/\/www.martyndavis.com\/?p=737"},"modified":"2019-10-06T07:12:21","modified_gmt":"2019-10-06T06:12:21","slug":"controlling-a-rotary-table-with-c","status":"publish","type":"post","link":"https:\/\/www.martyndavis.com\/?p=737","title":{"rendered":"Controlling a Rotary Table with C++"},"content":{"rendered":"\n<p>As part of the project to control my metalworking lathe with a stepper motor (see <a href=\"https:\/\/www.martyndavis.com\/?p=726\">https:\/\/www.martyndavis.com\/?p=726<\/a>), I&#8217;ve decided it would be useful to make some additional gears to step down the speed of the rotary encoder in relation to the lathe&#8217;s spindle.<\/p>\n\n\n\n<p>Here&#8217;s the first one I created (I haven&#8217;t cut a keyway in it yet).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"2100\" height=\"2100\" src=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2019\/09\/20190928_164705.jpg\" alt=\"\" class=\"wp-image-740\"\/><figcaption>A z45 module 1.0 gear I cut with this software<\/figcaption><\/figure>\n\n\n\n<p>To cut gears, typically people use a rotary table, which has a worm drive on it to allow for accurate turning of the workpiece via a handwheel which is marked with a vernier scale. I figured it would be easier to get a computer to do that for me.<\/p>\n\n\n\n<p>Creating the software was simple, because I had all the components already created for the previous project.  Unlike the lathe project, there are no microsecond-critical timing issues &#8211; just rotate, cut, rotate, and repeat until you&#8217;ve turned 360\u00b0. See it in action at <a href=\"https:\/\/youtu.be\/4pt8MZhDIB4\">https:\/\/youtu.be\/4pt8MZhDIB4<\/a> &#8211; quite literally this was my first test, and it all just worked as expected.<\/p>\n\n\n\n<p>The code can be found at <a href=\"https:\/\/github.com\/md81544\/electronicRotaryTable\">https:\/\/github.com\/md81544\/electronicRotaryTable<\/a><\/p>\n\n\n\n<p>Update: here&#8217;s a new video showing the code in action for real, <a href=\"https:\/\/www.youtube.com\/watch?v=-Dw-ggUkjd4\">cutting an aluminium z40 spur gear<\/a>. The result is shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"2268\" height=\"2266\" src=\"https:\/\/www.martyndavis.com\/wp-content\/uploads\/2019\/10\/al_gear.jpg\" alt=\"\" class=\"wp-image-746\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>As part of the project to control my metalworking lathe with a stepper motor (see https:\/\/www.martyndavis.com\/?p=726), I&#8217;ve decided it would be useful to make some additional gears to step down the speed of the rotary encoder in relation to the lathe&#8217;s spindle. Here&#8217;s the first one I created (I haven&#8217;t cut a keyway in it &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.martyndavis.com\/?p=737\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Controlling a Rotary Table with C++&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/737"}],"collection":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=737"}],"version-history":[{"count":7,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":747,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions\/747"}],"wp:attachment":[{"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.martyndavis.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}