Arduino Uno Rotary Encoder Simple
This project demonstrates how to use a rotary encoder with an Arduino Uno to detect rotational movements and monitor the encoder's position.
A push-button integrated into the encoder is also utilized.
Components Needed
- Arduino UNO
- Rotary Encoder Module
- Jumper Wires
- Breadboard
Block Diagram
Hardware Wiring Explanation:
Connect the CLK pin of the rotary encoder to digital pin 2 on the Arduino Uno.
Connect the DT pin of the rotary encoder to digital pin 3 on the Arduino Uno.
Connect the SW (push-button) pin of the rotary encoder to digital pin 4 on the Arduino Uno.
Ensure to use pull-up resistors or activate internal pull-ups on the Arduino Uno pins if needed.
Wire up the rotary encoder module to the Arduino Uno as per the circuit setup section.
Software (Arduino IDE):
Open the Arduino IDE and create a new sketch.
Copy and paste the provided Arduino code into the sketch.
Upload the code to the Arduino Uno.
Project Operation
Open the serial monitor with a baud rate of 9600.
Rotate the rotary encoder and observe the position value printed in the Serial Monitor.
Press the integrated push-button to trigger actions in your project.
Applications
Notes
Ensure the rotary encoder is correctly connected and powered according to the specifications.
Modify the code to implement specific functionalities based on encoder movements and button presses.
Explore advanced features of rotary encoders such as quadrature encoding for finer control.