An autonomous wall painting system using computer vision for paint detection and ESP32-CAM for spray control.
| Component | Specification |
|---|---|
| Camera | ESP32-CAM (AI Thinker) |
| Microcontroller | ESP32-S3 (USB programmer) |
| Spray Control | Relay module on GPIO 13 |
mdp/
├── backend/
│ ├── app.py ← Flask web server
│ └── static/index.html ← Web UI
├── esp32cam/
│ └── esp32cam.ino ← Camera + spray control
├── esp32s3/
│ └── esp32s3.ino ← USB programmer bridge
├── requirements.txt ← Python dependencies
└── README.md
git clone https://github.com/daksh1403/mdp.git
cd mdp
pip install -r requirements.txt- Connect ESP32-S3 as programmer (see
esp32s3/esp32s3.ino) - Connect IO0 to GND on ESP32-CAM
- Upload
esp32cam/esp32cam.ino - Remove IO0-GND jumper
- Press RESET on ESP32-CAM
- SSID: PaintSystem
- Password: paintdrone123
- IP: 192.168.4.1
cd backend
python app.py
# Open http://localhost:5000| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Web UI |
| GET | /video_feed |
MJPEG camera stream |
| GET | /ping |
ESP32-CAM connectivity check |
| POST | /capture |
Capture frame + paint detection |
| POST | /spray |
Fire spray (precision mode) |
| POST | /spray_start |
Start continuous spray |
| POST | /spray_stop |
Stop spray immediately |
| GET | /spray_sequence |
Execute spray sequence (SSE) |
| GET | /smart_spray_sequence |
Smart spray with segments (SSE) |
- Paint Detection: 6-method weighted voting algorithm for detecting unpainted (white) areas
- Grid-Based Detection: Divides camera view into 8×12 grid for cell-by-cell painting
- Precision Spray: Spray individual cells with configurable duration
- Continuous Spray: Spray multiple adjacent cells in one sweep
- Smart Mode: Automatically chooses precision or continuous based on cell layout
- Live Camera Feed: Real-time MJPEG stream from ESP32-CAM
- Web Interface: Modern, responsive UI for monitoring and control
The system uses computer vision to detect unpainted (white) areas:
- Adaptive Threshold (30%) — Local contrast detection
- Relative Brightness (20%) — Global brightness comparison
- Low Saturation (25%) — Color saturation analysis
- Otsu Threshold (10%) — Automatic threshold selection
- LAB Lightness (10%) — Perceptual lightness detection
- Blurred Threshold (5%) — Noise-resistant detection
Results are combined using weighted voting and morphological cleanup.
The ESP32-CAM runs a dual-port HTTP server:
- Port 80: Control API (ping, status, spray commands)
- Port 81: MJPEG video stream
The relay on GPIO 13 controls the spray mechanism with:
- Precision mode (timed spray)
- Continuous mode (manual start/stop)
- Safety watchdog (30-second auto-shutoff)
- Python 3.8+
- OpenCV 4.8+
- Flask 2.3+
- Arduino IDE (for ESP32 programming)
| Pin | Function |
|---|---|
| GPIO 13 | Relay control (spray) |
| GPIO 0-35 | Camera interface |
- Drone integration for autonomous positioning
- Multi-axis robotic arm support
- Advanced path planning algorithms
- Multi-color paint support
VIT Chennai MDP Team