Rotary Encoder Kit Tutorial

Introduction: Rotary Encoder Kit Tutorial


This rotary encoder kit can be used for sensing motor's position and velocity. It is a very simple kit consisted of an optical beam sensor (opto switch, phototransistor) and a piece of slotted disc. It can be connected to any microcontroller via the 3-pin header. The optical beam sensor detects missing slots of the slotted disc, and generates a pulse train.

It requires +5VDC to power up, and gives a 0V and 5V output. It provides a 5V output when the beam is blocked, and a 0V output when the beam is unblocked. Your microcontroller can simply read the 0-5-0V pulse train to determine how far your motor has traveled, and how fast.

The kit includes a green LED that light up when the beam is uninterrupted.


  • Operating Voltage: 4.5-5 VDC
  • Output Signal: Digital output
  • Direct connection to microcontroller (internal pull-up to 5V)
  • Able to read up to 100KHz
  • Slotted Disc Diameter: 26mm
  • PCB Dimension: 22mm x 20mm

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials Preparation

For this tutorial, the items needed to run this project are:

  1. Arduino Uno
  2. USB Cable Type A to B
  3. Male to male jumper wire
  4. Female to male jumper wire
  5. Plastic Gear Motor

Step 2: Hardware Installation

Diagram above shows the simple connection between Rotary Encoder Kit and Arduino Uno:

  1. 5V > 5V
  2. GND > GND
  3. OUT > D2

Connection between Plastic Gear Motor and Arduino Uno:

  1. Terminal 1 > 5V
  2. Terminal 2 > GND

After completing the connection, connect Arduino Uno to power supply with a USB cable.

Step 3: Insert Source Code

  1. Download the test code and open it by using Arduino software or IDE.
  2. Make sure that you have choose the right board and the corresponding port (In this tutorial, Arduino Uno is used).
  3. Then, upload the test code into your Arduino Uno.

Step 4: Results

The slotted disc is mounted to Plastic Gear Motor and placed within the space of the rotary encoder circuit board. The optical beam sensor detects missing slots of the slotted disc and generates a pulse train. By adjusting code in Arduino, Rotary Encoder will be able to detect actual rpm for the Plastic Gear Motor and display on Serial Monitor.

Step 5: Video

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest