Whole public repo
Downloads the source code, website, GUI launcher, tracker scripts, and Arduino sketch.
A Python-powered face recognition and tracking project that trains a custom LBPH model, detects the recognized face through the webcam, and steers an Arduino servo through a configurable COM port — all from one unified GUI.
Click once to download the latest public project files from GitHub as a ZIP. After extraction, the project can run locally from the included Python scripts and Arduino sketch.
Downloads the source code, website, GUI launcher, tracker scripts, and Arduino sketch.
Your face dataset, trained model, and demo recordings are generated on your computer.
The project is organized around face capture, model training, live tracking, and optional Arduino control.
Capture your own samples into the private dataset folder.
Custom model saved as face_model.xml.
Horizontal tracking angle mapped from face position.
Modern Tkinter parent launcher with themes and COM settings.
Follow these steps after downloading the ZIP so Python, OpenCV, LBPH, and Arduino all line up cleanly.
Extract the ZIP, open the extracted folder in VS Code or a terminal, and keep the folder structure unchanged so the GUI can find the trainer, tracker, dataset, and Arduino sketch.
cd Servo-Facial-Tracking-main
Use a virtual environment so OpenCV and PySerial install only for this project.
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Open facearduino/facearduino.ino in Arduino IDE, attach the servo signal wire
to pin 9, connect power and ground, upload the sketch, then copy the port name
shown by the IDE.
Start the dashboard, capture face samples with the trainer, let it write
custom face/face_model.xml, then run the LBPH tracker with Arduino access on or off.
python face_tracker_gui.py
Each part has a clear job, so the project can be tested in pieces or run as one system.
Run the trainer, press Space when your face is detected, and save normalized face crops into the dataset.
The trainer reads the dataset, labels the images as your face, and writes the LBPH model file.
The LBPH tracker recognizes the face, smooths the target position, and calculates a servo angle.
The GUI launches scripts, switches themes, manages Arduino access, and passes the selected COM port.
Camera frames move through detection and recognition before turning into motion commands.
OpenCV captures frames and converts them to grayscale for face detection.
The tracker locates face rectangles and keeps recent positions for stable movement.
The model checks whether the detected face matches the trained label.
When Arduino access is enabled, Python sends angle values over serial.
python face_tracker_gui.py
FACE_TRACKER_USE_ARDUINO=1
FACE_TRACKER_COM_PORT=COM10
These values are applied when a tracker is started from the GUI, so the scripts can run with or without Arduino access.
This page shows the system without embedding your face dataset, demo video, or biometric model.
The public overview uses generated interface graphics instead of webcam video or dataset images.
Dataset images, demo recordings, and trained recognition models should stay out of hosted folders.
Open the main pieces directly from this page.
Useful keys and GUI settings while testing.
Q quits, C centers, R moves to minimum angle, I inverts, and P pauses output.
A and D nudge the servo angle with momentum while face tracking briefly waits.
The GUI can turn Arduino serial access on or off and pass a COM port such as COM10.
Wiring the servo and Arduino to work with the Python tracker over serial.
Python sends a plain integer (e.g. 90\n) over the selected COM port at 9600 baud. Arduino reads it with Serial.parseInt() and writes it directly to the servo.
For multiple servos or high-torque motors use an external 5 V supply sharing a common ground with the Arduino — do not draw more than ~500 mA from the onboard 5 V pin.
Watch the tracker recognise a face and steer the servo in real time.