You can try the project without assembling hardware: open the linked Wokwi Arduino simulation and experiment with its rotary-encoder volume-control interface. The example uses two encoder signals to determine turn direction and the encoder’s push-button to switch between volume, bass, and treble.
What the online Arduino encoder project does
The Hackster.io project by Hack star demonstrates a quadrature rotary encoder in an Arduino-style simulation. Turning the encoder changes the currently selected value; pressing its integrated button moves between volume, bass, and treble. An SSD1306 128×64 display presents the selected control and its value.
Open the linked Wokwi project to try it. The project page links to this simulation; its behavior is not independently verified here.
How the encoder signals work in this example
A quadrature encoder provides two signal outputs, called CLK and DT in this sketch. Their changing relationship lets the program infer which direction the encoder is turning. The sketch watches for CLK to transition LOW, then reads DT to choose whether to add or subtract five from the active value.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- The rotation counts are not limited, designed with continuous 360 degree rotation sensors.
- Working voltage: 5V
- Material: Electronic components + PCB
- Reset to its initial state with the buttons on the rotary encoder, starts counting from 0.
- Designed with detent and push button switch feature, comes with nuts and washers, suitable for Arduino micro controller use.
The example assigns CLK to digital pin 2, DT to pin 3, and the push-button signal SW to pin 4. These are the choices in this project, not universal assignments: follow the simulation’s wiring and code if you adapt it to another board.
How the sketch handles the button and display
When SW is LOW, the button handler advances the active mode if more than 300 milliseconds have passed since the previous mode change. The sketch uses that interval as a timing check; it should not be treated as a universal guarantee against mechanical contact bounce.
Rank #2
- Package Include: 6 pcs rotary encoder module and 6 pcs knob caps. The knob is friction‑fit without a set screw. Please press the knob firmly to ensure it stays securely in place. Note: Don't take it off and put it back on repeatedly
- KY-040 Rotary Encoder: Working voltage: 5 V; One round number of pulse: 20
- 360 Degree Rotary Encoder: The rotary encoder can count the number of pulses output during forward and reverse rotation by rotating, and the number of rotations is not limited
- Rotary Encoder Key: Reset to its initial state with the buttons on the rotary encoder, starts counting from 0
- Versatile Control Solution: Ideal for controlling stepper motors, servo motors, digital potentiometers
The display code includes Adafruit_GFX and Adafruit_SSD1306, initializes the SSD1306 at I²C address 0x3C, and draws labels and bars for volume, bass, and treble. The project does not provide a complete library-installation guide or a compatibility matrix, so check the libraries and display setup for the particular board and environment you use.
What you need for a physical reproduction
Hardware is optional if you only want to explore the linked online simulation. For a physical build, the project lists an Arduino Nano R3, a rotary encoder with push-button, jumper wires, and a breadboard; its sketch also uses an SSD1306 display. It marks a DIYables starter kit as optional.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #3
- 【General Parameters】Model: KY-040, Working Voltage: 5V, One round number of pulse: 20.
- 【No Limited Rotation Counts】The rotary encoder can count the number of pulse output during rotation in the positive direction and reverse direction through the rotation and this rotation counts are not limited.
- 【Encoder Key】With the key on the rotary encoder, you can reset to the initial state, that is, counting from 0.
- 【Application】Best choice for stepper and servo motor control. You could also use it to control devices like digital potentiometer.
- 【Package Included】5 x KY-040 360 Degree Rotary Encoder Module + 5 x Encoder Push Button
- Arduino Nano R3
- Rotary encoder with an integrated push-button
- SSD1306 display
- Breadboard and jumper wires
- Optional: DIYables starter kit; check its contents and module compatibility before relying on it
The project does not identify a commercial encoder model or specify its electrical characteristics. If you choose a different module, check that it provides the signals the example expects (CLK, DT, and SW), and confirm its pin labels and wiring against the module documentation.
Quick Recap
Rank #4
- Model: incremental rotary encoders, AB two phases.
- Light weight and small size. Easy installation. Cost-effective features.
- 360P/R-360 pulses per revolution. By rotating the grating disk and optocoupler direction, this incremental optical rotary encoder generate counting pulses.
- Suitable for a variety of intelligent control of automatic guillotine paper machine, civilian measured height human scale, students racing robots and steel cut length control etc.
- 12-MONTH Worry-Free Return And Refund Policy, Buy with Confidence!
What to try while simulating
- Open the Wokwi project.
- Turn the simulated encoder and observe how the active value changes in steps of five.
- Press the encoder’s button to move among volume, bass, and treble, then turn the encoder again to change the selected value.
- Inspect the code and pin connections to see how CLK, DT, and SW are mapped in this particular example.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

