Arduino Nano ESP32 - Joystick - Servo Motor

In this tutorial, we are going to learn how to use Arduino Nano ESP32 and a joystick to control two servo motors or a pan-tilt kit with servos.

A joystick has two built-in potentiometers square with each other (called X-axis and Y-axis). These potentiometers output the analog values (called X-value and Y-value) on VRX and VRY pins. We will use these analog values to control two servo motors independently: X-value controls servo #1 and Y-value controls servo #2. In the case of the pan-tilt kit, the movement of two servo motors creates 3-D movement.

There are two application use cases: