Rotary Encoder Module (KY-040) [S120] 



https://www.youtube.com/watch?v=NbWY56AZVYI


*GitHub : https://github.com/rdiot/rdiot-s120.git


* Specs

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 counter, which Species rotation counts are not limited. With the buttons on the rotary encoder can be reset to its initial state, that starts counting from 0.

How it works: 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. Reading system of alternating light transmitting window and the window is not Consisting of radial indexing plate (code wheel) rotating basis, while being an infrared light source vertical irradiation light to the code disk image onto the receiving

On the surface. Receiver is covered with a diffraction grating, which has the same code disk window width. The receiver'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 ° 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.


Analog output voltage: 0~5V


* Contents

- Conect

OUT ----- A0

VCC ----- 5V

GND ----- GND


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


int pin = A0;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(pin, INPUT);


  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S120:Rotary Encoder");


  lcd.setCursor(0,1);

  lcd.print("AnalogValue=" + (String)analogRead(pin) + " ");


}

'2) Sensor > Rotary' 카테고리의 다른 글

Rotation Encoder Module (KY-040) [S043]  (0) 2016.09.12
Posted by RDIoT
|