VCC sets all three levels
The pull-ups on CLOCK and DATA and the switch on BTN all go to VCC, so the voltage on VCC is the HIGH your pins receive, on all three, all the time. Beside an ESP32, an ESP32-S3 or a Pico that has to be 3V3. Beside an Uno, 5V.
Three signals, one supply
Two of the signals are pulled up. CLOCK and DATA each have a 10 kΩ resistor to VCC, so while their contact is open they sit at VCC. The third is switched: the shaft switch joins BTN to VCC while the knob is pushed in.
So there is no separate "signal voltage" on this block. Whatever you connect to VCC is the HIGH your board sees on every one of the three pins. Put 5 V on it and your pins get 5 V. Put 3.3 V on it and they get 3.3 V.
3V3 beside a 3.3 V board
An ESP32, an ESP32-S3 and a Raspberry Pi Pico run their pins at 3.3 V, and none of them is built to take 5 V. Pick 5V in the figure with one of them selected: CLOCK and DATA rest at 5 V, so the pins are past their rating from the moment the board is powered, turning or not. It reads correctly, and it is slowly doing damage, which is why the wiring is the rule rather than a suggestion.
Connect VCC to the board's 3V3 pin. Nothing about the encoder changes.
The TK04 push button has the same rule for one pin; VCC sets the voltage explains it there. This block has it for three, and two of them are HIGH most of the time.
5V beside an Uno
The Uno's pins run at 5 V, so its 5V pin is the right supply. 3V3 works too, since the ATmega328P reads anything above 3.0 V as HIGH, but that leaves 0.3 V of margin to gain nothing.
VCC left off
With VCC unconnected the pull-ups pull to nothing. CLOCK and DATA float, and a floating input reads whatever it picks up: your hand near the wire, the neighbouring pin. A sketch reads that as turns that never happened, in either direction. BTN reads LOW for ever, because the switch has nothing to join it to. A wandering count with the knob untouched is the first sign to check VCC.
When it does not work
No. CLOCK and DATA rest at VCC through their pull-ups, so with 5V on VCC the ESP32's pins sit at 5 V the whole time the knob is still, not only when you turn it. It will seem to work, which is the problem. Connect VCC to 3V3; the block works the same from it.
It will read HIGH. The ATmega328P treats anything above 0.6 of its 5 V supply, 3.0 V, as HIGH, so 3.3 V clears it by 0.3 V. That is a thin margin for no benefit. Use the Uno's 5V pin.
With nothing on VCC the pull-ups have nothing to pull up to, so CLOCK and DATA float and pick up noise, and a sketch reads that noise as turns. BTN never reads HIGH either, because the switch has nothing to join it to. Connect VCC.
Only while a contact is closed: VCC across 10 kΩ, 0.5 mA from 5 V or 0.33 mA from 3.3 V per closed contact. Whether a contact is closed with the knob at rest depends on where the part's clicks sit. On many EC11 parts both are open at rest, and then the pull-ups carry nothing.
How two contacts that close a quarter of a cycle apart say which way the knob turned.
Two contacts out of step →Edit this page — content/books/rotary-encoder/vcc-sets-all-three-levels.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Rotary Encoder
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.