{"product_id":"360-degree-rotary-encoder-module","title":"360 degree Rotary Encoder Module","description":"\u003ch1\u003e\u003cstrong\u003e360 degree Rotary Encoder Module\u003c\/strong\u003e\u003c\/h1\u003e\n\u003cp\u003eThe rotary encoder can count the number of pulses output in the forward and reverse directions by rotation, and the rotation count is not like the potentiometer. This rotation count is not limited. With the key on the rotary encoder, you can reset to the initial state, that is, counting from 0.\u003c\/p\u003e\n\u003ch3\u003e\u003cstrong\u003eSpecifications:\u003c\/strong\u003e\u003c\/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cdiv\u003eOperating voltage: 5V\u003c\/div\u003e\n\u003c\/li\u003e\n\u003cli\u003e\n\u003cdiv\u003eNumber of pulses: 20\u003c\/div\u003e\n\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch3\u003e\u003cstrong\u003eRotary Encoder Basics:\u003c\/strong\u003e\u003c\/h3\u003e\n\u003cp\u003eA rotary encoder has a fixed number of positions per revolution. These positions are easily felt as small “clicks” you turn the encoder.\u003c\/p\u003e\n\u003cp\u003e\u003ca href=\"https:\/\/www.makerlab-electronics.com\/?attachment_id=12319#main\" rel=\"attachment wp-att-12319\"\u003e\u003cimg class=\"alignnone wp-image-12319\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0531\/3419\/6927\/files\/Rotary-Encoder-Pins.png\" alt=\"\" width=\"83\" height=\"193\"\u003e\u003c\/a\u003e\u003c\/p\u003e\n\u003cp\u003eOn one side of the switch there are three pins. They are normally referred to as A, B and C.\u003c\/p\u003e\n\u003cp\u003eInside the encoder there are two switches. Once switch connects pin A to pin C and the other switch connects pin B to C.\u003c\/p\u003e\n\u003cp\u003eIn each encoder position, both switches are either opened or closed. Each click causes these switches to change states as follows:\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003eIf both switches are closed\u003c\/strong\u003e, turning the encoder either clockwise or counterclockwise one position will cause both switches to open\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eIf both switches are open\u003c\/strong\u003e, turning the encoder either clockwise or counterclockwise one position will cause both switches to close.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e \u003c\/p\u003e\n\u003cp\u003eThe illustration below is representative of how the switch is constructed.\u003c\/p\u003e\n\u003cp\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i1.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Rotary-Encoder-Representation.png?resize=420%2C300\" alt=\"Rotary Encoder Representation\" width=\"372\" height=\"266\"\u003e\u003c\/p\u003e\n\u003cp\u003eAs you can see, the angular position of the A terminal and the B terminal is such that:\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003eRotating the switch clockwise\u003c\/strong\u003e will cause the switch connecting A and C to change states first.\u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eRotating the switch counterclockwise\u003c\/strong\u003e will cause the switch connecting B and C to change states first.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eIf we were to represent the opening an closing of the switches as wave forms, it would look something like this.\u003c\/p\u003e\n\u003cp\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i1.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Rotary-Encoder-Phases.png?resize=302%2C240\" alt=\"Rotary Encoder Phases\" width=\"302\" height=\"auto\"\u003e\u003c\/p\u003e\n\u003cp\u003eEssentially, determining which switch changed states first is how the direction of rotation is determined.\u003c\/p\u003e\n\u003cp\u003eIf A changed states first, the switch is rotating in a clockwise direction.\u003c\/p\u003e\n\u003cp\u003eIf B changed states first, the switch is rotating in a counter clockwise direction.\u003c\/p\u003e\n\u003ch3\u003e\u003cspan style=\"font-size: 14.4px\"\u003e\u003cb\u003ePin-outs\u003c\/b\u003e\u003c\/span\u003e\u003c\/h3\u003e\n\u003cp\u003eThe pin outs for this rotary encoder are identified in the illustration below.\u003c\/p\u003e\n\u003cp\u003e\u003ca href=\"https:\/\/i0.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Pin-Outs.png\" rel=\"nofollow\"\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i0.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Pin-Outs.png?resize=351%2C109\" alt=\"Keyes KY-040 Rotary Encoder Pin Outs\" width=\"351\" height=\"auto\"\u003e\u003c\/a\u003e\u003c\/p\u003e\n\u003cp\u003eThe module is designed so that a low is output when the switches are closed and a high when the switches are open.\u003c\/p\u003e\n\u003cp\u003eThe low is generated by placing a ground at Pin C and passing it to the CLK and DT pins when switches are closed.\u003c\/p\u003e\n\u003cp\u003eThe high is generated with a 5V supply input and pullup resistors, such that CLK and DT are both high when switches are open.\u003c\/p\u003e\n\u003cp\u003eNot previously mentioned is the existence of of push button switch that is integral to the encoder. If you push on the shaft, a normally open switch will close. The feature is useful if you want to change switch function. For example, you may wish to have the ability to between coarse and fine adjustments.\u003c\/p\u003e\n\u003ch3\u003e\u003cstrong\u003eRotary Encoder Schematic\u003c\/strong\u003e\u003c\/h3\u003e\n\u003cp\u003eA schematic for this module is provided below. R2 and R3 in the schematic are pull up resistors.\u003c\/p\u003e\n\u003cp\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i0.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Module-Schematic.png?resize=300%2C183\" alt=\"Keyes KY-040 Rotary Encoder Module Schematic\" width=\"300\" height=\"auto\"\u003e\u003c\/p\u003e\n\u003ch3\u003e\u003cstrong\u003eEvaluation Circuit\u003c\/strong\u003e\u003c\/h3\u003e\n\u003cp\u003eSuccessfully implementing the Rotary Encoder into any project requires a clear understanding of everything that has been discussed thus far. If you’re still a little fuzzy, you may wish to throw together the evaluation circuit illustrated below:\u003c\/p\u003e\n\u003cp\u003e\u003ca href=\"https:\/\/i1.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Evaluation-Schematic.png\" rel=\"nofollow\"\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i1.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Evaluation-Schematic.png?resize=300%2C269\" alt=\"Keyes KY-040 Rotary Encoder Evaluation Schematic\" width=\"300\" height=\"auto\"\u003e\u003c\/a\u003e\u003c\/p\u003e\n\u003cp\u003eVERY SLOWLY rotate then encoder shaft both clockwise and counterclockwise. Notice which LEDs change state first with rotation.\u003c\/p\u003e\n\u003ch3\u003e\u003cstrong\u003eModule Connection to the Arduino\u003c\/strong\u003e\u003c\/h3\u003e\n\u003cp\u003ePretty straight forward… All you need to do is connect four wires to the module.\u003c\/p\u003e\n\u003ch2\u003e\u003cspan id=\"The_Arduino_Sketch\"\u003e\u003ca href=\"https:\/\/i2.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Arduino-Connections.png\" rel=\"nofollow\"\u003e\u003cimg class=\"maxWidth950\" src=\"https:\/\/i2.wp.com\/henrysbench.capnfatz.com\/wp-content\/uploads\/2015\/05\/Keyes-KY-040-Rotary-Encoder-Arduino-Connections.png?resize=300%2C167\" alt=\"Keyes KY-040 Rotary Encoder Arduino Connections\" width=\"300\" height=\"auto\"\u003e\u003c\/a\u003e\u003c\/span\u003e\u003c\/h2\u003e","brand":"Others","offers":[{"title":"Default Title","offer_id":42292832207039,"sku":"MLE00090","price":38.0,"currency_code":"PHP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0531\/3419\/6927\/files\/52144d7862cd29f2ea45458388df3c84.jpg?v=1735815118","url":"https:\/\/makerlab.ph\/products\/360-degree-rotary-encoder-module","provider":"Makerlab PH","version":"1.0","type":"link"}