{"id":854,"date":"2010-02-08T20:14:45","date_gmt":"2010-02-09T01:14:45","guid":{"rendered":"http:\/\/www.tigoe.net\/pcomp\/code\/?p=854"},"modified":"2010-02-08T20:18:09","modified_gmt":"2010-02-09T01:18:09","slug":"using-peppermill-to-turn-a-motor-into-a-sensor","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/854\/","title":{"rendered":"Using PepperMill to turn a motor into a sensor"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft\" style=\"margin: 5px;\" title=\"PepperMill board\" src=\"http:\/\/research.microsoft.com\/en-us\/projects\/peppermill\/top-verysmalll.jpg\" alt=\"\" width=\"121\" height=\"121\" \/>Nicolas Villar sent me a sample of the <a href=\"http:\/\/research.microsoft.com\/en-us\/projects\/peppermill\/\">PepperMill<\/a>, a new sensor board he and Steve Hodges designed at Microsoft Research in Cambridge, UK. \u00a0It&#8217;s a nifty little board. \u00a0You attach a DC motor and the board can an output voltage when the motor is turned, \u00a0and analog signals telling you the direction and speed of the motor. \u00a0It turns a DC motor into a rotary encoder, of sorts.<\/p>\n<p><!--more--><\/p>\n<p>Wiring is very simple. \u00a0The motor connects to the two spring connectors at the top of the board. \u00a0Direction and Speed pins connect to two analog inputs on your microcontroller. \u00a0Ground connects to your microcontroller&#8217;s ground. \u00a0The motor generates voltage when you spin it.<\/p>\n<div id=\"_mcePaste\">To use it, plug the motor terminals into the grey connector and use the 3-way switch to select the maximum operating voltage of the motor (2.5\/3.3\/5.0). Set the second switch to CAL (Calibrate). Give the motor a quick turn, and you should see some of the LEDs light up briefly. Set the switch to RUN, and when you turn the motor the LEDs should give you some feedback about the direction and rate of turn.<\/div>\n<div>DC motors rated at 6-12V with a gear ratio between 50:1 and 150:1 are good for applications where you want to turn the motor with your fingers (as you would a potentiometer or rotary encoder). Old cordless drills are another good source of geared DC motors. The board is rated at a max of 24V, so it&#8217;s good to check the maximum voltage generated by the motor before plugging it in.<\/div>\n<p>The direction pin outputs close to 2V when the motor&#8217;s going one direction, and 0V when it&#8217;s going the other direction. To read this, use an analog input and look for a value. If its 0, it&#8217;s going one direction, and if it&#8217;s \u00a0above 0,it&#8217;s going in the other direction.<\/p>\n<p>For more info or to get a board, contact <a href=\"mailto:pepper@microsoft.com\">Nic and Steve in Cambridge<\/a>.<\/p>\n<p>Here&#8217;s the circuit:<\/p>\n<p><a href=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/PepperMill_bb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"PepperMill circuit\" src=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/PepperMill_bb.png\" alt=\"\" width=\"503\" height=\"447\" \/><\/a><\/p>\n<p><a href=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/PepperMill_schem.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"PepperMill schematic\" src=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/PepperMill_schem.png\" alt=\"\" width=\"554\" height=\"439\" \/><\/a><\/p>\n<p>These images were made with <a href=\"http:\/\/www.fritzing.org\">Fritzing<\/a>.  Here&#8217;s the <a href=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/PepperMill.fz\">Fritzing sketch<\/a>, here&#8217;s the <a href=\"http:\/\/tigoe.net\/code\/Arduino\/PepperMill\/docs\/Peppermill%20Power%20Board.fzpz\">part for the PepperMill<\/a>, started by Nic, edited by me.<\/p>\n<p>And here&#8217;s the code:<\/p>\n<pre class=\"brush:arduino; light:true\">[include file=\"..\/..\/code\/Arduino\/PepperMill\/PepperMill.pde\" clean=\"true\"]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nicolas Villar sent me a sample of the PepperMill, a new sensor board he and Steve Hodges designed at Microsoft Research in Cambridge, UK. \u00a0It&#8217;s a nifty little board. \u00a0You attach a DC motor and the board can an output voltage when the motor is turned, \u00a0and analog signals telling you the direction and speed &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/854\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using PepperMill to turn a motor into a sensor&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,24,74],"tags":[],"class_list":["post-854","post","type-post","status-publish","format-standard","hentry","category-arduinowiring","category-circuits","category-electronics"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/comments?post=854"}],"version-history":[{"count":5,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/854\/revisions"}],"predecessor-version":[{"id":858,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/854\/revisions\/858"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}