This project controls an LED on an ESP8266 microcontroller using different methods - from a simple text command to AI-powered hand gesture and drowsiness detection. Everything communicates over WiFi using UDP.
ROS_Workshop/
β
βββ p7/ # All ESP8266 + Python programs
β βββ p7/
β β βββ p7.ino # Arduino code for ESP8266 (UDP LED server)
β β
β βββ udp_client.py # Simple text-based UDP client
β βββ camera_test.py # Basic camera test (OpenCV)
β βββ finger_udp.py # Finger counting β LED control (MediaPipe)
β βββ drowsiness_udp.py # Drowsiness detection β LED alert (dlib)
β β
β βββ hand_landmarker.task # MediaPipe hand detection model (~12MB)
β βββ shape_predictor_68_face_landmarks.dat # dlib face landmark model (~99MB)
β
βββ ros2_my_own_ws/ # ROS2 Workspace
β βββ src/
β βββ udp_led_bridge/ # ROS2 Package
β βββ package.xml # Package metadata and dependencies
β βββ setup.py # Build configuration + entry points
β βββ setup.cfg # Install paths
β βββ udp_led_bridge/ # Python module (the actual code)
β βββ __init__.py # Makes this directory a Python package
β βββ udp_sender_node.py # ROS2 node that sends UDP commands
β
βββ docs/ # You are here! Documentation
βββ pyproject.toml # Python dependencies (managed by uv)
βββ main.py # Main entry point (if needed)
What: Runs on the ESP8266 microcontroller Does: Connects to WiFi, listens for UDP packets, controls the LED Language: C++ (Arduino)
What: A terminal-based program Does: You type "on" or "off", it sends the command to the ESP8266 Good for: Testing that the ESP8266 and UDP connection work
What: Opens your webcam and shows the video feed Does: Just displays what the camera sees Good for: Testing that your camera works with OpenCV
What: AI-powered hand gesture control Does: Counts your fingers using MediaPipe AI, sends commands based on count How: 2 fingers = LED ON, 3 fingers = LED OFF Uses: MediaPipe Hand Landmarker (Google's AI model)
What: AI-powered drowsiness alert system Does: Watches your eyes, detects if you're falling asleep How: Eyes closed for too long = LED ON (alert!), eyes open = LED OFF Uses: dlib face landmarks + Eye Aspect Ratio (EAR) algorithm
What: A ROS2 node that bridges ROS2 topics to UDP
Does: Listens on /led_command topic, forwards messages to ESP8266 via UDP
Good for: Integrating LED control into a larger ROS2 robot system
Same WiFi Network (OnePlusRajath)
βββββββββββββββββββββββββββββββββββββββββββ
β β
βββββββββββββββββββ΄ββββββββββββββββββββ βββββββββββββββββ΄βββ
β Your Computer β β ESP8266 β
β β β β
β Choose ONE of these to send: β β Listens on β
β β β UDP port 4210 β
β 1. udp_client.py (type commands) β β β
β 2. finger_udp.py (show fingers) βββ> β Receives "on" β
β 3. drowsiness_udp.py (close eyes) β β or "off" β
β 4. ROS2 udp_sender_node β β β
β β β Controls LED β
βββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββ