Irish Distributors for Velleman & Kitronik
Please Click Here to leave a review on TRUSTPILOT after your purchase and delivery
Irish Distributors for Velleman & Kitronik
Please Click Here to leave a review on TRUSTPILOT after your purchase and delivery
Kitronik LAB:bit educational platform for BBC micro:bit REDUCED FROM €47.97 to €36.00 CLICK HERE
See our reduced prices on our LAB Bench Power Supplies CLICK HERE
See our digital gift card. After the purchase, you will receive an email with the gift card and instructions on how to use it. The card can be used as payment for any products we have. CLICK HEREļ»æ
The Keyes KY-040 rotary encoder is a rotary input device (as in knob) that
provides an indication of how much the knob has been rotated AND what
direction it is rotating in.
Its a great device for stepper and servo motor control. You could also use it to
control devices like digital potentiometers.
Product information
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.
Arduino Sketch
int pinA = 3Ķ¾ // Connected to CLK on KY040
int pinB = 4Ķ¾ // Connected to DT on KY040
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Ķ¾
}
All products listed on our website as in stock are here in Cork are ready to ship.
We ship orders on Monday to Friday and, in most cases, orders are delivered the next working day. However, there are times when a delay may be experienced beyond our control. Cut off times for next day deliveries are 2.00pm.
Delivery charges quoted apply to delivery in the 32 counties of ireland only
Free signed for delivery on all orders over €30.00.
Delivery charge of €8.00 appiles to all orders under €30.00 (signed for delivery)
We use fastway couriers for all our shipments in ireland.
For more on our delivery and shipping charges, see here.
Credit terms and discounts for the educational sector i.e. Secondary schools, colleges and universities are available. Please contact us for further information.
Quality electronic products at affordable prices
All Rights Reserved | EDHHD Trading Ltd t/a Irish Electronics