{"product_id":"12mm-rotary-encoder-detentless-3-pin","title":"12mm Rotary Encoder 3-Pin - Detentless Smooth Turn, No Push Switch","description":"\u003cdiv class=\"nznpd\"\u003e\n\u003cdiv class=\"nznpd__lead\"\u003e\n\u003cp class=\"nznpd__intro\"\u003eA rotary encoder is a knob that tells a microcontroller which way and how far it has been turned, and it spins endlessly with no end stops. This 12mm one turns smoothly with no clicks and gives 24 pulses a turn on two A\/B channels, so an Arduino, ESP32 or Pico can read both direction and speed.\u003c\/p\u003e\n\u003cp class=\"nznpd__intro\"\u003eUse it for a volume or tuning knob, scrolling through a menu, or setting a value like motor speed or screen brightness. It works with 3.3V and 5V boards, takes a standard knob on its insulated 6mm D shaft, and mounts on a PCB, so it does not fit a breadboard. For prototyping, female jumper wires push straight onto its pins, or solder wires on for a more lasting fit. The collar has no thread or nut, so if it is not going on a PCB, hold it in place with glue or a snug press-fit hole.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003csection class=\"nznpd__block\"\u003e\n\u003ch3 class=\"nznpd__h\"\u003eSpecifications\u003c\/h3\u003e\n\u003cdiv class=\"nznpd__specs\"\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eType\u003c\/span\u003e\u003cstrong\u003eIncremental, A\/B quadrature\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003ePulses per turn\u003c\/span\u003e\u003cstrong\u003e24 (96 counts with 4x decoding)\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eFeel\u003c\/span\u003e\u003cstrong\u003eDetentless, no push switch\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003ePins\u003c\/span\u003e\u003cstrong\u003e3 in a row: A, C (common), B at 2.5mm pitch\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eContact rating\u003c\/span\u003e\u003cstrong\u003e10mA at 5V DC, signal use\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eWorks with\u003c\/span\u003e\u003cstrong\u003e3.3V and 5V boards\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eShaft\u003c\/span\u003e\u003cstrong\u003e6mm insulated D shaft, about 20mm long\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003ePanel mounting\u003c\/span\u003e\u003cstrong\u003eSmooth collar with no thread or nut, fits a 7.5 to 8mm hole\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eBody and mounting\u003c\/span\u003e\u003cstrong\u003eAbout 12.4 x 13.4mm, PCB mount, not for breadboards\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eRotational life\u003c\/span\u003e\u003cstrong\u003e30,000 cycles (typical)\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eOperating temperature\u003c\/span\u003e\u003cstrong\u003e-30 to +70°C (typical)\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"nznpd__spec\"\u003e\n\u003cspan\u003eIn the box\u003c\/span\u003e\u003cstrong\u003e1 encoder, no knob or nut\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/section\u003e\n\u003csection class=\"nznpd__block\"\u003e\n\u003ch3 class=\"nznpd__h\"\u003eDatasheets\u003c\/h3\u003e\n\u003cdiv class=\"nznpd__ds\"\u003e\n\u003ca class=\"nznpd__dsbar\" href=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/SW-ENC-12MM-3P-Datasheet.pdf?v=1793111354\" target=\"_blank\" rel=\"noopener\" aria-label=\"Download the 12mm detentless rotary encoder datasheet (PDF)\"\u003e\n\u003csvg width=\"20\" height=\"20\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\u003cpath d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"\u003e\u003c\/path\u003e\u003cpolyline points=\"14 2 14 8 20 8\"\u003e\u003c\/polyline\u003e\u003c\/svg\u003e\n\u003cspan\u003eFull technical datasheet\u003c\/span\u003e\n\u003cspan class=\"nznpd__dsmeta\"\u003ePDF\u003csvg width=\"17\" height=\"17\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\u003e\u003cpath d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"\u003e\u003c\/path\u003e\u003cpolyline points=\"7 10 12 15 17 10\"\u003e\u003c\/polyline\u003e\u003cline x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n\u003c\/a\u003e\n\u003c\/div\u003e\n\u003c\/section\u003e\n\u003csection class=\"nznpd__block\"\u003e\n\u003cdiv class=\"nznpd__qs\"\u003e\n\u003ch3\u003eWiring \u0026amp; getting started\u003c\/h3\u003e\n\u003cdetails class=\"nznpd__figbox\" open\u003e\u003csummary\u003eWiring diagram\u003cspan class=\"nznpd__codelang\"\u003eArduino Nano\u003c\/span\u003e\u003c\/summary\u003e\u003cfigure class=\"nznpd__fig\"\u003e\u003ca href=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/SW-ENC-12MM-3P-wiring-nano-wide.png?v=1793111922\" target=\"_blank\" rel=\"noopener\"\u003e\u003cpicture\u003e\u003csource media=\"(min-width: 600px)\" srcset=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/SW-ENC-12MM-3P-wiring-nano-wide.png?v=1793111922\" width=\"920\" height=\"650\"\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/SW-ENC-12MM-3P-wiring-nano.png?v=1793111922\" alt=\"Wiring drawing: the encoder with wires soldered to its three pins, A to Arduino Nano D2, the middle pin C to GND and B to D3\" width=\"690\" height=\"852\" loading=\"lazy\"\u003e\u003c\/picture\u003e\u003c\/a\u003e\u003cfigcaption\u003eTap the drawing to open it full size.\u003c\/figcaption\u003e\u003c\/figure\u003e\u003c\/details\u003e\n\u003col class=\"nznpd__steps\"\u003e\n\u003cli\u003e\u003cdiv\u003e\n\u003cstrong\u003eMount it\u003c\/strong\u003e\u003cp\u003eOn a PCB, the three pins and both frame tabs go through the board and the shaft stands straight out. Solder the tabs as well as the pins, because they take the strain when the knob is turned. The flat pins do not fit a breadboard, so for a prototype or a quick test, push female jumper wires onto the three pins, or solder short wires on for a more lasting fit. Either way, solder quickly and keep flux out of the open back of the body.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cdiv\u003e\n\u003cstrong\u003eWire it\u003c\/strong\u003e\u003cp\u003eC, the middle pin, goes to GND. A and B go to two digital pins. On an Uno or Nano, use pins 2 and 3, because they react to every change and fast turns are not missed. The example code turns on resistors built into the board, so no extra parts are needed.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cdiv\u003e\n\u003cstrong\u003eLoad the test code\u003c\/strong\u003e\u003cp\u003eInstall the Encoder library by Paul Stoffregen from the Library Manager, upload the code below and open the Serial Monitor at 9600 baud.\u003c\/p\u003e\n\u003cdetails class=\"nznpd__codebox\" open\u003e\u003csummary\u003eExample Arduino code\u003cspan class=\"nznpd__codelang\"\u003eArduino C++\u003c\/span\u003e\u003c\/summary\u003e\u003cpre\u003e\u003ccode\u003e\u003cspan class=\"t-c\"\u003e\/\/ 12mm encoder test: A to D2, B to D3, C (middle pin) to GND.\u003c\/span\u003e\n\u003cspan class=\"t-c\"\u003e\/\/ Needs the Encoder library by Paul Stoffregen (Library Manager).\u003c\/span\u003e\n\u003cspan class=\"t-k\"\u003e#include\u003c\/span\u003e \u003cspan class=\"t-s\"\u003e\u0026lt;Encoder.h\u0026gt;\u003c\/span\u003e\n\n\u003cspan class=\"t-o\"\u003eEncoder\u003c\/span\u003e \u003cspan class=\"t-v\"\u003eknob\u003c\/span\u003e(\u003cspan class=\"t-n\"\u003e2\u003c\/span\u003e, \u003cspan class=\"t-n\"\u003e3\u003c\/span\u003e);   \u003cspan class=\"t-c\"\u003e\/\/ turns on the internal pull-ups for you\u003c\/span\u003e\n\u003cspan class=\"t-t\"\u003elong\u003c\/span\u003e \u003cspan class=\"t-v\"\u003elastCount\u003c\/span\u003e = \u003cspan class=\"t-n\"\u003e0\u003c\/span\u003e;\n\n\u003cspan class=\"t-t\"\u003evoid\u003c\/span\u003e \u003cspan class=\"t-f\"\u003esetup\u003c\/span\u003e() {\n  \u003cspan class=\"t-o\"\u003eSerial\u003c\/span\u003e.\u003cspan class=\"t-f\"\u003ebegin\u003c\/span\u003e(\u003cspan class=\"t-n\"\u003e9600\u003c\/span\u003e);\n  \u003cspan class=\"t-o\"\u003eSerial\u003c\/span\u003e.\u003cspan class=\"t-f\"\u003eprintln\u003c\/span\u003e(\u003cspan class=\"t-s\"\u003e\"Turn the shaft. One full turn is 96 counts.\"\u003c\/span\u003e);\n}\n\n\u003cspan class=\"t-t\"\u003evoid\u003c\/span\u003e \u003cspan class=\"t-f\"\u003eloop\u003c\/span\u003e() {\n  \u003cspan class=\"t-t\"\u003elong\u003c\/span\u003e \u003cspan class=\"t-v\"\u003ecount\u003c\/span\u003e = \u003cspan class=\"t-v\"\u003eknob\u003c\/span\u003e.\u003cspan class=\"t-f\"\u003eread\u003c\/span\u003e();\n  \u003cspan class=\"t-k\"\u003eif\u003c\/span\u003e (\u003cspan class=\"t-v\"\u003ecount\u003c\/span\u003e != \u003cspan class=\"t-v\"\u003elastCount\u003c\/span\u003e) {\n    \u003cspan class=\"t-v\"\u003elastCount\u003c\/span\u003e = \u003cspan class=\"t-v\"\u003ecount\u003c\/span\u003e;\n    \u003cspan class=\"t-o\"\u003eSerial\u003c\/span\u003e.\u003cspan class=\"t-f\"\u003eprintln\u003c\/span\u003e(\u003cspan class=\"t-v\"\u003ecount\u003c\/span\u003e);\n  }\n}\u003c\/code\u003e\u003c\/pre\u003e\u003c\/details\u003e\n\u003c\/div\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cdiv\u003e\n\u003cstrong\u003eCheck it works\u003c\/strong\u003e\u003cp\u003eClockwise counts up and anticlockwise counts down, with 96 counts in a full turn. However, if clockwise counts down, swap the A and B wires or the two pin numbers in the code. For a volume or menu control, divide the count by 4 to get 24 steps a turn.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cdiv\u003e\n\u003cstrong\u003eAdd a knob (optional)\u003c\/strong\u003e\u003cp\u003eAny push-on or set-screw knob for a 6mm D shaft fits. The datasheet has the PCB footprint, and a filter circuit if you run long wires.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/li\u003e\n\u003c\/ol\u003e\n\u003c\/div\u003e\n\u003c\/section\u003e\n\u003c\/div\u003e","brand":"NZN Electronics","offers":[{"title":"Default Title","offer_id":67700077002848,"sku":"SW-ENC-12MM-3P","price":4.99,"currency_code":"NZD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/12mm-rotary-encoder-detentless-3-pin-hero-d-shaft.png?v=1793109108","url":"https:\/\/www.nznelectronics.co.nz\/products\/12mm-rotary-encoder-detentless-3-pin","provider":"NZN Electronics","version":"1.0","type":"link"}