This project shows how to control many LEDs using one joystick and Arduino.
The joystick moves in X and Y direction.
Arduino reads this movement and turns ON or OFF the LEDs.
This Arduino and Joystick LED Controller Circuit is simple to build.
Good for beginners and Arduino lovers.
Arduino Coding:
int VRx = A0
int VRy = A1
int SW = 2
int ledUp = 8
int ledDown = 9
int ledLeft = 10
int ledRight = 11
int ledPress = 12
void setup() {
pinMode(ledUp, OUTPUT)
pinMode(ledDown, OUTPUT)
pinMode(ledLeft, OUTPUT)
pinMode(ledRight, OUTPUT)
pinMode(ledPress, OUTPUT)
pinMode(SW, INPUT_PULLUP)
}
void loop() {
int x = analogRead(VRx)
int y = analogRead(VRy)
int swState = digitalRead(SW)
digitalWrite(ledUp, y < 400)
digitalWrite(ledDown, y > 600)
digitalWrite(ledLeft, x < 400)
digitalWrite(ledRight, x > 600)
digitalWrite(ledPress, swState == 0)
}
Coding Explanation:
- analogRead reads the joystick voltage.
- Values go from 0 to 1023.
- Middle value is around 512.
- If joystick moves up, y value becomes low.
- If joystick moves down, y value becomes high.
- Same for left and right with x value.
- digitalWrite HIGH turns LED ON.
- LOW turns LED OFF.
- Switch in joystick gives 0 when pressed.
Circuit Working:

Parts List:
| Item | Quantity |
|---|---|
| Resistors 220Ω 1/4 watt | 5 |
| Arduino UNO | 1 |
| Joystick Module | 1 |
| LEDs 5mm any | 5 |
| USB Cable | 1 |
The joystick has two potentiometers inside.
One for X direction and one for Y direction.
When we move the stick, the voltage changes.
Arduino reads this voltage on A0 and A1 pins.
According to movement, Arduino turns different LEDs ON.
When joystick goes up, one LED glows.
When joystick goes down, other LED glows.
Right and left also glow different LEDs.
Center position means no LED or one LED.
How to Build:
To build a Arduino and Joystick LED Controller Circuit following are the steps we need to follow:
- Gather all the parts as shown in circuit diagram.
- Joystick VRx pin goes to Arduino A0.
- Joystick VRy pin goes to Arduino A1.
- Joystick SW pin goes to Arduino D2.
- Joystick VCC pin goes to Arduino 5V.
- Joystick GND pin goes to Arduino GND.
- LED 1 anode goes to pin 8 through 220 ohm resistor R1.
- LED 2 anode goes to pin 9 through 220 ohm resistor R2.
- LED 3 anode goes to pin 10 through 220 ohm resistor R3.
- LED 4 anode goes to pin 11 through 220 ohm resistor R4.
- LED 5 anode goes to pin 12 through 220 ohm resistor R5.
- All LED cathodes go to GND.
Conclusion:
This project is easy as it teaches how to read joystick values and control LEDs.
It is good for learning analog input.
We can also use this idea for robot control or game projects.
This Arduino and Joystick LED Controller Circuit is simple with low cost and fun.