Skip to content

Latest commit

Β 

History

History
98 lines (82 loc) Β· 4.6 KB

File metadata and controls

98 lines (82 loc) Β· 4.6 KB

Project Overview

What Does This Project Do?

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.


Project Structure

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)

The 5 Programs Explained

1. ESP8266 Arduino Code (p7/p7/p7.ino)

What: Runs on the ESP8266 microcontroller Does: Connects to WiFi, listens for UDP packets, controls the LED Language: C++ (Arduino)

2. Simple UDP Client (p7/udp_client.py)

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

3. Camera Test (p7/camera_test.py)

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

4. Finger Counter (p7/finger_udp.py)

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)

5. Drowsiness Detector (p7/drowsiness_udp.py)

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

6. ROS2 UDP Bridge (ros2_my_own_ws/.../udp_sender_node.py)

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


How Everything Connects

                        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    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜