{"id":237,"date":"2016-02-29T22:23:13","date_gmt":"2016-02-29T21:23:13","guid":{"rendered":"https:\/\/ca.rstenpresser.de\/blag\/?p=237"},"modified":"2016-02-29T22:23:13","modified_gmt":"2016-02-29T21:23:13","slug":"a-usb-interface-for-a-mitutoyo-caliper","status":"publish","type":"post","link":"https:\/\/ca.rstenpresser.de\/blag\/2016\/02\/a-usb-interface-for-a-mitutoyo-caliper\/","title":{"rendered":"A USB Interface for a Mitutoyo Caliper"},"content":{"rendered":"<p>I am in need for a z-measurement device for my cnc. So I checked ebay and got me a used mitotuyo depth gauge for ~60\u00e2\u201a\u00ac. It has an &#8216;SPC&#8217;-Interface for digital readout. Fortunately there is <a href=\"http:\/\/duino4projects.com\/interfacing-a-digital-micrometer-to-a-microcontroller\/\">some information<\/a> on the Web on howto access that interface.<\/p>\n<figure id=\"attachment_238\" aria-describedby=\"caption-attachment-238\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-238 size-large\" src=\"https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2912.small_-1024x683.jpg\" alt=\"IMG_2912.small\" width=\"660\" height=\"440\" srcset=\"https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2912.small_-1024x683.jpg 1024w, https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2912.small_-300x200.jpg 300w, https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2912.small_.jpg 1600w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><figcaption id=\"caption-attachment-238\" class=\"wp-caption-text\">DIY connector<\/figcaption><\/figure>\n<p>I didn&#8217;t want to buy an expensive Mitutoyo-cable, so I decided to solder on my own connector.<\/p>\n<p>Pinout is:<br \/>\n1. GND (red cable)<br \/>\n2. Serial Data Out (OpenCollector)<br \/>\n3. Serial Clock Out (OpenCollector)<br \/>\n4. (unused)<br \/>\n5. Request In<\/p>\n<p>The USB-Conversion is done by a <a href=\"http:\/\/shackspace.de\/wiki\/doku.php?id=project:tinymega\" target=\"_blank\">tinymega<\/a> microcontroller board which features an Atmega32U4 CPU. With the <a href=\"http:\/\/www.fourwalledcubicle.com\/LUFA.php\" target=\"_blank\">LUFA USB-Stack<\/a>\u00c2\u00a0 it presents itself to the host as a virtual serial port.<\/p>\n<p>The implementation of\u00c2\u00a0 the SPC-Protocol decoding is pretty straightforward. Send a request on one pin, read in data via SPI. I chose to do all of this in software with one interrupt (not using the SPI peripheral of the CPU). You can see my implementation here on <a href=\"https:\/\/github.com\/cpresser\/mitutoyo-spc\" target=\"_blank\">github<\/a>.<\/p>\n<figure id=\"attachment_239\" aria-describedby=\"caption-attachment-239\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2918.small_.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-239\" src=\"https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2918.small_-1024x317.jpg\" alt=\"caliper + tinymega\" width=\"660\" height=\"204\" srcset=\"https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2918.small_-1024x317.jpg 1024w, https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2918.small_-300x93.jpg 300w, https:\/\/ca.rstenpresser.de\/wp-files\/2016\/02\/IMG_2918.small_.jpg 1600w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-239\" class=\"wp-caption-text\">caliper + tinymega<\/figcaption><\/figure>\n<p>Now all that is left is to hook it up to linuxcnc. I haven&#8217;t done that yet, but most likely it only requires 10 lines of python to generate a HAL-Module.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am in need for a z-measurement device for my cnc. So I checked ebay and got me a used mitotuyo depth gauge for ~60\u00e2\u201a\u00ac. It has an &#8216;SPC&#8217;-Interface for digital readout. Fortunately there is some information on the Web on howto access that interface. I didn&#8217;t want to buy an expensive Mitutoyo-cable, so I &hellip; <a href=\"https:\/\/ca.rstenpresser.de\/blag\/2016\/02\/a-usb-interface-for-a-mitutoyo-caliper\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">A USB Interface for a Mitutoyo Caliper<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":239,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,49],"tags":[101,67,102,99,100,98],"_links":{"self":[{"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/posts\/237"}],"collection":[{"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":3,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"predecessor-version":[{"id":242,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/posts\/237\/revisions\/242"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/media\/239"}],"wp:attachment":[{"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ca.rstenpresser.de\/blag\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}