Tutorial for Arduino 360 Degree Encoder

by mybotic in Circuits > Arduino

10699 Views, 18 Favorites, 0 Comments

Tutorial for Arduino 360 Degree Encoder

1.jpg

Description

A rotary encoder is an incremental electromechanical component with a shaft that converts the angular position or motion of a shaft or axle to digital code. The output of incremental encoders provides information about the motion of the shaft, which is typically further processed in processor / controllers into information such as speed, distance, and position.The shaft has unlimited 360 degree rotation.

Specification

  • Model: SN-360
  • Type: Incremental Encoder
  • Cycles per revolution (CPR): 20
  • Working voltage: 0 – 5V
  • Material: PCB + Brass
  • Weight: 10g
  • Size: 32 x 19 x 30mm

Material Preparation

2016-11-29 09.38.53 1.jpg

To do this tutorial, you will need as following below:

1. Arduino 360 Degree Encoder
2. Arduino Uno Board and USB Cable
3. Female-Male Jumper Wires

Pinout Details

2.png
  • CLK : Pin A
  • DT : Pin B
  • S : No push switch connection
  • + : Power
  • GND : Grounding

Pin Connection

2016-11-29 09.38.33 1.jpg
33.png

Connect Arduino 360 Degree Encoder to Arduino Uno as following :

  • VCC to 5V
  • GND to GND
  • CLK to D3
  • CLK to D4

and then connect Arduino Uno to your PC.

Sample Source Code

21.png

This is a sample source code for the circuit. You can download, open and and upload it into your Arduino Uno Board. Make sure to go to tools > Port & Board. Select the correct board (Arduino/Genuino Uno) and port (refer to your own port COM#) before uploading the code.

Downloads

Serial Monitor

89.png
begin.png

After you have succesfully uploaded it into you Arduino Uno Board. Go to tools > Serial Monitor and you will see "BEGIN" printed on the serial monitor. Now, you can start to rotate your encoder's shaft and see the output printed on the serial monitor.

Result

qq.png

  • When you rotate the shaft clockwise, serial monitor will print

Rotate Clockwise
Encoder Count: 1
Rotate Clockwise
Encoder Count: 2
  • and when you rotate clockwise, serial monitor will print
Rotate Counterclockwise
Encoder Count: 0
Rotate Counterclockwise
Encoder Count: -1

  • You can feel a small “clicks” as you turn the encoder.