I know we can hook 5v later externally to debounce but still, i heard it works without debounce circuit even if its bouncy. But how can it send signals if there are only output and gnd pins?
Asked
Active
Viewed 4,194 times
1 Answers
1
They're just mechanical contacts.
simulate this circuit – Schematic created using CircuitLab
Figure 1. Encoder wired to micro-controller with internal pull-ups.
The encoder is probably wired as shown (but I don't know why there are five wires on your diagram). What you can't see is that the internal pull-up resistors in the Arduino have to be enabled for this to work.

Transistor
- 168,990
- 12
- 186
- 385
-
i think im getting this. So if the SW1 is open, the related pin is 1. But if the SW1 is closed, the pin is 0. Am i correct? There are rotary encoders in the market which has a +5V, A, B, C pins like KY-040. If i use it, i wouldnt need to activate arduino's built in pull up resistors right? I think Ky-040 has its own pull up resistors right? – Çay Öncesi Mar 13 '16 at 17:58
-
KY-40 is a rotary switch on a small PCB with room at the back for pull-up resistors. If you are lucky they are present ;) – Wouter van Ooijen Mar 13 '16 at 18:15
-
@WoutervanOoijen what did you mean by present :D So they have pre soldered pull up resistors right? – Çay Öncesi Mar 13 '16 at 18:44
-
@ÇayÖncesi: I am not familiar with the Ky-040. Some encoders are optical and they use a disc with transparent and black zones on them. These use LEDs and sensors to detect position and so never wear out - unlike your mechanical switch. The LEDs need +5 V and GND. – Transistor Mar 13 '16 at 19:20