Skip to content

Arn5v89033innovator/DualSense-Video-Controller

Repository files navigation

πŸ–οΈ Gesture-Based Video Controller

Ever wished you could pause a video without scrambling for the keyboard? That's exactly what this project does. Wave your hand, and your video pauses. Push it closer, and the volume goes up. It's a simple but satisfying build using an Arduino and a couple of ultrasonic sensors β€” no fancy hardware, no expensive components.


How It Works

There are two HC-SR04 ultrasonic sensors mounted side by side β€” one tracking your left hand, one tracking your right. The Arduino constantly measures how far away each hand is, figures out what gesture you're making, and fires off a label like "Play/Pause" or "Vup" over USB serial. A small Python script running on your computer picks that up and presses the right keyboard shortcut on your behalf.

[Left Hand] ←→ [HC-SR04 #1]
                              β†’ [Arduino Uno] β†’ USB Serial β†’ [Python Script] β†’ Media Controls
[Right Hand] ←→ [HC-SR04 #2]
]

It's a clean split: the Arduino handles the sensing, Python handles the computer side.


What You'll Need

Component Quantity
Arduino Uno (or any compatible board) 1
HC-SR04 Ultrasonic Sensor 2
Breadboard 1
Jumper Wires As needed
A computer with Python installed 1

Nothing too exotic β€” you can probably grab all of this for under $15 if you don't already have it.


Wiring

Sensor Arduino Pin
Sensor 1 β€” Trigger Digital Pin 1
Sensor 1 β€” Echo Digital Pin 2
Sensor 2 β€” Trigger Digital Pin 3
Sensor 2 β€” Echo Digital Pin 4

Both sensors share the Arduino's 5V and GND rails on the breadboard.


Gesture Guide

Once it's running, here's how to actually use it:

Gesture What it does How to do it
βœ‹ Both hands at 25–50 cm Play / Pause Hold both hands out in front of both sensors at the same time
πŸ‘ˆ Left hand at 10–20 cm, push closer Volume Up Lock your left hand at 10–20 cm, then nudge it in (under 15 cm)
πŸ‘ˆ Left hand at 10–20 cm, pull back Volume Down Lock your left hand at 10–20 cm, then pull it back (past 20 cm)
πŸ‘‰ Right hand at 10–20 cm, push closer Rewind Lock your right hand at 10–20 cm, then nudge it in (under 15 cm)
πŸ‘‰ Right hand at 10–20 cm, pull back Fast Forward Lock your right hand at 10–20 cm, then pull it back (past 20 cm)
πŸ‘‰ Right hand very close (0–8 cm) Next Quickly swipe your right hand close to the sensor

The "lock" gestures take a beat to activate β€” hold your hand steady for a moment first, and the Arduino will confirm it's locked before watching for your next move.


Getting It Running

1. Flash the Arduino

Open Gesture_Control_code.ino in the Arduino IDE, plug in your Arduino, pick the right Board and Port under the Tools menu, and hit Upload. That's the hardware side done.

2. Install Python Dependencies

pip install pyserial pyautogui

3. Set Your COM Port

Open Gesture_control.py and update the serial port to match what your Arduino is using:

# Windows

ArduinoSerial = serial.Serial('COM3', 9600)


# macOS / Linux

ArduinoSerial = serial.Serial('/dev/ttyUSB0', 9600)

Not sure which port? Check Tools β†’ Port in the Arduino IDE β€” it'll be listed there.

4. Run It

python Gesture_control.py

Click on your video player to make sure it's focused, and you're good to go. Start gesturing!


Project Structure

β”œβ”€β”€ Gesture_Control_code.ino   # Arduino firmware β€” reads sensors and sends gesture labels over serial
β”œβ”€β”€ Gesture_control.py         # Python script β€” listens on serial and triggers keyboard shortcuts
└── README.md
d

Troubleshooting

Can't connect to the Arduino / port not found Double-check that the COM port in Gesture_control.py matches what the Arduino IDE shows. It changes depending on which USB port you plug into.

Gestures aren't being detected Make sure there's nothing between your hands and the sensors β€” even a cluttered desk can cause false readings. If you want to see what the sensors are actually measuring, uncomment the debug Serial.print lines in the .ino file and open the Serial Monitor.

Keyboard shortcuts aren't working Your video player needs to be the active window. The Python script sends keystrokes to whatever's in focus, so if another window is on top, the commands will go there instead..


Dependencies

Library What it's for Install
pyserial Talks to the Arduino over USB pip install pyserial
pyautogui Sends keyboard shortcuts to your computer pip install pyautogui

License

Open source β€” take it, tweak it, make it your own.

About

Hand-free operation of the video player by implementing the controller using an Arduino board with two HC-SR04 ultrasonic sensors. Hand-to-sensor distance regulates control of video play/pause, forwarding/backwarding and volume settings. Programming language – Python (pyautogui, pyserial); board – Arduino.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published