Components Required
- ESP32 Board
- 5 LEDs (representing Thumb, Index, Middle, Ring, Pinky)
- 5 Resistors (220Ω each)
- Breadboard and Jumper Wires
- Webcam
- Computer with Python Installed
Circuit Setup for ESP32 Hand Gesture Project
Each LED is connected to a specific GPIO pin on the ESP32 (e.g., GPIO14, GPIO27, GPIO26, GPIO25, GPIO33). A 220Ω resistor is placed in series with each LED to limit current. The anode of each LED connects to the GPIO pin, and the cathode connects to the ground.
Python Script for Gesture Detection
On the computer, a Python script uses OpenCV to capture video from the webcam and MediaPipe to detect hand landmarks. It determines which fingers are raised and sends corresponding HTTP requests to the ESP32 to control the LEDs. For instance, raising the index finger sends a request to /led/index/on. If all fingers are lowered, a special command can be sent to perform a predefined action, such as turning off all LEDs.
In practice, this system allows for intuitive control of LEDs through simple hand gestures. Raising a specific finger turns on the corresponding LED, while lowering it turns the LED off. This real-time interaction demonstrates the seamless integration of computer vision and microcontroller-based hardware control. The project serves as a foundational example for more complex gesture-controlled applications, such as home automation or robotic control systems.
For in-depth explanation and code : Controlling LEDs Using Hand Gestures with ESP32 and Python
No comments:
Post a Comment