<![CDATA[Discount price, wholesale 360 Degree Rotary Encoder Module Brick Sensor Development Board for Arduino from china factory directly]]> https://www.uxcell.com info@uxcell.com en> Mon, 20 May 2024 08:51:36 +0800 http://blogs.law.harvard.edu/tech/rss <![CDATA[360 Degree Rotary Encoder Module Brick Sensor Development Board for Arduino]]> https://www.uxcell.com/360-degree-rotary-encoder-module-brick-sensor-development-board-for-arduino-p-699283.html <img src="https://media.uxcell.com/uxcell/images/item/medium/ux_a14122700ux0004_ux_m.jpg" /><h4><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Specifications:</span></span></h4> <ul> <li><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">By rotating the rotary encoder can be counted in the positive direction and the reverse direction during rotation of the output pulse frequency, unlike rotary potentiometer count, this rotation counts are not limited. With the buttons on the rotary encoder can be reset to its initial state, that starts counting from 0.</span></span></li> <li><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Pulse circle: 5</span></span></li> </ul> <h4><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Working Principle</span></span>:</h4> <ul> <li><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Incremental encoder is a displacement of the rotary pulse signal is converted to a series of digital rotary sensors. These pulses are used to control angular displacement. In Eltra angular displacement encoder conversion using a photoelectric scanning principle. Receiver is covered with a diffraction grating, which has the same code disk window width. The receiver&#39;s job is to feel the rotation of the disc resulting changes, and change the light into corresponding electrical changes. Then the low-level signals up to a higher level, and generates no interference square pulse, which must be processed by electronic circuits. Reading systems typically employ a differential manner, about the same but the phase difference of the two waveforms different by 180&deg;compared to the signal in order to improve the quality and stability of the output signal. Reading is then the difference between the two signals formed on the basis,thus eliminating the interference.</span></span></li> <li> <p><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Incremental encoder has two-phase square wave is given, and their phase difference of 90 degree, often referred to as A channel and B channels.One of the channels are related to the speed of information, at the same time, through two channel signal sequence comparison, get the direction of rotation.There is also A special signal called Z or zero passage, and the channel encoder is given the absolute zero, the signal is A square wave with A channel center line of the square wave of overlap.</span></span><br /> <br /> <img alt="" src="http://m2.uxcell.com/photo_new/20141227/e/ux_a14122700ux0004_ux_e01.jpg" style="width: 620px; height: 326px;" /></p> </li> </ul> <h4><span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">Testing code.(only for your reference)</span></span></h4> <span style="font-size:16px;"><span style="font-family: arial,helvetica,sans-serif;">int redPin = 2;<br /> <br /> int yellowPin = 3;<br /> <br /> int greenPin = 4;<br /> <br /> int aPin = 6;<br /> <br /> int bPin = 7;<br /> <br /> int buttonPin = 5;<br /> <br /> &nbsp;<br /> <br /> int state = 0;<br /> <br /> int longPeriod = 5000; // Time at green or red<br /> <br /> int shortPeriod = 700; // Time period when changing<br /> <br /> int targetCount = shortPeriod;<br /> <br /> int count = 0;<br /> <br /> &nbsp;<br /> <br /> void setup()<br /> <br /> {<br /> <br /> &nbsp; pinMode(aPin, INPUT);<br /> <br /> &nbsp; pinMode(bPin, INPUT);<br /> <br /> &nbsp; pinMode(buttonPin, INPUT);<br /> <br /> &nbsp; pinMode(redPin, OUTPUT);<br /> <br /> &nbsp; pinMode(yellowPin, OUTPUT);<br /> <br /> &nbsp; pinMode(greenPin, OUTPUT);<br /> <br /> }<br /> <br /> &nbsp;<br /> <br /> void loop()<br /> <br /> {<br /> <br /> &nbsp; count++;<br /> <br /> &nbsp; if (digitalRead(buttonPin))<br /> <br /> &nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp; setLights(HIGH, HIGH, HIGH);<br /> <br /> &nbsp; }<br /> <br /> &nbsp; else<br /> <br /> &nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp; int change = getEncoderTurn();<br /> <br /> &nbsp;&nbsp;&nbsp; int newPeriod = longPeriod + (change * 1000); &nbsp;<br /> <br /> &nbsp;&nbsp;&nbsp; if (newPeriod &gt;= 1000 andand newPeriod &lt;= 10000)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; longPeriod = newPeriod;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp;&nbsp;&nbsp; if (count &gt; targetCount)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setState();<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count = 0;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp; }<br /> <br /> &nbsp; delay(1);<br /> <br /> }<br /> <br /> &nbsp;<br /> <br /> int getEncoderTurn()<br /> <br /> {<br /> <br /> &nbsp; // return -1, 0, or +1<br /> <br /> &nbsp; static int oldA = LOW;<br /> <br /> &nbsp; static int oldB = LOW;<br /> <br /> &nbsp; int result = 0;<br /> <br /> &nbsp; int newA = digitalRead(aPin);<br /> <br /> &nbsp; int newB = digitalRead(bPin);<br /> <br /> &nbsp; if (newA != oldA || newB != oldB)<br /> <br /> &nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp; // something has changed<br /> <br /> &nbsp;&nbsp;&nbsp; if (oldA == LOW andand newA == HIGH)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = -(oldB * 2 - 1);<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp; }<br /> <br /> &nbsp; oldA = newA;<br /> <br /> &nbsp; oldB = newB;<br /> <br /> &nbsp; return result;<br /> <br /> }<br /> <br /> &nbsp;<br /> <br /> int setState()<br /> <br /> &nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp; if (state == 0)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setLights(HIGH, LOW, LOW);<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCount = longPeriod;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state = 1;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp;&nbsp;&nbsp; else if (state == 1)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setLights(HIGH, HIGH, LOW);<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCount = shortPeriod;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state = 2;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp;&nbsp;&nbsp; else if (state == 2)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setLights(LOW, LOW, HIGH);<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCount = longPeriod;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state = 3;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp;&nbsp;&nbsp; else if (state == 3)<br /> <br /> &nbsp;&nbsp;&nbsp; {<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setLights(LOW, HIGH, LOW);<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCount = shortPeriod;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state = 0;<br /> <br /> &nbsp;&nbsp;&nbsp; }<br /> <br /> &nbsp; }<br /> <br /> &nbsp;<br /> <br /> void setLights(int red, int yellow, int green)<br /> <br /> {<br /> <br /> &nbsp; digitalWrite(redPin, red);<br /> <br /> &nbsp; digitalWrite(yellowPin, yellow);<br /> <br /> &nbsp; digitalWrite(greenPin, green);<br /> <br /> }</span></span><br /> <br /> <br /><br /><table border='1'><tr><td>Country of Manufacture</td><td>CHINA</td></tr><tr><td>Material</td><td>Electric Part</td></tr><tr><td>Net Weight</td><td>7g</td></tr><tr><td>Package Content</td><td>1 x Rotary Encoder Module</td></tr><tr><td>Main Color</td><td>Black</td></tr><tr><td>Working Voltage</td><td>DC 5V</td></tr><tr><td>Total Size</td><td>31 x 19 x 31mm/1.2" x 1.2" x 0.75"(L*W*H)</td></tr><tr><td>Fixing Hole Diameter</td><td>2.5mm</td></tr><tr><td>Fixing Hole Center Distance</td><td>14mm/0.55"</td></tr><tr><td>MPN</td><td>Does Not Apply</td></tr><tr><td>Brand</td><td>Uxcell</td></tr></table>