Arduino Project
Arduino Servo Motor Control with Potentiometer V3
Course Introduction
This project creates a servo angle controller using an Arduino, a rotary encoder, a push button, and three LEDs.
Users rotate the encoder to adjust the servo angle and press the button to toggle step sizes (1°, 5°, 10°). The LED color indicates the current step size: red = 1°, yellow = 5°, blue = 10°.
Note
If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.
1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE
Wiring

Common Connections:
Digital Servo Motor
Connect to breadboard’s positive power bus.
Connect to breadboard’s negative power bus.
Connect to 3 on the Arduino.
rotary encoder
CLK: Connect to 12 on the Arduino.
DT: Connect to 11 on the Arduino.
SW: Connect to 10 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.
LED
Blue Connect the LEDs anode to a 1kΩ resistor then to the negative power bus on the breadboard, and the LEDs cathode to 7 on the Arduino.
Yellow Connect the LEDs anode to a 1kΩ resistor then to the negative power bus on the breadboard, and the LEDs cathode to 6 on the Arduino.
Red Connect the LEDs anode to a 1kΩ resistor then to the negative power bus on the breadboard, and the LEDs cathode to 5 on the Arduino.
Writing the Code
Note
You can copy this code into Arduino IDE.
Don’t forget to select the board(Arduino UNO R4 Minima/WIFI) and the correct port before clicking the Upload button.
