Information
Item weight
Barcode
Created time
Last updated on
Item description
รายละเอียดสินค้า


Datasheet


โมดูลสำหรับอ่านความเร็วและทิศทางของการหมุน พร้อมสวิตซ์กด สามารถใช้วัดความเร็วรอบ หรือใช้เป็นวาร์วเพื่อหมุนปรับค่าต่างๆ ต่างจาก potentiometer ตัวนี้จะหมุนได้ 360 องศาและไม่จำกัดรอบการหมุน

หลักการทำงานคือการวางตัวอ่านฟันเฟืองเยื้องๆกัน เพื่อให้สามารถระบุทิศทางการหมุนได้ จำนวนฟันเฟืองที่ผ่านหัวอ่านต่อวินาทีสามารถนำไปคำนวณความเร็วการหมุนได้ 



โมดูลนี้อาจไม่จำเป็นต้องใช้ interrupt ในการรับค่าเพื่อทำเป็นวาร์วปรับค่า แต่อาจต้องมีเทคนิคในการเขียนโปรแกรมนิดหน่อยเพื่อให้ทำงานได้อย่างมีประสิทธิภาพสูงสุด สามารถศึกษาได้จากวิดีโอข้างล่างครับ


(ตัวอย่างการเขียน Code เพื่อกำจัด Bounce จากการหมุนโดยไม่ต้องพึ่ง interrupt)

 
 
 

คุณสมบัติอุปกรณ์

Operating voltage: 5V.
Pulses/360° Rotation: 20.
Output: 2-bit gray code
Mechanical Angle: 360° continuous.
With built in push button switch (push to operate)
Dimensions: (30 x 18 x 30) mm.
Compatible with Arduino/Raspberry Pi controller board.


 
 

ตัวอย่างโค้ด

  1. volatile boolean TurnDetected;  // need volatile for Interrupts
  2.  
  3. // Rotary Encoder Module connections
  4. const int PinCLK=2;   // Generating interrupts using CLK signal
  5. const int PinDT=4;    // Reading DT signal
  6.  
  7. // Interrupt routine runs if CLK pin changes state
  8. void rotarydetect ()  {
  9.   TurnDetected = true;  // set variable to true
  10. }
  11.  
  12. void setup ()  {
  13.   Serial.begin(2000000);  // high rate to assure good capture
  14.   attachInterrupt (0,rotarydetect,CHANGE); // interrupt 0 always connected to pin 2 on Arduino UNO
  15. }
  16.  
  17. void loop ()  {
  18.  
  19.   if (TurnDetected)  { // rotary has been moved
  20.       TurnDetected = false;  // do NOT repeat IF loop until new rotation detected 
  21.       Serial.print("CLK Pin: ");
  22.       Serial.println(digitalRead(PinCLK));
  23.       Serial.print("DT Pin: ");
  24.       Serial.println(digitalRead(PinDT));
  25.       delay(5);
  26.   }
  27. }
Conditions
Tags

Exchange or return policy



Every item comes with a 30-day warranty. However, there are certain conditions that apply:

  1. The customer should not be responsible for any self-inflicted damage, such as incorrect power connections (for example, supplying 5V instead of the required 3.3V for a sensor).

  2. The product must be in perfect condition, without any breakage or damage caused by electricity (e.g., short circuits leading to electrical fires).

  3. The store does not accept product exchanges due to customer misunderstandings, such as purchasing the wrong size for their project or buying something without eventually using it. Customers can inquire about the product details and ensure compatibility before making a purchase by contacting us through our Line account @modulemore during business hours. Please note that there may be delays in response between 12:00 PM and 2:00 PM.

Return Policy: To initiate a product return, customers must provide the original receipt or a copy for quick verification. Returns can be sent to our store address by following these guidelines:

  1. Provide a detailed description of the damaged item(s).
  2. Mention any tests or experiments conducted by the customer.

Please note that the store reserves the right to make the final decision regarding product replacement or refund.

English

Categories

TRACK & TRACE

*Enter your order ID or email used in placing an order

OVERVIEW

Pageviews2,073,164 view(s)
Visitors1,333,890 time(s)
Last updatedSep 7, 2025

JOIN US

ร้านModuleMore
ร้านModuleMore
/www.modulemore.com/en
Join as a Member
600
Become a member of this store to receive special offers and promotions
Choose your language
Language
Currency
Change
Modify language
My orders
This seller's information
ร้านModuleMore
ModuleMore
Arduino compatible board, Iot, ESP32, ESP8266, Nodemcu, Raspberry pi, micro:bit and etc.
Mobile number : 0831710868
E-mail : paheyisoicus@gmail.com
Send message to seller
About this seller
Recently viewed items
Favourite this seller
Join as a Member
Share this page
Share this page

TOP Back to top
Contact me