A hand gesture-controlled LED system using MediaPipe and Arduino. Pinch your thumb and index finger to turn the light ON or OFF in real time.
- Detects hand gestures with MediaPipe Hands.
- Toggles an Arduino-connected LED using a pinch gesture.
- Provides real-time visual feedback via webcam.
- Works on CPU-only systems (no GPU required).
- Python 3.10+
- OpenCV (
opencv-python) - MediaPipe (
mediapipe==0.10.21) - PySerial (
pyserial) - Arduino UNO (or similar)
- LED connected to pin 13 (or changeable in Arduino code)
Install Python dependencies with:
pip install -r requirements.txt- Connect the Arduino to your computer.
- Upload the Arduino code
hand_light_control.inoto your board. - Run the Jupyter Notebook
hand_light_control.ipynb. - Perform the pinch gesture (thumb + index finger) to toggle the LED.
- Press ESC to close the webcam window.
-
Webcam feed is mirrored for a natural view.
-
Pinch your thumb and index finger to toggle the LED:
- Green circle → Light ON
- Red circle → Light OFF
-
Each gesture includes a 0.5-second delay to prevent flickering.
hand-light-control-project/
│
├── hand_light_control.ipynb # Jupyter Notebook with MediaPipe code
├── arduino/
│ └── hand_light_control.ino # Arduino code for controlling LED
├── requirements.txt # Python dependencies
└── README.md # Project description
This project is open-source. Feel free to use, modify, and improve it.