📦 Project Overview
Objective: Build a laser system that tracks human faces in real-time using computer vision and Arduino.
Skill Level: Intermediate
Estimated Time: 2–3 hours
🧰 Components Required
2x Servo Motors (SG90)
Laser Module
Plastic Box (for mounting)
Jumper Wires
USB Cable (for Arduino-PC connection)
Webcam or Laptop Camera
💻 Software Requirements
Make sure you have these installed:
Python (Recommended: 3.8+)
Python Libraries to Install:
pip install pyfirmata
pip install numpy
pip install opencv-python
📥 Step 1: Download the Files
🔗 Python Code & Files -Click Download Now Below
🛠️ Step 2: Circuit Assembly
Connect Servo Motors:
Servo 1 Signal → Pin 9 on Arduino
Servo 2 Signal → Pin 10 on Arduino
Both VCC → 5V
Both GND → GND
Mount Servo Motors in a stacked orientation (X and Y axis control) inside a plastic box or on a cardboard stand.
Attach Laser Module to the top servo (Y-axis). Make sure it’s aligned to point where the servos aim.
Connect your Arduino Uno to the PC using a USB cable.
🧠 Step 3: Upload Arduino Code (via PyFirmata)
You don’t need to upload any code to the Arduino directly! This project uses PyFirmata to communicate from Python to Arduino in real-time. Just make sure:
Arduino is connected
No code is running in the Arduino IDE
Python script communicates via COM port
🧪 Step 4: Run the Face Tracking Code
Open VS Code or any Python editor.
Run the Python script (
face_tracking.py
) from the downloaded folder.The webcam will open and start scanning for faces.
Once a face is detected, the servo motors will move accordingly to center the laser on the detected face.
🎯 How It Works
OpenCV detects human faces using a webcam.
Coordinates of the face center are calculated.
The values are mapped to servo angles (X and Y).
Using pyFirmata, Python sends servo positions to Arduino in real time.
The laser moves along with the detected face!
📸 Add Visuals
Front view of the mounted system
Circuit diagram image
Screenshot of face detection window
Video/GIF of laser tracking movement
✅ Results
You’ve built your very own AI-powered laser turret that can track faces using nothing but Arduino, servos, and a bit of Python magic!
🔗 Useful Resources
☕ Support the Creator
Like this project? Show your love and help fuel future builds:
👉 Buy Me a Coffee
📱 Stay Connected
Instagram: @scicraft9
YouTube: @scicraft