พร้อมส่ง-KY-040_360 Degree Rotary Encoder (1)
พร้อมส่ง-KY-040_360 Degree Rotary Encoder (2)
พร้อมส่ง-KY-040_360 Degree Rotary Encoder (3)
พร้อมส่ง-KY-040_360 Degree Rotary Encoder (4)

ขาย พร้อมส่ง-KY-040_360 Degree Rotary Encoder ราคาที่ดีที่สุด

4.9
76
การให้คะแนน
112
ขายแล้ว
฿70
57% OFF
฿30
เรือจาก
จังหวัดเพชรบูรณ์
Variation
Type 1
Type 2

รายละเอียดสินค้า

พร้อมส่ง-KY-040_360 Degree Rotary Encoder SPECIFICATIONS: Flat top Push-button capability Pulses per rotation: 20 Unlimited Rotations Pins are right-angle to the knob, but you can connect them to a breadboard using male-female jumper wires Standard pin spacing: 2.54mm (0.1") Dimensions (exluding pins): 26.2mm (1.03") length x 18.5mm (0.73") width x 28.5mm (1.12") height Total Shaft Dimensions: 20mm (0.79") height x 6mm (0.24") diameter Turning Portion of Shaft Dimensions: 12.5mm (0.49") height x 6mm (0.24") diameter Weight: 6.43g Rotary Encoder Basics A rotary encoder has a fixed number of positions per revolution. These positions are easily felt as small “clicks” you turn the encoder. The Keyes module that I have has thirty of these positions. Rotary Encoder PinsOn one side of the switch there are three pins. They are normally referred to as A, B and C. In the case of the KY-040, they are oriented as shown. Inside the encoder there are two switches. Once switch connects pin A to pin C and the other switch connects pin B to C. In each encoder position, both switches are either opened or closed. Each click causes these switches to change states as follows: If both switches are closed, turning the encoder either clockwise or counterclockwise one position will cause both switches to open If both switches are open, turning the encoder either clockwise or counterclockwise one position will cause both switches to close. The illustration below is representative of how the switch is constructed. Rotary Encoder RepresentationAs you can see, the angular position of the A terminal and the B terminal is such that: Rotating the switch clockwise will cause the switch connecting A and C to change states first. Rotating the switch counterclockwise will cause the switch connecting B and C to change states first. If we were to represent the opening an closing of the switches as wave forms, it would look something like this. Rotary Encoder PhasesEssentially, determining which switch changed states first is how the direction of rotation is determined. If A changed states first, the switch is rotating in a clockwise direction. If B changed states first, the switch is rotating in a counter clockwise direction. KY-040 Pin Outs The pin outs for this rotary encoder are identified in the illustration below. Keyes KY-040 Rotary Encoder Pin OutsThe module is designed so that a low is output when the switches are closed and a high when the switches are open. The low is generated by placing a ground at Pin C and passing it to the CLK and DT pins when switches are closed. The high is generated with a 5V supply input and pullup resistors, such that CLK and DT are both high when switches are open. Not 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. //Example Sketch Arduino UNO R3 Connect KY-040 int pinA = 3; // Connected to CLK on KY-040 int pinB = 4; // Connected to DT on KY-040 int encoderPosCount = 0; int pinALast; int aVal; boolean bCW; void setup() { pinMode (pinA,INPUT); pinMode (pinB,INPUT); /* Read Pin A Whatever state it's in will reflect the last position */ pinALast = digitalRead(pinA); Serial.begin (9600); } void loop() { aVal = digitalRead(pinA); if (aVal != pinALast){ // Means the knob is rotating // if the knob is rotating, we need to determine direction // We do that by reading pin B. if (digitalRead(pinB) != aVal) { // Means pin A Changed first - We're Rotating Clockwise encoderPosCount ++; bCW = true; } else {// Otherwise B changed first and we're moving CCW bCW = false; encoderPosCount--; } Serial.print ("Rotated: "); if (bCW){ Serial.println ("clockwise"); }else{ Serial.println("counterclockwise"); } Serial.print("Encoder Position: "); Serial.println(encoderPosCount); } pinALast = aVal; }

จากร้านเดียวกัน

รายการที่เกี่ยวข้อง

คุณอาจชอบ